mal weiter gemacht

This commit is contained in:
BlubbFish 2015-11-12 22:18:18 +00:00
parent 568047799b
commit 33e5675b9e
22 changed files with 927 additions and 36 deletions

View File

@ -1,18 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "svnsync", "svnsync\svnsync.csproj", "{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Debug|Any CPU.ActiveCfg = Debug|x86
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Debug|Mixed Platforms.Build.0 = Debug|x86
{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|Any CPU.ActiveCfg = Release|x86
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Release|Mixed Platforms.ActiveCfg = Release|x86
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Release|Mixed Platforms.Build.0 = Release|x86
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Release|x86.ActiveCfg = Release|x86
{447D3E59-FD95-47EA-AB2F-AA241EFD6E0C}.Release|x86.Build.0 = Release|x86
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|x86.ActiveCfg = Debug|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BlubbFish.Utils;
using svnsync.Views;
using svnsync.Helpers;
namespace svnsync.Controllers
{
class ControllersTray : OwnController
{
private static ViewsTray viewTray;
private static ControllersWindow controllerWindow;
private string args;
/// <summary>
/// Controlls a Tray.
/// </summary>
public ControllersTray() {}
protected override void init() {
viewTray = new ViewsTray();
controllerWindow = new ControllersWindow();
controllerWindow.setAction(Handles.FormType.Normal);
if(viewTray.Model.Args.HasArgumentType("-cron")) {
if(this.cronJob(0, false)) {
viewTray.ShowSuccess();
System.Threading.Thread.Sleep(5000);
viewTray.Dispose();
return;
}
} else {
controllerWindow.execute();
}
}
private bool cronJob(int run, bool readyToCommit) {
if(viewTray.Model.Svn == null) {
return HandleError(Handles.SvnType.NotInit, "");
}
if(run > 10) {
return HandleError(Handles.SvnType.ToMutchChronRuns, "");
}
if(viewTray.Model.Svn.IsError()) {
return HandleError(Handles.SvnType.UnexpectedError, viewTray.Model.Svn.getError());
}
try {
viewTray.Model.Svn.CheckStatus();
} catch(NotImplementedException e) {
return HandleError(Handles.SvnType.UnexpectedError, e.Message);
} catch(Helpers.SvnLockedException e) {
return HandleError(Handles.SvnType.LockedFile, e.Message);
}
if(viewTray.Model.Svn.IsNotOnlyModified()) {
if(viewTray.Model.Svn.IsUncheckedFiles()) {
if(viewTray.Model.Args.HasArgumentType("-autoadd")) {
viewTray.Model.Svn.AddFiles(viewTray.Model.Svn.getNoVersionFiles());
if(viewTray.Model.Svn.IsError()) {
return HandleError(Handles.SvnType.UnexpectedError, viewTray.Model.Svn.getError());
}
} else {
return HandleError(Handles.SvnType.HasVersionitedFiles, "");
}
}
if(viewTray.Model.Svn.IsExternDeletedFiles()) {
if(viewTray.Model.Args.HasArgumentType("-autodelete")) {
viewTray.Model.Svn.DeleteFiles(viewTray.Model.Svn.getWasDeletedFiles());
if(viewTray.Model.Svn.IsError()) {
return HandleError(Handles.SvnType.UnexpectedError, viewTray.Model.Svn.getError());
}
} else {
return HandleError(Handles.SvnType.ExternDeletedFiles, "");
}
}
return this.cronJob(run + 1, true);
} else {
if(readyToCommit) {
viewTray.Model.Svn.SetArgCheckIn("Automatic Cronjob Checkin: " + StringHelper.GetTimeStamp(DateTime.Now));
if(viewTray.Model.Svn.IsError()) {
return HandleError(Handles.SvnType.UnexpectedError, viewTray.Model.Svn.getError());
}
} else {
viewTray.Model.Svn.Update();
if(viewTray.Model.Svn.IsError()) {
return HandleError(Handles.SvnType.UnexpectedError, viewTray.Model.Svn.getError());
}
return this.cronJob(run + 1, true);
}
}
return true;
}
private bool HandleError(Handles.SvnType svnType, string p) {
viewTray.ShowError(svnType, p);
switch(svnType) {
case Handles.SvnType.ToMutchChronRuns:
controllerWindow.setAction(Handles.FormType.MuchCronJobs);
break;
case Handles.SvnType.HasVersionitedFiles:
controllerWindow.setAction(Handles.FormType.UnversionFiles);
break;
case Handles.SvnType.UnexpectedError:
controllerWindow.setAction(Handles.FormType.Error);
controllerWindow.setMessage(p);
break;
case Handles.SvnType.ExternDeletedFiles:
controllerWindow.setAction(Handles.FormType.DeletedFiles);
break;
case Handles.SvnType.LockedFile:
controllerWindow.setAction(Handles.FormType.ManualResolve);
controllerWindow.setMessage(p);
break;
}
return false;
}
/// <summary>
/// If you Click on the Tray Icon
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static void Click_Tray(object sender, EventArgs e)
{
controllerWindow.execute();
}
/// <summary>
/// If you Click on the Tray Ballon
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public static void Click_Ballon(object sender, EventArgs e)
{
controllerWindow.execute();
}
internal void hideToolTip() {
viewTray.HideToolTip();
}
internal static void Click_Quit(object sender, EventArgs e) {
viewTray.Dispose();
System.Windows.Forms.Application.Exit();
}
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BlubbFish.Utils;
using svnsync.Views;
using svnsync.Helpers;
namespace svnsync.Controllers {
public class ControllersWindow : OwnController {
private static ViewsWindow viewWindow;
private Handles.FormType initAction;
private string initMessage;
/// <summary>
/// Tray Controller
/// </summary>
public ControllersWindow() { }
override protected void init() {
viewWindow = new ViewsWindow();
viewWindow.Model.Message = initMessage;
viewWindow.Model.FormType = initAction;
}
public static void FormClosed(object sender, FormClosedEventArgs e) {
viewWindow.Dispose();
}
internal void setAction(Handles.FormType formType) {
if(viewWindow == null) {
this.initAction = formType;
} else {
viewWindow.Model.FormType = formType;
}
//throw new NotImplementedException();
//this.CreateSVNOpen("Fehler im Cronjob, mehr als 10 Aufrufe!", "");
//this.CreateFileList("Hinzufügen", "Diese Daten sind unversioniert:", s.getNoVersionFiles(), new EventHandler(addButton_Click));
//this.CreateSVNOpen("Es ist ein Unvorhersebarer Fehler aufgetreten", p);
//this.CreateFileList("Löschen", "Diese Daten sind gelöscht worden:", s.getWasDeletedFiles(), new EventHandler(deleteButton_Click));
}
internal void setMessage(string p) {
if(viewWindow == null) {
this.initMessage = p;
} else {
viewWindow.Model.Message = p;
}
}
}
}

View File

@ -6,6 +6,8 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BlubbFish.Utils;
using svnsync.Libraries;
namespace svnsync
{
@ -31,7 +33,14 @@ namespace svnsync
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);
*/
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.getInstance();
this.c.setArguments(pargs, args);
this.StartSvn();
if (this.s != null)
{
@ -485,7 +494,8 @@ namespace svnsync
this.ShowToolTip("Svn Sync Fehler", "Kein Argument für \"-d\" angegeben", ToolTipIcon.Error);
return;
}
this.s = new Svn(this.c.GetArgumentData("-d"));
this.s = Svn.getInstance();
this.s.setDirectory(this.c.GetArgumentData("-d"));
}
private void EventHandler_Resize(object sender, System.EventArgs e)

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace svnsync.Helpers {
class Handles {
public enum SvnType {
NotInit,
ToMutchChronRuns,
HasVersionitedFiles,
UnexpectedError,
ExternDeletedFiles,
LockedFile,
}
public enum FormType {
MuchCronJobs,
UnversionFiles,
Error,
DeletedFiles,
Normal,
ManualResolve,
}
}
[Serializable()]
public class SvnLockedException : System.Exception {
public SvnLockedException() : base() { }
public SvnLockedException(string message) : base(message) { }
public SvnLockedException(string message, System.Exception inner) : base(message, inner) { }
protected SvnLockedException(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) { }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace svnsync.Helpers
{
class StringHelper
{
public static 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;
}
}
}

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Diagnostics;
namespace svnsync
namespace svnsync.Libraries
{
class Svn
{
@ -17,8 +17,12 @@ namespace svnsync
private string SvnError = "";
private string SvnOutput = "";
private List<string> isdeleted;
private List<string> external;
private static Svn instances;
public Svn(string dir)
private Svn() { }
public void setDirectory(string dir)
{
this.dir = dir;
this.Init();
@ -41,6 +45,7 @@ namespace svnsync
wasdeleted = new List<string>();
isdeleted = new List<string>();
added = new List<string>();
external = new List<string>();
this.runner("st");
string[] lines = this.SvnOutput.Split('\n');
foreach (String line in lines)
@ -51,7 +56,11 @@ namespace svnsync
String file = line.Substring(8).Trim(new Char[] {'\r','\n',' ','\t'});
if (handles[0] == ' ')
{
throw new NotImplementedException("SVN Line ' '");
if(handles[2] == 'L') {
throw new svnsync.Helpers.SvnLockedException("Datei: " + file + " ist gelockt!");
} else {
throw new NotImplementedException("NOT IMPLEMENTED in SvnClass: SVN Line[0] ' '");
}
}
else if (handles[0] == 'A')
{
@ -67,19 +76,19 @@ namespace svnsync
}
else if (handles[0] == 'R')
{
throw new NotImplementedException("SVN Line 'R'");
throw new NotImplementedException("NOT IMPLEMENTED in SvnClass: SVN Line[0] 'R'");
}
else if (handles[0] == 'C')
{
throw new NotImplementedException("SVN Line 'C'");
throw new NotImplementedException("NOT IMPLEMENTED in SvnClass: SVN Line[0] 'C'");
}
else if (handles[0] == 'X')
{
throw new NotImplementedException("SVN Line 'X'");
external.Add(file);
}
else if (handles[0] == 'I')
{
throw new NotImplementedException("SVN Line 'I'");
throw new NotImplementedException("NOT IMPLEMENTED in SvnClass: SVN Line[0] 'I'");
}
else if (handles[0] == '?')
{
@ -91,11 +100,11 @@ namespace svnsync
}
else if (handles[0] == '~')
{
throw new NotImplementedException("SVN Line '~'");
throw new NotImplementedException("NOT IMPLEMENTED in SvnClass: SVN Line[0] '~'");
}
else
{
throw new NotImplementedException("Unexpected Symbol!");
throw new NotImplementedException("NOT IMPLEMENTED in SvnClass: Unexpected Symbol! [0]: \"" + handles[0] + "\"");
}
}
}
@ -206,5 +215,14 @@ namespace svnsync
{
this.runner("up");
}
public static Svn getInstance()
{
if (instances == null)
{
instances = new Svn();
}
return instances;
}
}
}

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BlubbFish.Utils;
using svnsync.Libraries;
namespace svnsync.Models
{
class ModelsTray : OwnModel<ModelsTray>
{
private ModelsTray()
{
this.init();
}
protected override void init()
{
this.Args = CmdArgs.getInstance();
this.Svn = Svn.getInstance();
}
/// <summary>
/// Saves the Argument of the Program
/// </summary>
public CmdArgs Args { get; private set; }
/// <summary>
/// Save a SVN
/// </summary>
public Svn Svn { get; private set; }
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BlubbFish.Utils;
using svnsync.Helpers;
namespace svnsync.Models {
public class ModelsWindow : OwnModel<ModelsWindow> {
private InIReader networkfile;
private ModelsWindow() {
this.init();
}
protected override void init() {
}
private string MessageValue = "";
public string Message {
get { return MessageValue; }
set { MessageValue = value; this.update(); }
}
private Handles.FormType FormTypeValue;
internal Handles.FormType FormType {
get { return FormTypeValue; }
set { FormTypeValue = value; this.update(); }
}
}
}

View File

@ -2,6 +2,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using svnsync.Controllers;
using BlubbFish.Utils;
using svnsync.Libraries;
namespace svnsync
{
@ -13,6 +16,29 @@ namespace svnsync
[STAThread]
static void Main(string[] args)
{
if (!cmd(args))
{
return;
}
ControllersTray t = null;
try
{
Svn.getInstance().setDirectory(CmdArgs.getInstance().GetArgumentData("-d"));
t = new ControllersTray();
t.execute();
}
catch (Exception e)
{
t.hideToolTip();
string text = e.Message+"\n\n"+e.StackTrace;
string title = "Exception in SVNSync: " + CmdArgs.getInstance().GetArgumentData("-d");
System.Windows.Forms.MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
Application.Run();
return;
/*Application.Run();*/
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try
@ -29,5 +55,21 @@ namespace svnsync
Application.Exit();
}
}
private static bool cmd(string[] args)
{
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));
CmdArgs.getInstance().setArguments(pargs, args);
if (!CmdArgs.getInstance().HasAllRequiredArguments())
{
System.Windows.Forms.MessageBox.Show(CmdArgs.getInstance().getUsageList("syncsvn.exe:"), "Fehlende Argumente auf der Komandozeile", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false;
}
return true;
}
}
}

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.17929
// Laufzeitversion:4.0.30319.34209
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
@ -60,6 +60,16 @@ namespace svnsync.Properties {
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap door_open {
get {
object obj = ResourceManager.GetObject("door_open", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Icon ähnlich wie (Symbol).
/// </summary>

View File

@ -118,6 +118,9 @@
<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="door_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\door_open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\file\Icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

View File

@ -1,28 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.269
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace svnsync.Properties
{
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
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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
{
public static Settings Default {
get {
return defaultInstance;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

126
svnsync/Views/ViewsTray.cs Normal file
View File

@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BlubbFish.Utils;
using svnsync.Models;
using svnsync.Controllers;
using System.Windows.Forms;
using System.Drawing;
using svnsync.Properties;
using svnsync.Helpers;
namespace svnsync.Views
{
class ViewsTray : OwnView
{
/// <summary>
/// Model of the View
/// </summary>
public ModelsTray Model { get; private set; }
private NotifyIcon trayicon;
/// <summary>
/// View of a Tray
/// </summary>
public ViewsTray()
{
this.init();
this.Model = ModelsTray.Instance;
this.Model.setObserver(this);
}
/// <summary>
/// Updates the Tray
/// </summary>
public override void update()
{
this.trayicon.Text = "SvnSync: " + this.Model.Args.GetArgumentData("-d");
}
protected override void init()
{
this.trayicon = new NotifyIcon();
this.trayicon.Visible = true;
this.trayicon.Icon = new Icon(Resources.Icon, 40, 40);
this.trayicon.Text = "SVN Sync Tool";
this.trayicon.DoubleClick += ControllersTray.Click_Tray;
this.trayicon.BalloonTipClicked += ControllersTray.Click_Ballon;
this.trayicon.ContextMenuStrip = this.genMenu();
}
private ContextMenuStrip genMenu() {
ContextMenuStrip menu = new ContextMenuStrip();
ToolStripMenuItem m1 = new ToolStripMenuItem("Öffnen");
m1.Image = Resources.door_open;
m1.Click += ControllersTray.Click_Tray;
m1.Name = "Open";
menu.Items.Add(m1);
ToolStripMenuItem m2 = new ToolStripMenuItem("Beenden");
m2.Image = Resources.door_open;
m2.Click += ControllersTray.Click_Quit;
m2.Name = "Quit";
menu.Items.Add(m2);
return menu;
}
/// <summary>
/// Delete the Tray
/// </summary>
public override void Dispose()
{
this.trayicon.Visible = false;
Application.ExitThread();
}
/// <summary>
/// Show a Success Message
/// </summary>
public void ShowSuccess()
{
this.showBallonTooltip("Datensicherung Erfolgreich\n" + this.Model.Args.GetArgumentData("-d").Replace("\\\\", "\\"), ToolTipIcon.Info);
}
private void showBallonTooltip(string text, ToolTipIcon toolTipIcon, string title = "SvnSync")
{
this.trayicon.BalloonTipIcon = toolTipIcon;
this.trayicon.BalloonTipText = text;
this.trayicon.BalloonTipTitle = title;
this.trayicon.ShowBalloonTip(100);
}
/// <summary>
/// Show a Error Message.
/// </summary>
/// <param name="svnType"></param>
/// <param name="p"></param>
public void ShowError(Handles.SvnType svnType, string p) {
switch(svnType) {
case Handles.SvnType.NotInit:
this.showBallonTooltip("Svn wurde noch nicht inizialisiert", ToolTipIcon.Error, "Svn Sync Fehler");
break;
case Handles.SvnType.ToMutchChronRuns:
this.showBallonTooltip("Fehler im Cronjob, mehr als 10 Aufrufe!", ToolTipIcon.Error, "Svn Sync Fehler");
break;
case Handles.SvnType.HasVersionitedFiles:
this.showBallonTooltip("Es sind unversionierte Dateien vorhanden (?)", ToolTipIcon.Info, "Svn Sync Fehler");
break;
case Handles.SvnType.UnexpectedError:
this.showBallonTooltip("Es ist ein Unvorhersebarer Fehler aufgetreten: " + p, ToolTipIcon.Error, "Svn Sync Fehler");
break;
case Handles.SvnType.ExternDeletedFiles:
this.showBallonTooltip("Es sind extern gelöschte Dateien vorhanden (!)", ToolTipIcon.Info, "Svn Sync Fehler");
break;
case Handles.SvnType.LockedFile:
this.showBallonTooltip("Es sind blokierte Dateien vorhanden (L)", ToolTipIcon.Info, "Svn Sync Fehler");
break;
}
}
internal void HideToolTip() {
this.trayicon.Visible = false;
}
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
using BlubbFish.Utils;
using svnsync.Models;
namespace svnsync.Views {
public class ViewsWindow : OwnView {
private ViewsWindowForm form;
public ViewsWindow() {
this.form = new ViewsWindowForm();
this.init();
this.Model.setObserver(this);
}
public override void update() {
this.form.UpdateForm();
}
protected override void init() {
this.Model = ModelsWindow.Instance;
this.form.SetModel(this.Model);
this.form.Show();
}
public override void Dispose() {
this.form.BeginInvoke((Action)(() => {
this.form.Dispose();
}));
}
public ModelsWindow Model { get; private set; }
}
}

View File

@ -0,0 +1,72 @@
namespace svnsync.Views
{
partial class ViewsWindowForm
{
/// <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.label1 = new System.Windows.Forms.Label();
this.messageBox = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Meldung:";
//
// messageBox
//
this.messageBox.Location = new System.Drawing.Point(15, 26);
this.messageBox.Name = "messageBox";
this.messageBox.ReadOnly = true;
this.messageBox.Size = new System.Drawing.Size(437, 96);
this.messageBox.TabIndex = 2;
this.messageBox.Text = "";
//
// ViewsWindowForm
//
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.messageBox);
this.Controls.Add(this.label1);
this.Name = "ViewsWindowForm";
this.Text = "ViewsWindowsForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.RichTextBox messageBox;
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using svnsync.Models;
using svnsync.Controllers;
namespace svnsync.Views {
public partial class ViewsWindowForm : Form {
private ModelsWindow model;
public ViewsWindowForm() {
InitializeComponent();
this.FormClosed += ControllersWindow.FormClosed;
}
public void UpdateForm() {
this.BeginInvoke((Action)(() => {
this.messageBox.Text = this.model.Message;
}));
}
public void SetModel(ModelsWindow window) {
this.model = window;
}
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>

Binary file not shown.

View File

@ -10,9 +10,25 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>svnsync</RootNamespace>
<AssemblyName>SvnSync</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>veröffentlichen\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
@ -23,6 +39,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -32,6 +49,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>file\Icon.ico</ApplicationIcon>
@ -50,16 +68,29 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CmdArgs.cs" />
<Compile Include="Controllers\ControllersTray.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\StringHelper.cs" />
<Compile Include="Models\ModelsTray.cs" />
<Compile Include="Models\ModelsWindow.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Svn.cs" />
<Compile Include="Libraries\Svn.cs" />
<Compile Include="Views\ViewsTray.cs" />
<Compile Include="Views\ViewsWindow.cs" />
<Compile Include="Views\ViewsWindowForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Views\ViewsWindowForm.Designer.cs">
<DependentUpon>ViewsWindowForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
@ -73,6 +104,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="Views\ViewsWindowForm.resx">
<DependentUpon>ViewsWindowForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -92,6 +126,37 @@
<ItemGroup>
<None Include="file\Icon.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj">
<Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project>
<Name>Utils</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Resources\door_open.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 und x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
<Visible>False</Visible>
<ProductName>Windows Installer 4.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</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.

View File

@ -6,6 +6,16 @@
<StartAction>Project</StartAction>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<StartArguments>-d "D:\\Doc%27s\\Basteleien\\" -cron -autoadd -autodelete1</StartArguments>
<StartArguments>-d "D:\\Doc%27s\\Studium\\" -cron -autoadd -autodelete</StartArguments>
</PropertyGroup>
<PropertyGroup>
<PublishUrlHistory>veröffentlichen\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>de-DE</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>