private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
string[] args = Environment.GetCommandLineArgs();
FormSplash.ShowSplash();
Application.DoEvents();
Settings.LoadSettings();
if (Settings.RunningOnWindows())
{
//Quick HOME check:
FormSplash.SetAction("Checking home path...");
Application.DoEvents();
FormFixHome.CheckHomePath();
}
//Register plugins
FormSplash.SetAction("Loading plugins...");
Application.DoEvents();
if (string.IsNullOrEmpty(Settings.Translation))
{
using (var formChoose = new FormChooseTranslation())
{
formChoose.ShowDialog();
}
}
try
{
if (Application.UserAppDataRegistry == null ||
Settings.GetValue<string>("checksettings", null) == null ||
!Settings.GetValue<string>("checksettings", null).Equals("false", StringComparison.OrdinalIgnoreCase) ||
string.IsNullOrEmpty(Settings.GitCommand))
{
FormSplash.SetAction("Checking settings...");
Application.DoEvents();
GitUICommands uiCommands = new GitUICommands(string.Empty);
using (var settings = new FormSettings(uiCommands))
{
if (!settings.CheckSettings())
{
settings.AutoSolveAllSettings();
uiCommands.StartSettingsDialog();
}
}
}
}
catch
{
// TODO: remove catch-all
}
FormSplash.HideSplash();
if (Settings.RunningOnWindows())
MouseWheelRedirector.Active = true;
GitUICommands uCommands = new GitUICommands(GetWorkingDir(args));
if (args.Length <= 1)
{
uCommands.StartBrowseDialog();
}
else // if we are here args.Length > 1
{
uCommands.RunCommand(args);
}
Settings.SaveSettings();
}