[NF] Errorlog now implemented #8

This commit is contained in:
BlubbFish 2017-04-17 00:00:38 +00:00
parent 518422ecb5
commit 5ae70f6ec3
10 changed files with 201 additions and 633 deletions

View File

@ -190,6 +190,7 @@ namespace svnsync.Controllers
controllerWindow.Dispose(); controllerWindow.Dispose();
System.Windows.Forms.Application.DoEvents(); System.Windows.Forms.Application.DoEvents();
InitControllerWindow(); InitControllerWindow();
viewTray.Model.Svn.ClearError();
Runner(); Runner();
} }

View File

@ -1,63 +0,0 @@
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 = Properties.Resources.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 = Properties.Resources.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;
}
}

View File

@ -1,537 +0,0 @@
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;
using BlubbFish.Utils;
using svnsync.Libraries;
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));
*/
Dictionary<string, CmdArgs.VaildArguments> pargs = new Dictionary<string, CmdArgs.VaildArguments>();
pargs.Add("-d", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Touple, true));
pargs.Add("-cron", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Single));
pargs.Add("-autoadd", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Single));
pargs.Add("-autodelete", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Single));
this.c = CmdArgs.Instance;
this.c.SetArguments(pargs, args);
this.StartSvn();
if (this.s != null)
{
this.notifyIcon.Text = "SvnSync: " + this.c.GetArgumentData("-d");
}
this.Init();
}
private void Init()
{
if (this.c.HasArgumentType("-cron"))
if (this.cronJob(0, false))
{
this.ShowToolTip("Svn Sync", "Datensicherung Erfolgreich\n" + this.c.GetArgumentData("-d").Replace("\\\\","\\"), ToolTipIcon.Info);
System.Threading.Thread.Sleep(5000);
this.Close();
//Application.Exit();
}
}
private bool cronJob(int run, bool readyToCommit)
{
if (s == null)
return this.HandleSvn(HandleSvnType.NotInit, "");
if (run > 10)
return this.HandleSvn(HandleSvnType.ToMutchChronRuns, "");
if (s.IsError)
return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error);
try
{
s.CheckStatus();
}
catch (NotImplementedException e)
{
return this.HandleSvn(HandleSvnType.UnexpectedError, e.Message);
}
if (s.IsNotOnlyModified)
{
if (s.IsUncheckedFiles)
{
if (c.HasArgumentType("-autoadd"))
s.AddFiles(s.NoVersionFiles);
else
return this.HandleSvn(HandleSvnType.HasVersionitedFiles, "");
}
if (s.IsError)
return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error);
if (s.IsExternDeletedFiles)
{
if (c.HasArgumentType("-autodelete"))
s.DeleteFiles(s.WasDeletedFiles);
else
return this.HandleSvn(HandleSvnType.ExternDeletedFiles, "");
}
if (s.IsError)
return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error);
return this.cronJob(run + 1, true);
}
else
{
if (readyToCommit)
{
s.SetArgCheckIn(this.GetTimeStamp(DateTime.Now));
if (s.IsError)
return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error);
}
else
{
s.Update();
if (s.IsError)
return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error);
return this.cronJob(run + 1, true);
}
}
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.NoVersionFiles, 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.WasDeletedFiles, 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.Error);
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.Error);
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 = Svn.Instance;
this.s.SetDirectory(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);
}
}
}

View File

@ -89,7 +89,7 @@ namespace svnsync.Libraries {
private void Runner(String arg) { private void Runner(String arg) {
this.SvnOutput = ""; this.SvnOutput = "";
this.SvnError = ""; this.ClearError();
this.p.StartInfo.Arguments = arg + " --non-interactive"; this.p.StartInfo.Arguments = arg + " --non-interactive";
this.p.Start(); this.p.Start();
this.p.WaitForExit(); this.p.WaitForExit();
@ -198,5 +198,9 @@ namespace svnsync.Libraries {
return this.SvnError; return this.SvnError;
} }
} }
internal void ClearError() {
this.SvnError = "";
}
} }
} }

View File

@ -33,6 +33,6 @@ using System.Resources;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.2")] [assembly: AssemblyVersion("1.0.6.0")]
[assembly: AssemblyFileVersion("1.0.5.2")] [assembly: AssemblyFileVersion("1.0.6.0")]
[assembly: NeutralResourcesLanguageAttribute("de-DE")] [assembly: NeutralResourcesLanguageAttribute("de-DE")]

View File

@ -17,38 +17,30 @@ namespace svnsync.Views
public override void Update() public override void Update()
{ {
Boolean change = false;
switch(this.Model.FormType) { switch(this.Model.FormType) {
default: default:
case Helpers.Handles.FormType.Normal: case Helpers.Handles.FormType.Normal:
if(!(this.form is ViewsWindowForm)) { if(!(this.form is ViewsWindowForm)) {
change = true; this.SwitchContext(new ViewsWindowForm());
}
break;
case Helpers.Handles.FormType.Error:
if(!(this.form is ViewsWindowFormError)) {
this.SwitchContext(new ViewsWindowFormError());
} }
break; break;
case Helpers.Handles.FormType.UnversionFiles: case Helpers.Handles.FormType.UnversionFiles:
case Helpers.Handles.FormType.DeletedFiles: case Helpers.Handles.FormType.DeletedFiles:
if(!(this.form is ViewsWindowFormFileList)) { if(!(this.form is ViewsWindowFormFileList)) {
change = true; this.SwitchContext(new ViewsWindowFormFileList());
} }
break; break;
} }
if(change) {
this.SwitchContext();
}
this.form.UpdateForm(); this.form.UpdateForm();
} }
private void SwitchContext() { private void SwitchContext(ViewsWindowFormInterface newform) {
switch(this.Model.FormType) { this.form = newform;
default:
case Helpers.Handles.FormType.Normal:
this.form = new ViewsWindowForm();
break;
case Helpers.Handles.FormType.UnversionFiles:
case Helpers.Handles.FormType.DeletedFiles:
this.form = new ViewsWindowFormFileList();
break;
}
this.form.SetModel(this.Model); this.form.SetModel(this.Model);
this.form.Show(); this.form.Show();
} }

View File

@ -0,0 +1,115 @@
namespace svnsync.Views {
partial class ViewsWindowFormError {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.svnOpenButton = new System.Windows.Forms.Button();
this.doAgainButton = new System.Windows.Forms.Button();
this.errorgrid = new System.Windows.Forms.DataGridView();
this.ecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.etype = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.etext = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.errorgrid)).BeginInit();
this.SuspendLayout();
//
// svnOpenButton
//
this.svnOpenButton.Location = new System.Drawing.Point(312, 227);
this.svnOpenButton.Name = "svnOpenButton";
this.svnOpenButton.Size = new System.Drawing.Size(140, 23);
this.svnOpenButton.TabIndex = 6;
this.svnOpenButton.Text = "SVN Öffnen";
this.svnOpenButton.UseVisualStyleBackColor = true;
//
// doAgainButton
//
this.doAgainButton.Location = new System.Drawing.Point(164, 227);
this.doAgainButton.Name = "doAgainButton";
this.doAgainButton.Size = new System.Drawing.Size(140, 23);
this.doAgainButton.TabIndex = 5;
this.doAgainButton.Text = "Wiederholen";
this.doAgainButton.UseVisualStyleBackColor = true;
//
// errorgrid
//
this.errorgrid.AllowUserToAddRows = false;
this.errorgrid.AllowUserToDeleteRows = false;
this.errorgrid.AllowUserToOrderColumns = true;
this.errorgrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.errorgrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ecode,
this.etype,
this.etext});
this.errorgrid.Location = new System.Drawing.Point(12, 12);
this.errorgrid.Name = "errorgrid";
this.errorgrid.ReadOnly = true;
this.errorgrid.ShowEditingIcon = false;
this.errorgrid.Size = new System.Drawing.Size(440, 209);
this.errorgrid.TabIndex = 7;
//
// ecode
//
this.ecode.HeaderText = "Fehlercode";
this.ecode.Name = "ecode";
this.ecode.ReadOnly = true;
this.ecode.Width = 70;
//
// etype
//
this.etype.HeaderText = "Fehlertyp";
this.etype.Name = "etype";
this.etype.ReadOnly = true;
this.etype.Width = 70;
//
// etext
//
this.etext.HeaderText = "Fehlertext";
this.etext.Name = "etext";
this.etext.ReadOnly = true;
this.etext.Width = 257;
//
// ViewsWindowFormError
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(464, 262);
this.Controls.Add(this.errorgrid);
this.Controls.Add(this.svnOpenButton);
this.Controls.Add(this.doAgainButton);
this.Name = "ViewsWindowFormError";
this.Text = "ViewsWindowFormError";
((System.ComponentModel.ISupportInitialize)(this.errorgrid)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button svnOpenButton;
private System.Windows.Forms.Button doAgainButton;
private System.Windows.Forms.DataGridView errorgrid;
private System.Windows.Forms.DataGridViewTextBoxColumn ecode;
private System.Windows.Forms.DataGridViewTextBoxColumn etype;
private System.Windows.Forms.DataGridViewTextBoxColumn etext;
}
}

View File

@ -0,0 +1,51 @@
using svnsync.Controllers;
using svnsync.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace svnsync.Views {
public partial class ViewsWindowFormError : Form, ViewsWindowFormInterface {
private ModelsWindow model;
public ViewsWindowFormError() {
InitializeComponent();
this.FormClosed += ControllersWindow.FormClosed;
this.doAgainButton.Click += new EventHandler(ControllersTray.RunAgainButton_Click);
this.svnOpenButton.Click += new EventHandler(ControllersTray.SvnOpenButton_Click);
}
public void UpdateForm() {
this.BeginInvoke((Action)(() => {
String[] messages = this.model.Message.Split('\n');
foreach(String message in messages) {
if(message == "") {
continue;
}
Match r = new Regex("svn:.*(([WE])[0-9]*): (.*)",RegexOptions.IgnoreCase).Match(message);
if(r.Success) {
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});
}
}
}));
}
public void SetModel(ModelsWindow window) {
this.model = window;
}
new public void Dispose() {
this.BeginInvoke((Action)(() => {
this.Visible = false;
this.ShowInTaskbar = false;
}));
base.Dispose(true);
}
}
}

View File

@ -117,8 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <metadata name="ecode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<data name="notifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing"> <value>True</value>
<value>17, 17</value> </metadata>
</data> <metadata name="etype.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="etext.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>

View File

@ -70,12 +70,6 @@
<ItemGroup> <ItemGroup>
<Compile Include="Controllers\ControllersTray.cs" /> <Compile Include="Controllers\ControllersTray.cs" />
<Compile Include="Controllers\ControllersWindow.cs" /> <Compile Include="Controllers\ControllersWindow.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Helpers\Handles.cs" /> <Compile Include="Helpers\Handles.cs" />
<Compile Include="Helpers\StringHelper.cs" /> <Compile Include="Helpers\StringHelper.cs" />
<Compile Include="Helpers\TreeBuilder.cs" /> <Compile Include="Helpers\TreeBuilder.cs" />
@ -92,6 +86,12 @@
<Compile Include="Views\ViewsWindowForm.Designer.cs"> <Compile Include="Views\ViewsWindowForm.Designer.cs">
<DependentUpon>ViewsWindowForm.cs</DependentUpon> <DependentUpon>ViewsWindowForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\ViewsWindowFormError.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Views\ViewsWindowFormError.Designer.cs">
<DependentUpon>ViewsWindowFormError.cs</DependentUpon>
</Compile>
<Compile Include="Views\ViewsWindowFormFileList.cs"> <Compile Include="Views\ViewsWindowFormFileList.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -99,9 +99,6 @@
<DependentUpon>ViewsWindowFormFileList.cs</DependentUpon> <DependentUpon>ViewsWindowFormFileList.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\ViewsWindowFormInterface.cs" /> <Compile Include="Views\ViewsWindowFormInterface.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -115,6 +112,9 @@
<EmbeddedResource Include="Views\ViewsWindowForm.resx"> <EmbeddedResource Include="Views\ViewsWindowForm.resx">
<DependentUpon>ViewsWindowForm.cs</DependentUpon> <DependentUpon>ViewsWindowForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Views\ViewsWindowFormError.resx">
<DependentUpon>ViewsWindowFormError.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Views\ViewsWindowFormFileList.resx"> <EmbeddedResource Include="Views\ViewsWindowFormFileList.resx">
<DependentUpon>ViewsWindowFormFileList.cs</DependentUpon> <DependentUpon>ViewsWindowFormFileList.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>