Init
This commit is contained in:
parent
c964721519
commit
401e0a89b2
20
svnsync.sln
Normal file
20
svnsync.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "svnsync", "svnsync\svnsync.csproj", "{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Debug|x86.Build.0 = Debug|x86
|
||||
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Release|x86.ActiveCfg = Release|x86
|
||||
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
111
svnsync/CmdArgs.cs
Normal file
111
svnsync/CmdArgs.cs
Normal file
@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace svnsync
|
||||
{
|
||||
class CmdArgs
|
||||
{
|
||||
private ArgTypes[] argsPosible = {
|
||||
new ArgTypes("-d", ArgTypes.ArgLength.Touple),
|
||||
new ArgTypes("-cron", ArgTypes.ArgLength.Single),
|
||||
new ArgTypes("-autoadd", ArgTypes.ArgLength.Single),
|
||||
new ArgTypes("-autodelete", ArgTypes.ArgLength.Single)
|
||||
};
|
||||
class ArgTypes
|
||||
{
|
||||
public enum ArgLength
|
||||
{
|
||||
Single,
|
||||
Touple
|
||||
}
|
||||
public string name { get; private set; }
|
||||
public ArgLength length { get; private set; }
|
||||
public ArgTypes(string name, ArgLength length)
|
||||
{
|
||||
this.name = name;
|
||||
this.length = length;
|
||||
}
|
||||
}
|
||||
class ArgTouple
|
||||
{
|
||||
public ArgTouple(string type, string data)
|
||||
{
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
public ArgTouple(string type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
public string type { get; private set; }
|
||||
public string data { get; private set; }
|
||||
|
||||
internal void setData(string data)
|
||||
{
|
||||
if(data != "")
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
private string[] args;
|
||||
private List<ArgTouple> argList;
|
||||
|
||||
public CmdArgs(string[] args)
|
||||
{
|
||||
this.args = args;
|
||||
this.Init();
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
this.argList = new List<ArgTouple>();
|
||||
for (int i = 0; i < this.args.Length; i++)
|
||||
{
|
||||
ArgTypes a = this.findArg(args[i]);
|
||||
if(a != null) {
|
||||
ArgTouple arg = new ArgTouple(args[i]);
|
||||
if(a.length == ArgTypes.ArgLength.Touple)
|
||||
if(args.Length > i+1)
|
||||
arg.setData(args[++i]);
|
||||
else
|
||||
throw new ArgumentException();
|
||||
this.argList.Add(arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArgTypes findArg(string p)
|
||||
{
|
||||
foreach (ArgTypes item in argsPosible)
|
||||
{
|
||||
if (item.name == p)
|
||||
return item;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public int GetArgsLength()
|
||||
{
|
||||
return this.argList.Count;
|
||||
}
|
||||
public bool HasArgumentType(string type)
|
||||
{
|
||||
foreach (ArgTouple t in this.argList)
|
||||
{
|
||||
if (t.type == type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
internal string GetArgumentData(string type)
|
||||
{
|
||||
foreach (ArgTouple t in this.argList)
|
||||
{
|
||||
if (t.type == type)
|
||||
return t.data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
63
svnsync/Form1.Designer.cs
generated
Normal file
63
svnsync/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
namespace svnsync
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Erforderliche Designervariable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Verwendete Ressourcen bereinigen.
|
||||
/// </summary>
|
||||
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Vom Windows Form-Designer generierter Code
|
||||
|
||||
/// <summary>
|
||||
/// Erforderliche Methode für die Designerunterstützung.
|
||||
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// notifyIcon
|
||||
//
|
||||
this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon")));
|
||||
this.notifyIcon.Text = "SvnSync";
|
||||
this.notifyIcon.Visible = true;
|
||||
this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MouseDoubleClick);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(370, 262);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "Form1";
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "SvnSync";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
|
||||
this.Resize += new System.EventHandler(this.EventHandler_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.NotifyIcon notifyIcon;
|
||||
}
|
||||
}
|
||||
|
504
svnsync/Form1.cs
Normal file
504
svnsync/Form1.cs
Normal file
@ -0,0 +1,504 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace svnsync
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
enum HandleSvnType
|
||||
{
|
||||
NotInit,
|
||||
ToMutchChronRuns,
|
||||
HasVersionitedFiles,
|
||||
UnexpectedError,
|
||||
ExternDeletedFiles,
|
||||
}
|
||||
private CmdArgs c;
|
||||
private Svn s;
|
||||
public Form1(string[] args)
|
||||
{
|
||||
InitializeComponent();
|
||||
/*List<String> l = new List<string>();
|
||||
l.Add("/abc/Bla/Blubb/");
|
||||
l.Add("/Blubb/Foo/");
|
||||
l.Add("/Blubb/Bla/");
|
||||
l.Add("/Blubb/Bla/Foo");
|
||||
l.Add("/Blubb/Bla/Blubb");
|
||||
this.CreateFileList("Löschen", "Diese Daten sind gelöscht worden:", l, new EventHandler(deleteButton_Click));
|
||||
*/this.c = new CmdArgs(args);
|
||||
this.StartSvn();
|
||||
this.Init();
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
if (this.c.HasArgumentType("-cron"))
|
||||
if (this.cronJob(0))
|
||||
{
|
||||
this.ShowToolTip("Svn Sync", "Datensicherung Erfolgreich", ToolTipIcon.Info);
|
||||
System.Threading.Thread.Sleep(5000);
|
||||
this.Close();
|
||||
//Application.Exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool cronJob(int run)
|
||||
{
|
||||
if (s == null)
|
||||
return this.HandleSvn(HandleSvnType.NotInit, "");
|
||||
if (run > 10)
|
||||
return this.HandleSvn(HandleSvnType.ToMutchChronRuns, "");
|
||||
s.CheckStatus();
|
||||
if (s.IsNotOnlyModified())
|
||||
{
|
||||
if (s.IsUncheckedFiles())
|
||||
{
|
||||
if (c.HasArgumentType("-autoadd"))
|
||||
s.AddFiles(s.getNoVersionFiles());
|
||||
else
|
||||
return this.HandleSvn(HandleSvnType.HasVersionitedFiles, "");
|
||||
}
|
||||
if (s.IsError())
|
||||
return this.HandleSvn(HandleSvnType.UnexpectedError, s.getError());
|
||||
if (s.IsExternDeletedFiles())
|
||||
{
|
||||
if (c.HasArgumentType("-autodelete"))
|
||||
s.DeleteFiles(s.getWasDeletedFiles());
|
||||
else
|
||||
return this.HandleSvn(HandleSvnType.ExternDeletedFiles, "");
|
||||
}
|
||||
if (s.IsError())
|
||||
return this.HandleSvn(HandleSvnType.UnexpectedError, s.getError());
|
||||
return this.cronJob(run + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.SetArgCheckIn(this.GetTimeStamp(DateTime.Now));
|
||||
if (s.IsError())
|
||||
return this.HandleSvn(HandleSvnType.UnexpectedError, s.getError());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool HandleSvn(HandleSvnType handleSvnType, string p)
|
||||
{
|
||||
switch (handleSvnType)
|
||||
{
|
||||
case HandleSvnType.NotInit:
|
||||
this.ShowToolTip("Svn Sync Fehler", "Svn wurde noch nicht inizialisiert", ToolTipIcon.Error);
|
||||
return false;
|
||||
case HandleSvnType.ToMutchChronRuns:
|
||||
this.ShowToolTip("Svn Sync Fehler", "Fehler im Cronjob, mehr als 10 Aufrufe!", ToolTipIcon.Error);
|
||||
this.CreateSVNOpen("Fehler im Cronjob, mehr als 10 Aufrufe!", "");
|
||||
return false;
|
||||
case HandleSvnType.HasVersionitedFiles:
|
||||
this.ShowToolTip("Svn Sync", "Es sind unversionierte Dateien vorhanden (?)", ToolTipIcon.Info);
|
||||
this.CreateFileList("Hinzufügen", "Diese Daten sind unversioniert:", s.getNoVersionFiles(), new EventHandler(addButton_Click));
|
||||
return false;
|
||||
case HandleSvnType.UnexpectedError:
|
||||
this.ShowToolTip("Svn Sync Fehler", "Es ist ein Unvorhersebarer Fehler aufgetreten: " + p, ToolTipIcon.Error);
|
||||
this.CreateSVNOpen("Es ist ein Unvorhersebarer Fehler aufgetreten", p);
|
||||
return false;
|
||||
case HandleSvnType.ExternDeletedFiles:
|
||||
this.ShowToolTip("Svn Sync", "Es sind extern gelöschte Dateien vorhanden (!)", ToolTipIcon.Info);
|
||||
this.CreateFileList("Löschen", "Diese Daten sind gelöscht worden:", s.getWasDeletedFiles(), new EventHandler(deleteButton_Click));
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void CreateFileList(string textlabel, string titel, List<String> list, EventHandler eventHandler)
|
||||
{
|
||||
this.Controls.Clear();
|
||||
list.Sort();
|
||||
System.Windows.Forms.TreeView tree = new System.Windows.Forms.TreeView();
|
||||
tree.Location = new System.Drawing.Point(10, 30);
|
||||
tree.Size = new System.Drawing.Size(350, 180);
|
||||
tree.TabIndex = 0;
|
||||
tree.Nodes.AddRange(this.createDirList(list));
|
||||
tree.CheckBoxes = true;
|
||||
tree.HideSelection = false;
|
||||
tree.ImageList = this.getImages(tree.Nodes);
|
||||
this.Controls.Add(tree);
|
||||
|
||||
System.Windows.Forms.Label label = new System.Windows.Forms.Label();
|
||||
label.AutoSize = true;
|
||||
label.Location = new System.Drawing.Point(10, 10);
|
||||
label.Size = new System.Drawing.Size(35, 13);
|
||||
label.TabIndex = 1;
|
||||
label.Text = titel;
|
||||
this.Controls.Add(label);
|
||||
|
||||
System.Windows.Forms.Button runButton = new System.Windows.Forms.Button();
|
||||
runButton.Location = new System.Drawing.Point(10, 217);
|
||||
runButton.Size = new System.Drawing.Size(120, 23);
|
||||
runButton.TabIndex = 2;
|
||||
runButton.Text = textlabel;
|
||||
runButton.UseVisualStyleBackColor = true;
|
||||
runButton.Click += eventHandler;
|
||||
this.Controls.Add(runButton);
|
||||
|
||||
System.Windows.Forms.Button doAgainButton = new System.Windows.Forms.Button();
|
||||
doAgainButton.Location = new System.Drawing.Point(136, 216);
|
||||
doAgainButton.Size = new System.Drawing.Size(120, 23);
|
||||
doAgainButton.TabIndex = 3;
|
||||
doAgainButton.Text = "Wiederholen";
|
||||
doAgainButton.UseVisualStyleBackColor = true;
|
||||
doAgainButton.Click += new EventHandler(runagainButton_Click);
|
||||
this.Controls.Add(doAgainButton);
|
||||
|
||||
System.Windows.Forms.Button svnOpenButton = new System.Windows.Forms.Button();
|
||||
svnOpenButton.Location = new System.Drawing.Point(263, 216);
|
||||
svnOpenButton.Size = new System.Drawing.Size(100, 23);
|
||||
svnOpenButton.TabIndex = 4;
|
||||
svnOpenButton.Text = "SVN Öffnen";
|
||||
svnOpenButton.UseVisualStyleBackColor = true;
|
||||
svnOpenButton.Click += new EventHandler(openButton_Click);
|
||||
this.Controls.Add(svnOpenButton);
|
||||
}
|
||||
|
||||
private ImageList getImages(TreeNodeCollection treeNodeCollection)
|
||||
{
|
||||
ImageList li = new ImageList();
|
||||
this.runThroughNodes(li.Images, treeNodeCollection);
|
||||
return li;
|
||||
}
|
||||
private void runThroughNodes(ImageList.ImageCollection imageCollection, TreeNodeCollection treeNodeCollection)
|
||||
{
|
||||
foreach (TreeNode item in treeNodeCollection)
|
||||
{
|
||||
imageCollection.Add(this.getImageType(item.Text));
|
||||
item.ImageIndex = imageCollection.Count - 1;
|
||||
item.Text = item.Text.Substring(0, item.Text.LastIndexOf("."));
|
||||
if (item.Nodes.Count > 0)
|
||||
this.runThroughNodes(imageCollection, item.Nodes);
|
||||
|
||||
}
|
||||
}
|
||||
private Icon getImageType(string p)
|
||||
{
|
||||
switch (p.Substring(p.LastIndexOf(".")))
|
||||
{
|
||||
case ".folder": return Properties.Resources.Special_Folder;
|
||||
case ".file": return Properties.Resources.Special_File;
|
||||
}
|
||||
return Properties.Resources.Special_File;
|
||||
}
|
||||
class TreePart
|
||||
{
|
||||
public TreePart(String name, bool isFolder, List<TreePart> child)
|
||||
{
|
||||
this.name = name;
|
||||
this.child = child;
|
||||
this.isFolder = isFolder;
|
||||
}
|
||||
public string name { get; private set; }
|
||||
public List<TreePart> child { get; set; }
|
||||
public bool isFolder { get; set; }
|
||||
}
|
||||
private TreeNode[] createDirList(List<string> tree)
|
||||
{
|
||||
String root = this.c.GetArgumentData("-d");
|
||||
List<TreePart> ntree = new List<TreePart>();
|
||||
foreach (String node in tree)
|
||||
{
|
||||
String folder = node;
|
||||
folder = folder.Replace('\\', '/');
|
||||
folder = (folder.StartsWith("/")) ? folder.Substring(1) : folder;
|
||||
folder = (folder.EndsWith("/")) ? folder.Substring(0, folder.Length-1) : folder;
|
||||
bool isFolder = System.IO.Directory.Exists(root + "/" + folder);
|
||||
String[] folders = folder.Split('/');
|
||||
Array.Reverse(folders);
|
||||
List<TreePart> prev = null;
|
||||
foreach (String entry in folders)
|
||||
{
|
||||
String name = entry;
|
||||
if (prev == null)
|
||||
prev = new List<TreePart>() { new TreePart(name, isFolder, new List<TreePart>()) };
|
||||
else
|
||||
prev = new List<TreePart>() { new TreePart(name, isFolder, prev) };
|
||||
if (!isFolder)
|
||||
isFolder = true;
|
||||
}
|
||||
ntree = this.treeMatch(ntree, prev);
|
||||
}
|
||||
return this.createListDirRender(ntree);
|
||||
}
|
||||
|
||||
private TreeNode[] createListDirRender(List<TreePart> ntree)
|
||||
{
|
||||
TreeNode[] t = new TreeNode[ntree.Count];
|
||||
int i = 0;
|
||||
foreach (TreePart item in ntree)
|
||||
{
|
||||
String name = item.name + ((item.isFolder) ? ".folder" : (item.name.LastIndexOf('.') == -1) ? ".file" : item.name.Substring(item.name.LastIndexOf('.')));
|
||||
if(item.child.Count == 0)
|
||||
t[i++] = new TreeNode(name);
|
||||
else
|
||||
t[i++] = new TreeNode(name, this.createListDirRender(item.child));
|
||||
t[i - 1].Checked = true;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
private List<TreePart> treeMatch(List<TreePart> ntree, List<TreePart> input)
|
||||
{
|
||||
String[] key1 = this.array_keys(input);
|
||||
if (ntree.Count == 0 || (key1.Length > 0 && !array_key_exists(key1[0], ntree)) || key1.Length == 0)
|
||||
{
|
||||
ntree.Add(input[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
String[] key2 = array_keys(findName(key1[0], input));
|
||||
if (key2.Length != 0)
|
||||
{
|
||||
if (array_key_exists(key2[0], findName(key1[0], ntree)))
|
||||
{
|
||||
/*setChild(key2[0], findName(key1[0], ntree),*/
|
||||
this.treeMatch(findName(key1[0], ntree), findName(key1[0], input));
|
||||
}
|
||||
else
|
||||
{
|
||||
findName(key1[0], ntree).Add(findName(key1[0], input)[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ntree;
|
||||
}
|
||||
|
||||
private void setChild(string key, List<TreePart> input, List<TreePart> list)
|
||||
{
|
||||
foreach (TreePart item in input)
|
||||
{
|
||||
if (item.name == key)
|
||||
item.child = list;
|
||||
}
|
||||
}
|
||||
|
||||
private List<TreePart> findName(string key, List<TreePart> input)
|
||||
{
|
||||
foreach (TreePart item in input)
|
||||
{
|
||||
if (item.name == key)
|
||||
return item.child;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool array_key_exists(string p, List<TreePart> ntree)
|
||||
{
|
||||
foreach (TreePart item in ntree)
|
||||
{
|
||||
if (item.name == p)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private string[] array_keys(List<TreePart> input)
|
||||
{
|
||||
List<String> ret = new List<String>();
|
||||
foreach (TreePart item in input)
|
||||
{
|
||||
ret.Add(item.name);
|
||||
}
|
||||
return ret.ToArray();
|
||||
}
|
||||
|
||||
|
||||
private TreePart treeMatch(TreePart ntree, TreePart prev)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void CreateSVNOpen(string title, string message)
|
||||
{
|
||||
this.Controls.Clear();
|
||||
System.Windows.Forms.Label label = new System.Windows.Forms.Label();
|
||||
label.AutoSize = true;
|
||||
label.Location = new System.Drawing.Point(10, 10);
|
||||
label.Size = new System.Drawing.Size(350, 13);
|
||||
label.TabIndex = 0;
|
||||
label.Text = title;
|
||||
this.Controls.Add(label);
|
||||
|
||||
System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox();
|
||||
textBox.Location = new System.Drawing.Point(10, 30);
|
||||
textBox.Multiline = true;
|
||||
textBox.ReadOnly = true;
|
||||
textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
textBox.Size = new System.Drawing.Size(350, 120);
|
||||
textBox.TabIndex = 0;
|
||||
textBox.Text = message;
|
||||
this.Controls.Add(textBox);
|
||||
|
||||
System.Windows.Forms.Button openButton = new System.Windows.Forms.Button();
|
||||
openButton.Location = new System.Drawing.Point(10, 160);
|
||||
openButton.Size = new System.Drawing.Size(120, 23);
|
||||
openButton.TabIndex = 0;
|
||||
openButton.Text = "SVN Öffnen";
|
||||
openButton.UseVisualStyleBackColor = true;
|
||||
openButton.Click += new EventHandler(openButton_Click);
|
||||
this.Controls.Add(openButton);
|
||||
|
||||
System.Windows.Forms.Button runagainButton = new System.Windows.Forms.Button();
|
||||
runagainButton.Location = new System.Drawing.Point(140, 160);
|
||||
runagainButton.Size = new System.Drawing.Size(120, 23);
|
||||
runagainButton.TabIndex = 0;
|
||||
runagainButton.Text = "Wiederholen";
|
||||
runagainButton.UseVisualStyleBackColor = true;
|
||||
runagainButton.Click += new EventHandler(runagainButton_Click);
|
||||
this.Controls.Add(runagainButton);
|
||||
}
|
||||
|
||||
void runagainButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Controls.Clear();
|
||||
this.ShowInTaskbar = false;
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
this.Init();
|
||||
}
|
||||
|
||||
void openButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process p = new System.Diagnostics.Process();
|
||||
p.StartInfo.FileName = "cmd";
|
||||
p.StartInfo.WorkingDirectory = this.c.GetArgumentData("-d");
|
||||
p.Start();
|
||||
}
|
||||
|
||||
void deleteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Windows.Forms.TreeView t = null;
|
||||
foreach (var item in this.Controls)
|
||||
{
|
||||
if (item is System.Windows.Forms.TreeView)
|
||||
{
|
||||
t = (System.Windows.Forms.TreeView)item;
|
||||
}
|
||||
}
|
||||
if (t == null)
|
||||
return;
|
||||
List<TreeNode> l = this.getSelectedNodes(t.Nodes);
|
||||
this.Controls.Clear();
|
||||
this.ShowInTaskbar = false;
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
s.DeleteFiles(l);
|
||||
if (s.IsError())
|
||||
{
|
||||
this.HandleSvn(HandleSvnType.UnexpectedError, s.getError());
|
||||
return;
|
||||
}
|
||||
this.runagainButton_Click(sender, null);
|
||||
}
|
||||
|
||||
private List<TreeNode> getSelectedNodes(TreeNodeCollection treeNodeCollection)
|
||||
{
|
||||
List<TreeNode> l = new List<TreeNode>();
|
||||
foreach (TreeNode item in treeNodeCollection)
|
||||
{
|
||||
if (item.Checked && item.Nodes.Count == 0)
|
||||
l.Add(item);
|
||||
if (item.Nodes.Count > 0)
|
||||
l.AddRange(this.getSelectedNodes(item.Nodes));
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Windows.Forms.TreeView t = null;
|
||||
foreach (var item in this.Controls)
|
||||
{
|
||||
if (item is System.Windows.Forms.TreeView)
|
||||
{
|
||||
t = (System.Windows.Forms.TreeView)item;
|
||||
}
|
||||
}
|
||||
if (t == null)
|
||||
return;
|
||||
List<TreeNode> l = this.getSelectedNodes(t.Nodes);
|
||||
this.Controls.Clear();
|
||||
this.ShowInTaskbar = false;
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
s.AddFiles(l);
|
||||
if (s.IsError())
|
||||
{
|
||||
this.HandleSvn(HandleSvnType.UnexpectedError, s.getError());
|
||||
return;
|
||||
}
|
||||
this.runagainButton_Click(sender, null);
|
||||
}
|
||||
|
||||
private string GetTimeStamp(DateTime dateTime)
|
||||
{
|
||||
String ret = "";
|
||||
ret += dateTime.Year.ToString().PadLeft(4, '0');
|
||||
ret += dateTime.Month.ToString().PadLeft(2, '0');
|
||||
ret += dateTime.Day.ToString().PadLeft(2, '0');
|
||||
ret += "-";
|
||||
ret += dateTime.Hour.ToString().PadLeft(2, '0');
|
||||
ret += dateTime.Minute.ToString().PadLeft(2, '0');
|
||||
ret += dateTime.Second.ToString().PadLeft(2, '0');
|
||||
return ret;
|
||||
}
|
||||
private void StartSvn()
|
||||
{
|
||||
if (!this.c.HasArgumentType("-d"))
|
||||
{
|
||||
this.ShowToolTip("Svn Sync Fehler", "Kein Verzeichniss angegeben \"-d\" fehlt", ToolTipIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (this.c.GetArgumentData("-d") == null)
|
||||
{
|
||||
this.ShowToolTip("Svn Sync Fehler", "Kein Argument für \"-d\" angegeben", ToolTipIcon.Error);
|
||||
return;
|
||||
}
|
||||
this.s = new Svn(this.c.GetArgumentData("-d"));
|
||||
}
|
||||
|
||||
private void EventHandler_Resize(object sender, System.EventArgs e)
|
||||
{
|
||||
if (this.WindowState == FormWindowState.Minimized)
|
||||
{
|
||||
this.ShowInTaskbar = false;
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
this.ShowInTaskbar = true;
|
||||
foreach (var item in this.Controls)
|
||||
{
|
||||
if (item is System.Windows.Forms.TreeView)
|
||||
{
|
||||
System.Windows.Forms.TreeView t = (System.Windows.Forms.TreeView)item;
|
||||
t.ExpandAll();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowToolTip(string title, string text, ToolTipIcon toolTipIcon)
|
||||
{
|
||||
this.notifyIcon.ShowBalloonTip(15000, title, text, toolTipIcon);
|
||||
this.notifyIcon.BalloonTipClicked += new EventHandler(notifyIcon_BalloonTipClicked);
|
||||
//Add to Notify Quene
|
||||
}
|
||||
|
||||
private void notifyIcon_BalloonTipClicked(object sender, EventArgs e)
|
||||
{
|
||||
this.notifyIcon_MouseDoubleClick(sender, null);
|
||||
}
|
||||
}
|
||||
}
|
12696
svnsync/Form1.resx
Normal file
12696
svnsync/Form1.resx
Normal file
File diff suppressed because it is too large
Load Diff
33
svnsync/Program.cs
Normal file
33
svnsync/Program.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace svnsync
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Der Haupteinstiegspunkt für die Anwendung.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
try
|
||||
{
|
||||
Application.Run(new Form1(args));
|
||||
}
|
||||
catch (NotImplementedException e)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("In: " + e.Source + "\n\n" + e.Message, "Fehler!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
catch (Exception /*e*/)
|
||||
{
|
||||
//System.Windows.Forms.MessageBox.Show("In: " + e.Source + "\n\n" + e.Message, "Fehler!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
svnsync/Properties/AssemblyInfo.cs
Normal file
36
svnsync/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die mit einer Assembly verknüpft sind.
|
||||
[assembly: AssemblyTitle("svnsync")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("svnsync")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("60f4b48e-5616-45af-8dad-ffd3df1115a0")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
77
svnsync/Properties/Resources.Designer.cs
generated
Normal file
77
svnsync/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,77 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.269
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace svnsync.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// </summary>
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("svnsync.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Icon Special_File {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Special_File", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Icon Special_Folder {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Special_Folder", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
127
svnsync/Properties/Resources.resx
Normal file
127
svnsync/Properties/Resources.resx
Normal file
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Special_File" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\file\notag.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Special_Folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\file\dir.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
30
svnsync/Properties/Settings.Designer.cs
generated
Normal file
30
svnsync/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.269
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace svnsync.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
svnsync/Properties/Settings.settings
Normal file
7
svnsync/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
205
svnsync/Svn.cs
Normal file
205
svnsync/Svn.cs
Normal file
@ -0,0 +1,205 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace svnsync
|
||||
{
|
||||
class Svn
|
||||
{
|
||||
private string dir;
|
||||
private Process p = new Process();
|
||||
private List<String> modified;
|
||||
private List<String> noversion;
|
||||
private List<String> wasdeleted;
|
||||
private List<String> added;
|
||||
private string SvnError;
|
||||
private string SvnOutput;
|
||||
private List<string> isdeleted;
|
||||
|
||||
public Svn(string dir)
|
||||
{
|
||||
this.dir = dir;
|
||||
this.Init();
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
p.StartInfo.FileName = "svn";
|
||||
p.StartInfo.WorkingDirectory = this.dir;
|
||||
p.StartInfo.CreateNoWindow = true;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.StartInfo.RedirectStandardError = true;
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
}
|
||||
|
||||
internal void CheckStatus()
|
||||
{
|
||||
modified = new List<string>();
|
||||
noversion = new List<string>();
|
||||
wasdeleted = new List<string>();
|
||||
isdeleted = new List<string>();
|
||||
added = new List<string>();
|
||||
this.runner("st");
|
||||
string[] lines = this.SvnOutput.Split('\n');
|
||||
foreach (String line in lines)
|
||||
{
|
||||
if (line.Length < 7)
|
||||
break;
|
||||
Char[] handles = line.Substring(0, 7).ToCharArray();
|
||||
String file = line.Substring(8).Trim(new Char[] {'\r','\n',' ','\t'});
|
||||
if (handles[0] == ' ')
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
else if (handles[0] == 'A')
|
||||
{
|
||||
added.Add(file);
|
||||
}
|
||||
else if (handles[0] == 'D')
|
||||
{
|
||||
isdeleted.Add(file);
|
||||
}
|
||||
else if (handles[0] == 'M')
|
||||
{
|
||||
modified.Add(file);
|
||||
}
|
||||
else if (handles[0] == 'R')
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
else if (handles[0] == 'C')
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
else if (handles[0] == 'X')
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
else if (handles[0] == 'I')
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
else if (handles[0] == '?')
|
||||
{
|
||||
noversion.Add(file);
|
||||
}
|
||||
else if (handles[0] == '!')
|
||||
{
|
||||
wasdeleted.Add(file);
|
||||
}
|
||||
else if (handles[0] == '~')
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsNotOnlyModified()
|
||||
{
|
||||
if (this.noversion.Count != 0)
|
||||
return true;
|
||||
if (this.wasdeleted.Count != 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void SetArgCheckIn(string message)
|
||||
{
|
||||
String arg = "ci -m \"" + message + "\"";
|
||||
this.runner(arg);
|
||||
}
|
||||
|
||||
internal void AddFiles(List<String> files)
|
||||
{
|
||||
String arg = "add";
|
||||
foreach (String item in files)
|
||||
{
|
||||
arg += " \"" + item+"\"";
|
||||
}
|
||||
this.runner(arg);
|
||||
}
|
||||
|
||||
private void runner(string arg)
|
||||
{
|
||||
this.SvnOutput = "";
|
||||
this.SvnError = "";
|
||||
p.StartInfo.Arguments = arg;
|
||||
p.Start();
|
||||
this.SvnOutput = p.StandardOutput.ReadToEnd();
|
||||
this.SvnError = p.StandardError.ReadToEnd();
|
||||
p.WaitForExit();
|
||||
}
|
||||
|
||||
internal bool IsUncheckedFiles()
|
||||
{
|
||||
if (this.noversion.Count != 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal bool IsExternDeletedFiles()
|
||||
{
|
||||
if (this.wasdeleted.Count != 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal bool IsError()
|
||||
{
|
||||
if (this.SvnError != "")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal string getError()
|
||||
{
|
||||
return this.SvnError;
|
||||
}
|
||||
|
||||
internal void DeleteFiles(List<String> files)
|
||||
{
|
||||
String arg = "del";
|
||||
foreach (String item in files)
|
||||
{
|
||||
arg += " \"" + item + "\"";
|
||||
}
|
||||
this.runner(arg);
|
||||
}
|
||||
|
||||
internal List<String> getWasDeletedFiles()
|
||||
{
|
||||
return this.wasdeleted;
|
||||
}
|
||||
|
||||
internal List<String> getNoVersionFiles()
|
||||
{
|
||||
return this.noversion;
|
||||
}
|
||||
|
||||
internal void DeleteFiles(List<System.Windows.Forms.TreeNode> l)
|
||||
{
|
||||
List<String> s = new List<string>();
|
||||
foreach (System.Windows.Forms.TreeNode item in l)
|
||||
{
|
||||
s.Add(item.FullPath);
|
||||
}
|
||||
this.DeleteFiles(s);
|
||||
}
|
||||
|
||||
internal void AddFiles(List<System.Windows.Forms.TreeNode> l)
|
||||
{
|
||||
List<String> s = new List<string>();
|
||||
foreach (System.Windows.Forms.TreeNode item in l)
|
||||
{
|
||||
s.Add(item.FullPath);
|
||||
}
|
||||
this.AddFiles(s);
|
||||
}
|
||||
}
|
||||
}
|
BIN
svnsync/dir.ico
Normal file
BIN
svnsync/dir.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
svnsync/file/dir.ico
Normal file
BIN
svnsync/file/dir.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
svnsync/file/notag.ico
Normal file
BIN
svnsync/file/notag.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.9 KiB |
BIN
svnsync/icon.ico
Normal file
BIN
svnsync/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 368 KiB |
BIN
svnsync/icon.png
Normal file
BIN
svnsync/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
96
svnsync/svnsync.csproj
Normal file
96
svnsync/svnsync.csproj
Normal file
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>svnsync</RootNamespace>
|
||||
<AssemblyName>svnsync</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CmdArgs.cs" />
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Svn.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="file\dir.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="file\notag.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
8
svnsync/svnsync.csproj.user
Normal file
8
svnsync/svnsync.csproj.user
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<StartArguments>-d "D:\\Doc's\\Studium\\" -cron -autoadd -autodelete</StartArguments>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<StartAction>Project</StartAction>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user