76 lines
2.9 KiB
C#
76 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using svnsync.Controllers;
|
|
using BlubbFish.Utils;
|
|
using svnsync.Libraries;
|
|
|
|
namespace svnsync
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// Der Haupteinstiegspunkt für die Anwendung.
|
|
/// </summary>
|
|
[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
|
|
{
|
|
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();
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|