当前位置: 首页>>代码示例>>C#>>正文


C# GitCommands.SetGlobalSetting方法代码示例

本文整理汇总了C#中GitCommands.GitCommands.SetGlobalSetting方法的典型用法代码示例。如果您正苦于以下问题:C# GitCommands.SetGlobalSetting方法的具体用法?C# GitCommands.SetGlobalSetting怎么用?C# GitCommands.SetGlobalSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GitCommands.GitCommands的用法示例。


在下文中一共展示了GitCommands.SetGlobalSetting方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SolveKDiff

        public static bool SolveKDiff()
        {
            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
            string mergeTool = gitCommands.GetGlobalSetting("merge.tool");
            if (string.IsNullOrEmpty(mergeTool))
            {
                mergeTool = "kdiff3";
                gitCommands.SetGlobalSetting("merge.tool", mergeTool);
            }

            if (mergeTool.Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
                return SolveKDiffPath(gitCommands);

            return true;
        }
开发者ID:bleis-tift,项目名称:gitextensions,代码行数:15,代码来源:FormSettings.cs

示例2: DiffTool_Click

        private void DiffTool_Click(object sender, EventArgs e)
        {
            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();

            if (string.IsNullOrEmpty(gitCommands.GetGlobalSetting("merge.tool")))
            {
                if (MessageBox.Show("There is no mergetool configured. Do you want to configure kdiff3 as your mergetool?" + Environment.NewLine + "Select no if you want to configure a different mergetool yourself.", "Mergetool", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    SolveKDiff();
                    GlobalMergeTool.Text = "kdiff3";
                }
                else
                {
                    tabControl1.SelectTab("GlobalSettingsPage");
                    return;
                }
            }

            if (gitCommands.GetGlobalSetting("merge.tool").Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
            {
                SolveKDiffPath(gitCommands);
            }
            else
                if (gitCommands.GetGlobalSetting("merge.tool").Equals("p4merge", StringComparison.CurrentCultureIgnoreCase) ||
                    gitCommands.GetGlobalSetting("merge.tool").Equals("TortoiseMerge", StringComparison.CurrentCultureIgnoreCase))
                {
                    AutoConfigMergeToolcmd();
                    gitCommands.SetGlobalSetting("mergetool." + gitCommands.GetGlobalSetting("merge.tool") + ".cmd", MergeToolCmd.Text);
                }

            if (gitCommands.GetGlobalSetting("merge.tool").Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase) && string.IsNullOrEmpty(gitCommands.GetGlobalSetting("mergetool.kdiff3.path")))
            {
                MessageBox.Show("Path to kdiff3 could not be found automatically." + Environment.NewLine + "Please make sure KDiff3 is installed or set path manually.");
                tabControl1.SelectTab("GlobalSettingsPage");
                return;
            }

            Rescan_Click(null, null);
        }
开发者ID:PProvost,项目名称:gitextensions,代码行数:39,代码来源:FormSettings.cs

示例3: SolveKDiffPath

        public static bool SolveKDiffPath(GitCommands.GitCommands gitCommands)
        {
            string kdiff3path = gitCommands.GetGlobalSetting("mergetool.kdiff3.path");
            if (string.IsNullOrEmpty(kdiff3path) || !File.Exists(kdiff3path))
            {
                kdiff3path = @"c:\Program Files\KDiff3\kdiff3.exe";
                if (string.IsNullOrEmpty(kdiff3path) || !File.Exists(kdiff3path))
                {
                    kdiff3path = @"c:\Program Files (x86)\KDiff3\kdiff3.exe";
                    if (string.IsNullOrEmpty(kdiff3path) || !File.Exists(kdiff3path))
                    {
                        kdiff3path = GetRegistryValue(Registry.LocalMachine, "SOFTWARE\\KDiff3", "") + "\\kdiff3.exe";
                        if (string.IsNullOrEmpty(kdiff3path) || !File.Exists(kdiff3path))
                        {
                            kdiff3path = "";
                            return false;
                        }
                    }
                }
            }
            gitCommands.SetGlobalSetting("mergetool.kdiff3.path", kdiff3path);

            return true;
        }
开发者ID:PProvost,项目名称:gitextensions,代码行数:24,代码来源:FormSettings.cs

示例4: Save

        private bool Save()
        {
            GitCommands.Settings.FollowRenamesInFileHistory = FollowRenamesInFileHistory.Checked;

            GitCommands.Settings.Smtp = SmtpServer.Text;

            GitCommands.Settings.GitDir = GitPath.Text;
            GitCommands.Settings.GitBinDir = GitBinPath.Text;

            GitCommands.Settings.CloseProcessDialog = CloseProcessDialog.Checked;
            GitCommands.Settings.ShowRevisionGraph = ShowRevisionGraph.Checked;
            GitCommands.Settings.ShowGitCommandLine = ShowGitCommandLine.Checked;

            GitCommands.Settings.UseFastChecks = UseFastChecks.Checked;
            GitCommands.Settings.RelativeDate = ShowRelativeDate.Checked;

            GitCommands.Settings.Dictionary = Dictionary.Text;

            GitCommands.Settings.MaxCommits = (int)MaxCommits.Value;

            GitCommands.Settings.Plink = PlinkPath.Text;
            GitCommands.Settings.Puttygen = PuttygenPath.Text;
            GitCommands.Settings.Pageant = PageantPath.Text;
            GitCommands.Settings.AutoStartPageant = AutostartPageant.Checked;

            if (string.IsNullOrEmpty(Encoding.Text) || Encoding.Text.Equals("Default", StringComparison.CurrentCultureIgnoreCase))
                GitCommands.Settings.Encoding = System.Text.Encoding.Default;
            else
                if (Encoding.Text.Equals("ASCII", StringComparison.CurrentCultureIgnoreCase))
                    GitCommands.Settings.Encoding = new ASCIIEncoding();
                else
                    if (Encoding.Text.Equals("Unicode", StringComparison.CurrentCultureIgnoreCase))
                        GitCommands.Settings.Encoding = new UnicodeEncoding();
                    else
                        if (Encoding.Text.Equals("UTF7", StringComparison.CurrentCultureIgnoreCase))
                            GitCommands.Settings.Encoding = new UTF7Encoding();
                        else
                            if (Encoding.Text.Equals("UTF8", StringComparison.CurrentCultureIgnoreCase))
                                GitCommands.Settings.Encoding = new UTF8Encoding(false);
                            else
                                if (Encoding.Text.Equals("UTF32", StringComparison.CurrentCultureIgnoreCase))
                                    GitCommands.Settings.Encoding = new UTF32Encoding(true, false);
                                else
                                    GitCommands.Settings.Encoding = System.Text.Encoding.Default;

            Settings.RevisionGraphColor = RevisionGraphColorLabel.BackColor;
            Settings.RevisionGraphColorSelected = RevisionGraphColorSelected.BackColor;
            Settings.TagColor = ColorTagLabel.BackColor;
            Settings.BranchColor = ColorBranchLabel.BackColor;
            Settings.RemoteBranchColor = ColorRemoteBranchLabel.BackColor;
            Settings.OtherTagColor = ColorOtherLabel.BackColor;

            Settings.DiffAddedColor = ColorAddedLineLabel.BackColor;
            Settings.DiffRemovedColor = ColorRemovedLine.BackColor;
            Settings.DiffSectionColor = ColorSectionLabel.BackColor;

            EnableSettings();

            if (!CanFindGitCmd())
            {
                if (MessageBox.Show("The path to git.cmd is not configured correct." + Environment.NewLine + "You need to set the correct path to be able to use GitExtensions." + Environment.NewLine + Environment.NewLine + "Do you want to set the correct path now?", "Incorrect path", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    return false;
            }
            else
            {
                GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();

                if (string.IsNullOrEmpty(UserName.Text) || !UserName.Text.Equals(GitCommands.GitCommands.GetSetting("user.name")))
                    GitCommands.GitCommands.SetSetting("user.name", UserName.Text);
                if (string.IsNullOrEmpty(UserEmail.Text) || !UserEmail.Text.Equals(GitCommands.GitCommands.GetSetting("user.email")))
                    GitCommands.GitCommands.SetSetting("user.email", UserEmail.Text);
                GitCommands.GitCommands.SetSetting("core.editor", Editor.Text);
                GitCommands.GitCommands.SetSetting("merge.tool", MergeTool.Text);

                if (KeepMergeBackup.CheckState == CheckState.Checked)
                    GitCommands.GitCommands.SetSetting("mergetool.keepBackup", "true");
                else
                    if (KeepMergeBackup.CheckState == CheckState.Unchecked)
                        GitCommands.GitCommands.SetSetting("mergetool.keepBackup", "false");

                GitCommands.GitCommands.SetSetting("core.autocrlf", LocalAutoCRLF.SelectedItem as string);

                if (string.IsNullOrEmpty(GlobalUserName.Text) || !GlobalUserName.Text.Equals(gitCommands.GetGlobalSetting("user.name")))
                    gitCommands.SetGlobalSetting("user.name", GlobalUserName.Text);
                if (string.IsNullOrEmpty(GlobalUserEmail.Text) || !GlobalUserEmail.Text.Equals(gitCommands.GetGlobalSetting("user.email")))
                    gitCommands.SetGlobalSetting("user.email", GlobalUserEmail.Text);
                gitCommands.SetGlobalSetting("core.editor", GlobalEditor.Text);
                gitCommands.SetGlobalSetting("merge.tool", GlobalMergeTool.Text);

                if (!string.IsNullOrEmpty(GlobalMergeTool.Text))
                    gitCommands.SetGlobalSetting("mergetool." + GlobalMergeTool.Text + ".path", MergetoolPath.Text);
                if (!string.IsNullOrEmpty(GlobalMergeTool.Text))
                    gitCommands.SetGlobalSetting("mergetool." + GlobalMergeTool.Text + ".cmd", MergeToolCmd.Text);

                if (GlobalKeepMergeBackup.CheckState == CheckState.Checked)
                    gitCommands.SetGlobalSetting("mergetool.keepBackup", "true");
                else
                    if (GlobalKeepMergeBackup.CheckState == CheckState.Unchecked)
                        gitCommands.SetGlobalSetting("mergetool.keepBackup", "false");

//.........这里部分代码省略.........
开发者ID:PProvost,项目名称:gitextensions,代码行数:101,代码来源:FormSettings.cs

示例5: SolveEditor

        private static bool SolveEditor()
        {
            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
            string editor = gitCommands.GetGlobalSetting("core.editor");
            if (string.IsNullOrEmpty(editor))
            {
                gitCommands.SetGlobalSetting("core.editor", "\"" + GetGitExtensionsFullPath() + "\" fileeditor");
            }

            return true;
        }
开发者ID:X-Coder,项目名称:gitextensions,代码行数:11,代码来源:FormSettings.cs


注:本文中的GitCommands.GitCommands.SetGlobalSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。