private static void CheckSettingsWhenNecessary() { if (!ShouldCheckSettings) return; FormSplash.SetAction("Check settings"); using (var settings = new FormSettings()) { if (settings.CheckSettings()) return; FormSettings.AutoSolveAllSettings(); GitUICommands.Instance.StartSettingsDialog(); } }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string[] args = Environment.GetCommandLineArgs(); FormSplash.Show("Load settings"); Settings.LoadSettings(); if (Settings.RunningOnWindows()) { //Quick HOME check: FormSplash.SetAction("Check home path"); FormFixHome.CheckHomePath(); } //Register plugins FormSplash.SetAction("Load plugins"); PluginLoader.LoadAsync(); try { if (Application.UserAppDataRegistry == null || Application.UserAppDataRegistry.GetValue("checksettings") == null || !Application.UserAppDataRegistry.GetValue("checksettings").ToString().Equals("false", StringComparison.OrdinalIgnoreCase) || string.IsNullOrEmpty(Settings.GitCommand)) { FormSplash.SetAction("Check settings"); using (var settings = new FormSettings()) { if (!settings.CheckSettings()) { FormSettings.AutoSolveAllSettings(); GitUICommands.Instance.StartSettingsDialog(); } } } } catch { // TODO: remove catch-all } if (args.Length >= 3) { if (Directory.Exists(args[2])) Settings.WorkingDir = args[2]; if (string.IsNullOrEmpty(Settings.WorkingDir)) { if (args[2].Contains(Settings.PathSeparator.ToString())) Settings.WorkingDir = args[2].Substring(0, args[2].LastIndexOf(Settings.PathSeparator)); } if (Settings.ValidWorkingDir()) Repositories.RepositoryHistory.AddMostRecentRepository(Settings.WorkingDir); } if (string.IsNullOrEmpty(Settings.WorkingDir)) Settings.WorkingDir = Directory.GetCurrentDirectory(); FormSplash.SetAction("Starting"); if (args.Length <= 1) { GitUICommands.Instance.StartBrowseDialog(); } else // if we are here args.Length > 1 { RunCommand(args); } Settings.SaveSettings(); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string[] args = Environment.GetCommandLineArgs(); var formSplash = new FormSplash(); formSplash.Show(); formSplash.SetAction("Load settings"); Settings.LoadSettings(); //Quick HOME check: formSplash.SetAction("Check home path"); FormFixHome.CheckHomePath(); //Register plugins formSplash.SetAction("Load plugins"); PluginLoader.Load(); try { if (Application.UserAppDataRegistry == null || Application.UserAppDataRegistry.GetValue("checksettings") == null || Application.UserAppDataRegistry.GetValue("checksettings").ToString() == "true" || string.IsNullOrEmpty(Settings.GitCommand)) { formSplash.SetAction("Check settings"); var settings = new FormSettings(); if (!settings.CheckSettings()) { FormSettings.AutoSolveAllSettings(); GitUICommands.Instance.StartSettingsDialog(); } } } catch { } formSplash.Close(); if (args.Length >= 3) { if (Directory.Exists(args[2])) Settings.WorkingDir = args[2]; if (string.IsNullOrEmpty(Settings.WorkingDir)) { if (args[2].Contains("\\")) Settings.WorkingDir = args[2].Substring(0, args[2].LastIndexOf('\\')); } if (Settings.ValidWorkingDir()) Repositories.RepositoryHistory.AddMostRecentRepository(Settings.WorkingDir); } if (string.IsNullOrEmpty(Settings.WorkingDir)) Settings.WorkingDir = Directory.GetCurrentDirectory(); if (args.Length <= 1) GitUICommands.Instance.StartBrowseDialog(); else // if we are here args.Length > 1 RunCommand(args); Settings.SaveSettings(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string[] args = Environment.GetCommandLineArgs(); { FormSplash formSplash = new FormSplash(); formSplash.Show(); formSplash.SetAction("Load settings"); GitCommands.Settings.LoadSettings(); //Quick HOME check: formSplash.SetAction("Check home path"); FormFixHome.CheckHomePath(); //Register plugins formSplash.SetAction("Load plugins"); PluginLoader.Load(); try { if ((Application.UserAppDataRegistry.GetValue("checksettings") == null || Application.UserAppDataRegistry.GetValue("checksettings").ToString() == "true")) { formSplash.SetAction("Check settings"); FormSettings settings = new FormSettings(); if (!settings.CheckSettings()) { FormSettings.AutoSolveAllSettings(); //Application.Run(); GitUICommands.Instance.StartSettingsDialog(); } } } catch { } formSplash.Close(); } if (args.Length >= 3) { if (Directory.Exists(args[2])) GitCommands.Settings.WorkingDir = args[2]; if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir)) { if (args[2].Contains("\\")) GitCommands.Settings.WorkingDir = args[2].Substring(0, args[2].LastIndexOf('\\')); } if (GitCommands.Settings.ValidWorkingDir()) Repositories.RepositoryHistory.AddMostRecentRepository(GitCommands.Settings.WorkingDir); } if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir)) GitCommands.Settings.WorkingDir = Directory.GetCurrentDirectory(); if (args.Length <= 1) { ////Application.Run(); GitUICommands.Instance.StartBrowseDialog(); } else if (args.Length > 1 && args[1] == "mergeconflicts") { //Application.Run(); GitUICommands.Instance.StartResolveConflictsDialog(); } else if (args.Length > 1 && args[1] == "gitbash") { GitCommands.GitCommands.RunBash(); } else if (args.Length > 1 && args[1] == "gitignore") { //Application.Run(); GitUICommands.Instance.StartEditGitIgnoreDialog(); } else if (args.Length > 1 && args[1] == "remotes") { //Application.Run(); GitUICommands.Instance.StartRemotesDialog(); } else if (args.Length > 1 && args[1] == "browse") { //Application.Run(); GitUICommands.Instance.StartBrowseDialog(); } else if (args.Length > 1 && (args[1] == "addfiles" || args[1] == "add")) { //Application.Run(); GitUICommands.Instance.StartAddFilesDialog(); } else if (args.Length > 1 && (args[1] == "applypatch" || args[1] == "apply")) { //Application.Run(); GitUICommands.Instance.StartApplyPatchDialog(); } else if (args.Length > 1 && args[1] == "branch") { //Application.Run(); GitUICommands.Instance.StartCreateBranchDialog(); } else if (args.Length > 1 && (args[1] == "checkoutbranch" || args[1] == "checkout")) { //Application.Run(); GitUICommands.Instance.StartCheckoutBranchDialog(); } else if (args.Length > 1 && args[1] == "checkoutrevision") { //Application.Run(); GitUICommands.Instance.StartCheckoutRevisionDialog(); } else if (args.Length > 1 && args[1] == "init") { //Application.Run(); if (args.Length > 2) GitUICommands.Instance.StartInitializeDialog(args[2]); else GitUICommands.Instance.StartInitializeDialog(); } else if (args.Length > 1 && args[1] == "clone") { //Application.Run(); GitUICommands.Instance.StartCloneDialog(); } else if (args.Length > 1 && args[1] == "commit") { //Application.Run(); GitUICommands.Instance.StartCommitDialog(); } else if (args.Length > 1 && args[1] == "filehistory") { if (args.Length > 2) { //Remove working dir from filename. This is to prevent filenames that are too //long while there is room left when the workingdir was not in the path. string fileName = args[2].Replace(Settings.WorkingDir, "").Replace('\\', '/'); //Application.Run(); GitUICommands.Instance.StartFileHistoryDialog(fileName); } else MessageBox.Show("Cannot open hile history, there is no file selected.", "File history"); } else if (args.Length > 1 && args[1] == "formatpatch") { //Application.Run(); GitUICommands.Instance.StartFormatPatchDialog(); } else if (args.Length > 1 && args[1] == "pull") { //Application.Run(); GitUICommands.Instance.StartPullDialog(); } else if (args.Length > 1 && args[1] == "push") { //Application.Run(); GitUICommands.Instance.StartPushDialog(); } else if (args.Length > 1 && args[1] == "settings") { //Application.Run(); GitUICommands.Instance.StartSettingsDialog(); } else if (args.Length > 1 && args[1] == "viewdiff") { //Application.Run(); GitUICommands.Instance.StartCompareRevisionsDialog(); } else if (args.Length > 1 && args[1] == "rebase") { //Application.Run(); GitUICommands.Instance.StartRebaseDialog(null); } else if (args.Length > 1 && args[1] == "merge") { //Application.Run(); GitUICommands.Instance.StartMergeBranchDialog(null); } else if (args.Length > 1 && args[1] == "cherry") { //Application.Run(); GitUICommands.Instance.StartCherryPickDialog(); } else if (args.Length > 1 && args[1] == "revert") { Application.Run(new FormRevert(args[2])); } else if (args.Length > 1 && args[1] == "tag") { //Application.Run(); GitUICommands.Instance.StartCreateTagDialog(); } else if (args.Length > 1 && args[1] == "about") { Application.Run(new AboutBox()); } else if (args.Length > 1 && args[1] == "stash") { //Application.Run(); GitUICommands.Instance.StartStashDialog(); } else if (args.Length > 1) { Application.Run(new FormCommandlineHelp()); } GitCommands.Settings.SaveSettings(); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); 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(); PluginLoader.LoadAsync(); 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).ToString().Equals("false", StringComparison.OrdinalIgnoreCase) || string.IsNullOrEmpty(Settings.GitCommand)) { FormSplash.SetAction("Checking settings..."); Application.DoEvents(); using (var settings = new FormSettings()) { if (!settings.CheckSettings()) { FormSettings.AutoSolveAllSettings(); GitUICommands.Instance.StartSettingsDialog(); } } } } catch { // TODO: remove catch-all } if (args.Length >= 3) { if (Directory.Exists(args[2])) Settings.WorkingDir = args[2]; if (string.IsNullOrEmpty(Settings.WorkingDir)) { if (args[2].Contains(Settings.PathSeparator.ToString())) Settings.WorkingDir = args[2].Substring(0, args[2].LastIndexOf(Settings.PathSeparator)); } //Do not add this working dir to the recent repositories. It is a nice feature, but it //also increases the startup time //if (Settings.Module.ValidWorkingDir()) // Repositories.RepositoryHistory.AddMostRecentRepository(Settings.WorkingDir); } if (args.Length <= 1 && string.IsNullOrEmpty(Settings.WorkingDir) && Settings.StartWithRecentWorkingDir) { if (GitModule.ValidWorkingDir(Settings.RecentWorkingDir)) Settings.WorkingDir = Settings.RecentWorkingDir; } if (string.IsNullOrEmpty(Settings.WorkingDir)) { string findWorkingDir = GitModule.FindGitWorkingDir(Directory.GetCurrentDirectory()); if (GitModule.ValidWorkingDir(findWorkingDir)) Settings.WorkingDir = findWorkingDir; } FormSplash.HideSplash(); if (Settings.RunningOnWindows()) MouseWheelRedirector.Active = true; if (args.Length <= 1) { GitUICommands.Instance.StartBrowseDialog(); } else // if we are here args.Length > 1 { RunCommand(args); } Settings.SaveSettings(); }
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(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string[] args = Environment.GetCommandLineArgs(); GitCommands.Settings.LoadSettings(); try { if ((Application.UserAppDataRegistry.GetValue("checksettings") == null || Application.UserAppDataRegistry.GetValue("checksettings").ToString() == "true")) { FormSettings settings = new FormSettings(); if (!settings.CheckSettings()) { FormSettings.AutoSolveAllSettings(); Application.Run(settings); //settings.ShowDialog(); } } } catch { } if (args.Length == 3) { if (Directory.Exists(args[2])) GitCommands.Settings.WorkingDir = args[2]; if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir)) GitCommands.Settings.WorkingDir = args[2].Substring(0, args[2].LastIndexOf('\\')); if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir)) GitCommands.Settings.WorkingDir = Directory.GetCurrentDirectory(); } if (args.Length <= 1) { Application.Run(new FormBrowse()); }else if (args.Length > 1 && args[1] == "mergeconflicts") { Application.Run(new FormResolveConflicts()); } else if (args.Length > 1 && args[1] == "gitbash") { GitCommands.GitCommands.RunBash(); } else if (args.Length > 1 && args[1] == "gitignore") { Application.Run(new FormGitIgnore()); } else if (args.Length > 1 && args[1] == "remotes") { Application.Run(new FormRemotes()); } else if (args.Length > 1 && args[1] == "browse") { Application.Run(new FormBrowse()); }else if (args.Length > 1 && (args[1] == "addfiles" || args[1] == "add")) { Application.Run(new FormAddFiles()); }else if (args.Length > 1 && (args[1] == "applypatch" || args[1] == "apply")) { Application.Run(new MergePatch()); }else if (args.Length > 1 && args[1] == "branch") { Application.Run(new FormBranch()); }else if (args.Length > 1 && (args[1] == "checkoutbranch" || args[1] == "checkout")) { Application.Run(new FormCheckoutBranck()); }else if (args.Length > 1 && args[1] == "checkoutrevision") { Application.Run(new FormCheckout()); }else if (args.Length > 1 && args[1] == "init") { FormInit frm = new FormInit(args[2]); Application.Run(frm); } else if (args.Length > 1 && args[1] == "clone") { Application.Run(new FormClone()); }else if (args.Length > 1 && args[1] == "commit") { Application.Run(new FormCommit()); }else if (args.Length > 1 && args[1] == "filehistory") { if (args.Length > 2) Application.Run(new FormFileHistory(args[2])); else MessageBox.Show("No file selected"); } else if (args.Length > 1 && args[1] == "formatpatch") { Application.Run(new FormFormatPath()); }else if (args.Length > 1 && args[1] == "pull") { Application.Run(new FormPull()); }else if (args.Length > 1 && args[1] == "push") { Application.Run(new FormPush()); }else if (args.Length > 1 && args[1] == "settings") { Application.Run(new FormSettings()); } else if (args.Length > 1 && args[1] == "viewdiff") { Application.Run(new FormDiff()); } else if (args.Length > 1 && args[1] == "rebase") { Application.Run(new FormRebase()); } else if (args.Length > 1 && args[1] == "merge") { Application.Run(new FormMergeBranch()); } else if (args.Length > 1 && args[1] == "cherry") { Application.Run(new FormCherryPick()); } else if (args.Length > 1 && args[1] == "revert") { Application.Run(new FormRevert(args[2])); } else if (args.Length > 1 && args[1] == "tag") { Application.Run(new FormTag()); } else if (args.Length > 1 && args[1] == "about") { Application.Run(new AboutBox()); } else if (args.Length > 1 && args[1] == "stash") { Application.Run(new FormStash()); } else if (args.Length > 1) { Application.Run(new FormCommandlineHelp()); } GitCommands.Settings.SaveSettings(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string[] args = Environment.GetCommandLineArgs(); GitCommands.Settings.LoadSettings(); //Register pugins PluginLoader.Load(); try { if ((Application.UserAppDataRegistry.GetValue("checksettings") == null || Application.UserAppDataRegistry.GetValue("checksettings").ToString() == "true")) { FormSettings settings = new FormSettings(); if (!settings.CheckSettings()) { FormSettings.AutoSolveAllSettings(); //Application.Run(); GitUICommands.Instance.StartSettingsDialog(); } } } catch { } if (args.Length == 3) { if (Directory.Exists(args[2])) GitCommands.Settings.WorkingDir = args[2]; if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir)) { if (args[2].Contains("\\")) GitCommands.Settings.WorkingDir = args[2].Substring(0, args[2].LastIndexOf('\\')); } } if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir)) GitCommands.Settings.WorkingDir = Directory.GetCurrentDirectory(); if (args.Length <= 1) { ////Application.Run(); GitUICommands.Instance.StartBrowseDialog(); }else if (args.Length > 1 && args[1] == "mergeconflicts") { //Application.Run(); GitUICommands.Instance.StartResolveConflictsDialog(); } else if (args.Length > 1 && args[1] == "gitbash") { GitCommands.GitCommands.RunBash(); } else if (args.Length > 1 && args[1] == "gitignore") { //Application.Run(); GitUICommands.Instance.StartEditGitIgnoreDialog(); } else if (args.Length > 1 && args[1] == "remotes") { //Application.Run(); GitUICommands.Instance.StartRemotesDialog(); } else if (args.Length > 1 && args[1] == "browse") { //Application.Run(); GitUICommands.Instance.StartBrowseDialog(); }else if (args.Length > 1 && (args[1] == "addfiles" || args[1] == "add")) { //Application.Run(); GitUICommands.Instance.StartAddFilesDialog(); }else if (args.Length > 1 && (args[1] == "applypatch" || args[1] == "apply")) { //Application.Run(); GitUICommands.Instance.StartApplyPatchDialog(); }else if (args.Length > 1 && args[1] == "branch") { //Application.Run(); GitUICommands.Instance.StartCreateBranchDialog(); }else if (args.Length > 1 && (args[1] == "checkoutbranch" || args[1] == "checkout")) { //Application.Run(); GitUICommands.Instance.StartCheckoutBranchDialog(); }else if (args.Length > 1 && args[1] == "checkoutrevision") { //Application.Run(); GitUICommands.Instance.StartCheckoutRevisionDialog(); }else if (args.Length > 1 && args[1] == "init") { //Application.Run(); GitUICommands.Instance.StartInitializeDialog(args[2]); } else if (args.Length > 1 && args[1] == "clone") { //Application.Run(); GitUICommands.Instance.StartCloneDialog(); }else if (args.Length > 1 && args[1] == "commit") { //Application.Run(); GitUICommands.Instance.StartCommitDialog(); }else if (args.Length > 1 && args[1] == "filehistory") { if (args.Length > 2) { //Application.Run(); GitUICommands.Instance.StartFileHistoryDialog(args[2]); } else MessageBox.Show("Cannot open hile history, there is no file selected.", "File history"); } else if (args.Length > 1 && args[1] == "formatpatch") { //Application.Run(); GitUICommands.Instance.StartFormatPatchDialog(); }else if (args.Length > 1 && args[1] == "pull") { //Application.Run(); GitUICommands.Instance.StartPullDialog(); }else if (args.Length > 1 && args[1] == "push") { //Application.Run(); GitUICommands.Instance.StartPushDialog(); }else if (args.Length > 1 && args[1] == "settings") { //Application.Run(); GitUICommands.Instance.StartSettingsDialog(); } else if (args.Length > 1 && args[1] == "viewdiff") { //Application.Run(); GitUICommands.Instance.StartCompareRevisionsDialog(); } else if (args.Length > 1 && args[1] == "rebase") { //Application.Run(); GitUICommands.Instance.StartRebaseDialog(); } else if (args.Length > 1 && args[1] == "merge") { //Application.Run(); GitUICommands.Instance.StartMergeBranchDialog(); } else if (args.Length > 1 && args[1] == "cherry") { //Application.Run(); GitUICommands.Instance.StartCherryPickDialog(); } else if (args.Length > 1 && args[1] == "revert") { Application.Run(new FormRevert(args[2])); } else if (args.Length > 1 && args[1] == "tag") { //Application.Run(); GitUICommands.Instance.StartCreateTagDialog(); } else if (args.Length > 1 && args[1] == "about") { Application.Run(new AboutBox()); } else if (args.Length > 1 && args[1] == "stash") { //Application.Run(); GitUICommands.Instance.StartStashDialog(); } else if (args.Length > 1) { Application.Run(new FormCommandlineHelp()); } GitCommands.Settings.SaveSettings(); }