Automatic Cronjob Checkin: 20170418-142622

This commit is contained in:
BlubbFish 2017-04-18 12:27:11 +00:00
parent 581a2ff8c5
commit b1c3d338f0
13 changed files with 79 additions and 72 deletions

View File

@ -10,7 +10,6 @@ namespace svnsync.Controllers
{ {
private static ViewsTray viewTray; private static ViewsTray viewTray;
private static ControllersWindow controllerWindow; private static ControllersWindow controllerWindow;
//private string args;
public delegate void _enableLoopRun(); public delegate void _enableLoopRun();
public static event _enableLoopRun StartLoop; public static event _enableLoopRun StartLoop;
@ -170,12 +169,12 @@ namespace svnsync.Controllers
System.Windows.Forms.Application.Exit(); System.Windows.Forms.Application.Exit();
} }
internal static void DeleteButton_Click(object sender, EventArgs e) { internal static void DeleteButton_Click(Object sender, EventArgs e) {
if(!(sender is System.Windows.Forms.Button)) { if(!(sender is System.Windows.Forms.Button)) {
return; return;
} }
System.Windows.Forms.TreeView t = (System.Windows.Forms.TreeView)((ViewsWindowFormFileList)((System.Windows.Forms.Button)sender).Parent).tree; System.Windows.Forms.TreeView t = (System.Windows.Forms.TreeView)((ViewsWindowFormFileList)((System.Windows.Forms.Button)sender).Parent).tree;
List<System.Windows.Forms.TreeNode> l = TreeBuilder.getSelectedNodes(t.Nodes); List<System.Windows.Forms.TreeNode> l = TreeBuilder.GetSelectedNodes(t.Nodes);
controllerWindow.Dispose(); controllerWindow.Dispose();
System.Windows.Forms.Application.DoEvents(); System.Windows.Forms.Application.DoEvents();
InitControllerWindow(); InitControllerWindow();
@ -186,7 +185,7 @@ namespace svnsync.Controllers
} }
RunAgainButton_Click(sender, null); RunAgainButton_Click(sender, null);
} }
internal static void RunAgainButton_Click(object sender, EventArgs e) { internal static void RunAgainButton_Click(Object sender, EventArgs e) {
controllerWindow.Dispose(); controllerWindow.Dispose();
System.Windows.Forms.Application.DoEvents(); System.Windows.Forms.Application.DoEvents();
InitControllerWindow(); InitControllerWindow();
@ -194,7 +193,7 @@ namespace svnsync.Controllers
Runner(); Runner();
} }
internal static void SvnOpenButton_Click(object sender, EventArgs e) { internal static void SvnOpenButton_Click(Object sender, EventArgs e) {
System.Diagnostics.Process p = new System.Diagnostics.Process(); System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd"; p.StartInfo.FileName = "cmd";
p.StartInfo.WorkingDirectory = viewTray.Model.Args.GetArgumentData("-d"); p.StartInfo.WorkingDirectory = viewTray.Model.Args.GetArgumentData("-d");
@ -202,12 +201,12 @@ namespace svnsync.Controllers
p.Start(); p.Start();
} }
internal static void AddButton_Click(object sender, EventArgs e) { internal static void AddButton_Click(Object sender, EventArgs e) {
if(!(sender is System.Windows.Forms.Button)) { if(!(sender is System.Windows.Forms.Button)) {
return; return;
} }
System.Windows.Forms.TreeView t = (System.Windows.Forms.TreeView)((ViewsWindowFormFileList)((System.Windows.Forms.Button)sender).Parent).tree; System.Windows.Forms.TreeView t = (System.Windows.Forms.TreeView)((ViewsWindowFormFileList)((System.Windows.Forms.Button)sender).Parent).tree;
List<System.Windows.Forms.TreeNode> l = TreeBuilder.getSelectedNodes(t.Nodes); List<System.Windows.Forms.TreeNode> l = TreeBuilder.GetSelectedNodes(t.Nodes);
controllerWindow.Dispose(); controllerWindow.Dispose();
System.Windows.Forms.Application.DoEvents(); System.Windows.Forms.Application.DoEvents();
InitControllerWindow(); InitControllerWindow();

View File

@ -12,8 +12,8 @@ namespace svnsync.Controllers
private static ViewsWindow viewWindow; private static ViewsWindow viewWindow;
private Handles.FormType initAction = Handles.FormType.Normal; private Handles.FormType initAction = Handles.FormType.Normal;
private String initMessage; private String initMessage;
private List<string> initDeletedFiles = new List<string>(); private List<String> initDeletedFiles = new List<String>();
private List<string> initNewFiles = new List<string>(); private List<String> initNewFiles = new List<String>();
/// <summary> /// <summary>
/// Tray Controller /// Tray Controller
/// </summary> /// </summary>
@ -62,7 +62,7 @@ namespace svnsync.Controllers
viewWindow.Model.Message = p; viewWindow.Model.Message = p;
} }
} }
internal void SetDeletedFiles(List<string> p) { internal void SetDeletedFiles(List<String> p) {
if(viewWindow == null) { if(viewWindow == null) {
this.initDeletedFiles = p; this.initDeletedFiles = p;
} else { } else {
@ -70,7 +70,7 @@ namespace svnsync.Controllers
} }
} }
internal void SetNewFiles(List<string> list) { internal void SetNewFiles(List<String> list) {
if(viewWindow == null) { if(viewWindow == null) {
this.initNewFiles = list; this.initNewFiles = list;
} else { } else {

View File

@ -35,13 +35,13 @@ namespace svnsync.Helpers
{ } { }
} }
public class TreePart { public class TreePart {
public TreePart(String name, bool isFolder, List<TreePart> child) { public TreePart(String name, Boolean isFolder, List<TreePart> child) {
this.name = name; this.Name = name;
this.child = child; this.Child = child;
this.isFolder = isFolder; this.IsFolder = isFolder;
} }
public string name { get; private set; } public String Name { get; private set; }
public List<TreePart> child { get; set; } public List<TreePart> Child { get; set; }
public bool isFolder { get; set; } public Boolean IsFolder { get; set; }
} }
} }

View File

@ -8,96 +8,103 @@ using System.Windows.Forms;
namespace svnsync.Helpers { namespace svnsync.Helpers {
public class TreeBuilder { public class TreeBuilder {
public static TreeNode[] createDirList(List<string> tree, String root) { public static TreeNode[] CreateDirList(List<String> tree, String root) {
List<TreePart> ntree = new List<TreePart>(); List<TreePart> ntree = new List<TreePart>();
foreach(String node in tree) { foreach(String node in tree) {
String folder = node; String folder = node;
folder = folder.Replace('\\', '/'); folder = folder.Replace('\\', '/');
folder = (folder.StartsWith("/")) ? folder.Substring(1) : folder; folder = (folder.StartsWith("/")) ? folder.Substring(1) : folder;
folder = (folder.EndsWith("/")) ? folder.Substring(0, folder.Length - 1) : folder; folder = (folder.EndsWith("/")) ? folder.Substring(0, folder.Length - 1) : folder;
bool isFolder = System.IO.Directory.Exists(root + "/" + folder); Boolean isFolder = System.IO.Directory.Exists(root + "/" + folder);
String[] folders = folder.Split('/'); String[] folders = folder.Split('/');
Array.Reverse(folders); Array.Reverse(folders);
List<TreePart> prev = null; List<TreePart> prev = null;
foreach(String entry in folders) { foreach(String entry in folders) {
String name = entry; String name = entry;
if(prev == null) if(prev == null) {
prev = new List<TreePart>() { new TreePart(name, isFolder, new List<TreePart>()) }; prev = new List<TreePart>() { new TreePart(name, isFolder, new List<TreePart>()) };
else } else {
prev = new List<TreePart>() { new TreePart(name, isFolder, prev) }; prev = new List<TreePart>() { new TreePart(name, isFolder, prev) };
if(!isFolder) }
if (!isFolder) {
isFolder = true; isFolder = true;
}
} }
ntree = treeMatch(ntree, prev); ntree = TreeMatch(ntree, prev);
} }
return createListDirRender(ntree); return CreateListDirRender(ntree);
} }
public static List<TreePart> treeMatch(List<TreePart> ntree, List<TreePart> input) { public static List<TreePart> TreeMatch(List<TreePart> ntree, List<TreePart> input) {
String[] key1 = array_keys(input); String[] key1 = Array_keys(input);
if(ntree.Count == 0 || (key1.Length > 0 && !array_key_exists(key1[0], ntree)) || key1.Length == 0) { if(ntree.Count == 0 || (key1.Length > 0 && !Array_key_exists(key1[0], ntree)) || key1.Length == 0) {
ntree.Add(input[0]); ntree.Add(input[0]);
} else { } else {
String[] key2 = array_keys(findName(key1[0], input)); String[] key2 = Array_keys(FindName(key1[0], input));
if(key2.Length != 0) { if(key2.Length != 0) {
if(array_key_exists(key2[0], findName(key1[0], ntree))) { if(Array_key_exists(key2[0], FindName(key1[0], ntree))) {
/*setChild(key2[0], findName(key1[0], ntree),*/ /*setChild(key2[0], findName(key1[0], ntree),*/
treeMatch(findName(key1[0], ntree), findName(key1[0], input)); TreeMatch(FindName(key1[0], ntree), FindName(key1[0], input));
} else { } else {
findName(key1[0], ntree).Add(findName(key1[0], input)[0]); FindName(key1[0], ntree).Add(FindName(key1[0], input)[0]);
} }
} }
} }
return ntree; return ntree;
} }
public static string[] array_keys(List<TreePart> input) { public static String[] Array_keys(List<TreePart> input) {
List<String> ret = new List<String>(); List<String> ret = new List<String>();
foreach(TreePart item in input) { foreach(TreePart item in input) {
ret.Add(item.name); ret.Add(item.Name);
} }
return ret.ToArray(); return ret.ToArray();
} }
public static bool array_key_exists(string p, List<TreePart> ntree) { public static Boolean Array_key_exists(String p, List<TreePart> ntree) {
foreach(TreePart item in ntree) { foreach(TreePart item in ntree) {
if(item.name == p) if(item.Name == p) {
return true; return true;
}
} }
return false; return false;
} }
public static List<TreePart> findName(string key, List<TreePart> input) { public static List<TreePart> FindName(String key, List<TreePart> input) {
foreach(TreePart item in input) { foreach(TreePart item in input) {
if(item.name == key) if(item.Name == key) {
return item.child; return item.Child;
}
} }
return null; return null;
} }
public static TreeNode[] createListDirRender(List<TreePart> ntree) { public static TreeNode[] CreateListDirRender(List<TreePart> ntree) {
TreeNode[] t = new TreeNode[ntree.Count]; TreeNode[] t = new TreeNode[ntree.Count];
int i = 0; Int32 i = 0;
foreach(TreePart item in ntree) { foreach(TreePart item in ntree) {
String name = item.name + ((item.isFolder) ? ".folder" : (item.name.LastIndexOf('.') == -1) ? ".file" : item.name.Substring(item.name.LastIndexOf('.'))); String name = item.Name + ((item.IsFolder) ? ".folder" : (item.Name.LastIndexOf('.') == -1) ? ".file" : item.Name.Substring(item.Name.LastIndexOf('.')));
if(item.child.Count == 0) if(item.Child.Count == 0) {
t[i++] = new TreeNode(name); t[i++] = new TreeNode(name);
else } else {
t[i++] = new TreeNode(name, createListDirRender(item.child)); t[i++] = new TreeNode(name, CreateListDirRender(item.Child));
}
t[i - 1].Checked = true; t[i - 1].Checked = true;
} }
return t; return t;
} }
public static ImageList getImages(TreeNodeCollection treeNodeCollection) { public static ImageList GetImages(TreeNodeCollection treeNodeCollection) {
ImageList li = new ImageList(); ImageList li = new ImageList();
runThroughNodes(li.Images, treeNodeCollection); RunThroughNodes(li.Images, treeNodeCollection);
return li; return li;
} }
public static void runThroughNodes(ImageList.ImageCollection imageCollection, TreeNodeCollection treeNodeCollection) { public static void RunThroughNodes(ImageList.ImageCollection imageCollection, TreeNodeCollection treeNodeCollection) {
foreach(TreeNode item in treeNodeCollection) { foreach(TreeNode item in treeNodeCollection) {
imageCollection.Add(getImageType(item.Text)); imageCollection.Add(GetImageType(item.Text));
item.ImageIndex = imageCollection.Count - 1; item.ImageIndex = imageCollection.Count - 1;
item.Text = item.Text.Substring(0, item.Text.LastIndexOf(".")); item.Text = item.Text.Substring(0, item.Text.LastIndexOf("."));
if(item.Nodes.Count > 0) if(item.Nodes.Count > 0) {
runThroughNodes(imageCollection, item.Nodes); RunThroughNodes(imageCollection, item.Nodes);
}
} }
} }
public static Icon getImageType(string p) { public static Icon GetImageType(String p) {
switch(p.Substring(p.LastIndexOf("."))) { switch(p.Substring(p.LastIndexOf("."))) {
case ".folder": case ".folder":
return Properties.Resources.Special_Folder; return Properties.Resources.Special_Folder;
@ -106,13 +113,15 @@ namespace svnsync.Helpers {
} }
return Properties.Resources.Special_File; return Properties.Resources.Special_File;
} }
public static List<TreeNode> getSelectedNodes(TreeNodeCollection treeNodeCollection) { public static List<TreeNode> GetSelectedNodes(TreeNodeCollection treeNodeCollection) {
List<TreeNode> l = new List<TreeNode>(); List<TreeNode> l = new List<TreeNode>();
foreach(TreeNode item in treeNodeCollection) { foreach(TreeNode item in treeNodeCollection) {
if(item.Checked && item.Nodes.Count == 0) if(item.Checked && item.Nodes.Count == 0) {
l.Add(item); l.Add(item);
if(item.Nodes.Count > 0) }
l.AddRange(getSelectedNodes(item.Nodes)); if (item.Nodes.Count > 0) {
l.AddRange(GetSelectedNodes(item.Nodes));
}
} }
return l; return l;
} }

View File

@ -28,13 +28,13 @@ namespace svnsync.Models
} }
private List<String> DeletedFilesValue; private List<String> DeletedFilesValue;
public List<string> DeletedFiles { public List<String> DeletedFiles {
get { return this.DeletedFilesValue; } get { return this.DeletedFilesValue; }
set { this.DeletedFilesValue = value; this.Update(); } set { this.DeletedFilesValue = value; this.Update(); }
} }
private List<String> NewFilesValue; private List<String> NewFilesValue;
public List<string> NewFiles { public List<String> NewFiles {
get { return this.NewFilesValue; } get { return this.NewFilesValue; }
set { this.NewFilesValue = value; this.Update(); } set { this.NewFilesValue = value; this.Update(); }
} }

View File

@ -5,7 +5,6 @@ using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using svnsync.Properties; using svnsync.Properties;
using svnsync.Helpers; using svnsync.Helpers;
using System;
namespace svnsync.Views namespace svnsync.Views
{ {

View File

@ -7,7 +7,7 @@ namespace svnsync.Views
{ {
public class ViewsWindow : OwnView public class ViewsWindow : OwnView
{ {
private ViewsWindowFormInterface form; private IViewsWindowFormInterface form;
public ModelsWindow Model { get; private set; } public ModelsWindow Model { get; private set; }
public ViewsWindow() public ViewsWindow()
@ -39,7 +39,7 @@ namespace svnsync.Views
this.form.UpdateForm(); this.form.UpdateForm();
} }
private void SwitchContext(ViewsWindowFormInterface newform) { private void SwitchContext(IViewsWindowFormInterface newform) {
this.form = newform; this.form = newform;
this.form.SetModel(this.Model); this.form.SetModel(this.Model);
this.form.Show(); this.form.Show();

View File

@ -12,7 +12,7 @@ using svnsync.Controllers;
namespace svnsync.Views namespace svnsync.Views
{ {
public partial class ViewsWindowForm : Form, ViewsWindowFormInterface public partial class ViewsWindowForm : Form, IViewsWindowFormInterface
{ {
private ModelsWindow model; private ModelsWindow model;
public ViewsWindowForm() public ViewsWindowForm()

View File

@ -12,7 +12,7 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace svnsync.Views { namespace svnsync.Views {
public partial class ViewsWindowFormError : Form, ViewsWindowFormInterface { public partial class ViewsWindowFormError : Form, IViewsWindowFormInterface {
private ModelsWindow model; private ModelsWindow model;
public ViewsWindowFormError() { public ViewsWindowFormError() {
InitializeComponent(); InitializeComponent();
@ -31,7 +31,7 @@ namespace svnsync.Views {
Match r = new Regex("svn:.*(([WE])[0-9]*): (.*)",RegexOptions.IgnoreCase).Match(message); Match r = new Regex("svn:.*(([WE])[0-9]*): (.*)",RegexOptions.IgnoreCase).Match(message);
if(r.Success) { if(r.Success) {
String ecode = r.Groups[2].Value.ToLower() == "w" ? "Warnung" : "Fehler"; String ecode = r.Groups[2].Value.ToLower() == "w" ? "Warnung" : "Fehler";
this.errorgrid.Rows.Add(new string[] { r.Groups[1].Value, ecode, r.Groups[3].Value}); this.errorgrid.Rows.Add(new String[] { r.Groups[1].Value, ecode, r.Groups[3].Value});
} }
} }
})); }));

View File

@ -12,7 +12,7 @@ using svnsync.Controllers;
using svnsync.Helpers; using svnsync.Helpers;
namespace svnsync.Views { namespace svnsync.Views {
public partial class ViewsWindowFormFileList : Form, ViewsWindowFormInterface { public partial class ViewsWindowFormFileList : Form, IViewsWindowFormInterface {
private ModelsWindow model; private ModelsWindow model;
public ViewsWindowFormFileList() { public ViewsWindowFormFileList() {
InitializeComponent(); InitializeComponent();
@ -27,15 +27,15 @@ namespace svnsync.Views {
case Helpers.Handles.FormType.DeletedFiles: case Helpers.Handles.FormType.DeletedFiles:
this.title.Text = "Diese Daten sind gelöscht worden:"; this.title.Text = "Diese Daten sind gelöscht worden:";
this.runButton.Text = "Löschen"; this.runButton.Text = "Löschen";
this.tree.Nodes.AddRange(TreeBuilder.createDirList(this.model.DeletedFiles, this.model.Args.GetArgumentData("-d"))); this.tree.Nodes.AddRange(TreeBuilder.CreateDirList(this.model.DeletedFiles, this.model.Args.GetArgumentData("-d")));
this.tree.ImageList = TreeBuilder.getImages(this.tree.Nodes); this.tree.ImageList = TreeBuilder.GetImages(this.tree.Nodes);
this.runButton.Click += new EventHandler(ControllersTray.DeleteButton_Click); this.runButton.Click += new EventHandler(ControllersTray.DeleteButton_Click);
break; break;
case Handles.FormType.UnversionFiles: case Handles.FormType.UnversionFiles:
this.title.Text = "Diese Daten sind unversioniert:"; this.title.Text = "Diese Daten sind unversioniert:";
this.runButton.Text = "Hinzufügen"; this.runButton.Text = "Hinzufügen";
this.tree.Nodes.AddRange(TreeBuilder.createDirList(this.model.NewFiles, this.model.Args.GetArgumentData("-d"))); this.tree.Nodes.AddRange(TreeBuilder.CreateDirList(this.model.NewFiles, this.model.Args.GetArgumentData("-d")));
this.tree.ImageList = TreeBuilder.getImages(this.tree.Nodes); this.tree.ImageList = TreeBuilder.GetImages(this.tree.Nodes);
this.runButton.Click += new EventHandler(ControllersTray.AddButton_Click); this.runButton.Click += new EventHandler(ControllersTray.AddButton_Click);
break; break;
} }

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using svnsync.Models; using svnsync.Models;
namespace svnsync.Views { namespace svnsync.Views {
public interface ViewsWindowFormInterface { public interface IViewsWindowFormInterface {
void UpdateForm(); void UpdateForm();
void SetModel(ModelsWindow window); void SetModel(ModelsWindow window);
void Show(); void Show();

View File

@ -31,7 +31,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<StartArguments>-d "D:\\Visual Studio 2012\\Projects" -cron -externals-own</StartArguments> <StartArguments>-d "E:\\Eigene Dateien\\Dokumente\\Visual Studio 2017\\Projects" -cron -externals-own</StartArguments>
<RemoteDebugEnabled>false</RemoteDebugEnabled> <RemoteDebugEnabled>false</RemoteDebugEnabled>
<StartAction>Project</StartAction> <StartAction>Project</StartAction>
</PropertyGroup> </PropertyGroup>