本文整理汇总了C#中GitCommands.GitCommands.GetGlobalSetting方法的典型用法代码示例。如果您正苦于以下问题:C# GitCommands.GetGlobalSetting方法的具体用法?C# GitCommands.GetGlobalSetting怎么用?C# GitCommands.GetGlobalSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitCommands.GitCommands
的用法示例。
在下文中一共展示了GitCommands.GetGlobalSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: CheckSettings
public bool CheckSettings()
{
bool bValid = true;
try
{
if (string.IsNullOrEmpty(GitCommands.Settings.GetInstallDir()))
{
GitExtensionsInstall.BackColor = Color.LightSalmon;
GitExtensionsInstall.Text = "Registry entry missing [Software\\GitExtensions\\GitExtensions\\1.0.0.0\\InstallDir].";
bValid = false;
}
else
{
GitExtensionsInstall.BackColor = Color.LightGreen;
GitExtensionsInstall.Text = "GitExtensions is properly registered.";
}
if (string.IsNullOrEmpty(GetRegistryValue(Registry.LocalMachine, "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", "{3C16B20A-BA16-4156-916F-0A375ECFFE24}")) ||
string.IsNullOrEmpty(GetRegistryValue(Registry.ClassesRoot, "*\\shellex\\ContextMenuHandlers\\GitExtensions2", null)) ||
string.IsNullOrEmpty(GetRegistryValue(Registry.ClassesRoot, "Directory\\shellex\\ContextMenuHandlers\\GitExtensions2", null)) ||
string.IsNullOrEmpty(GetRegistryValue(Registry.ClassesRoot, "Directory\\Background\\shellex\\ContextMenuHandlers\\GitExtensions2", null)))
{
ShellExtensionsRegistered.BackColor = Color.LightSalmon;
ShellExtensionsRegistered.Text = "GitExtensionsShellEx.dll needs to be registered in order to use the shell extensions.";
bValid = false;
}
else
{
ShellExtensionsRegistered.BackColor = Color.LightGreen;
ShellExtensionsRegistered.Text = "Shell extensions registered properly.";
}
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
if (string.IsNullOrEmpty(gitCommands.GetGlobalSetting("user.name")) ||
string.IsNullOrEmpty(gitCommands.GetGlobalSetting("user.email")))
{
UserNameSet.BackColor = Color.LightSalmon;
UserNameSet.Text = "You need to configure a user name and an email address.";
bValid = false;
}
else
{
UserNameSet.BackColor = Color.LightGreen;
UserNameSet.Text = "There is a user name and an email address configured.";
}
if (string.IsNullOrEmpty(gitCommands.GetGlobalSetting("merge.tool")))
{
DiffTool.BackColor = Color.LightSalmon;
DiffTool.Text = "You need to configure merge tool in order to solve mergeconflicts (kdiff3 for example).";
bValid = false;
}
else
{
if (gitCommands.GetGlobalSetting("merge.tool").Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
{
string p = gitCommands.GetGlobalSetting("mergetool.kdiff3.path");
if (string.IsNullOrEmpty(p) || !File.Exists(p))
{
DiffTool.BackColor = Color.LightSalmon;
DiffTool.Text = "KDiff3 is configured as mergetool, but the path to kdiff.exe is not configured.";
bValid = false;
}
else
{
DiffTool.BackColor = Color.LightGreen;
DiffTool.Text = "KDiff3 is configured as mergetool.";
}
}
else
{
string mergetool = gitCommands.GetGlobalSetting("merge.tool");
if (mergetool.Equals("p4merge", StringComparison.CurrentCultureIgnoreCase) ||
mergetool.Equals("TortoiseMerge", StringComparison.CurrentCultureIgnoreCase))
{
string p = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".cmd");
if (string.IsNullOrEmpty(p))
{
DiffTool.BackColor = Color.LightSalmon;
DiffTool.Text = mergetool + " is configured as mergetool, this is a custom mergetool and needs a custom cmd to be configured.";
bValid = false;
}
else
{
DiffTool.BackColor = Color.LightGreen;
DiffTool.Text = "There is a custom mergetool configured: " + mergetool;
}
}
else
{
DiffTool.BackColor = Color.LightGreen;
DiffTool.Text = "There is a mergetool configured.";
}
}
}
if (!CanFindGitCmd())
{
GitFound.BackColor = Color.LightSalmon;
GitFound.Text = "git.cmd not found. To solve this problem you can set the correct path in settings.";
//.........这里部分代码省略.........
示例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;
}
示例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");
//.........这里部分代码省略.........
示例5: InitMergetool
private void InitMergetool()
{
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
mergetool = GitCommands.GitCommands.GetSetting("merge.tool");
if (string.IsNullOrEmpty(mergetool))
mergetool = gitCommands.GetGlobalSetting("merge.tool");
if (string.IsNullOrEmpty(mergetool))
{
MessageBox.Show("There is no mergetool configured. Please go to settings and set a mergetool!");
return;
}
mergetoolCmd = GitCommands.GitCommands.GetSetting("mergetool." + mergetool + ".cmd");
if (string.IsNullOrEmpty(mergetoolCmd))
mergetoolCmd = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".cmd");
mergetoolPath = GitCommands.GitCommands.GetSetting("mergetool." + mergetool + ".path");
if (string.IsNullOrEmpty(mergetoolPath))
mergetoolPath = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".path");
if (string.IsNullOrEmpty(mergetool) || mergetool == "kdiff3")
mergetoolCmd = mergetoolPath + " \"$BASE\" \"$LOCAL\" \"$REMOTE\" -o \"$MERGED\"";
mergetoolPath = mergetoolCmd.Substring(0, mergetoolCmd.IndexOf(".exe") + 5).Trim(new char[]{'\"', ' '});
mergetoolCmd = mergetoolCmd.Substring(mergetoolCmd.IndexOf(".exe") + 5);
}
示例6: ExternalDiffTool_TextChanged
private void ExternalDiffTool_TextChanged(object sender, EventArgs e)
{
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
DifftoolPath.Text = gitCommands.GetGlobalSetting("difftool." + GlobalDiffTool.Text.Trim() + ".path");
ResolveDiffToolPath();
}
示例7: ExternalDiffTool_TextChanged
private void ExternalDiffTool_TextChanged(object sender, EventArgs e)
{
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
DifftoolPath.Text = gitCommands.GetGlobalSetting("difftool." + GlobalDiffTool.Text.Trim() + ".path");
DifftoolCmd.Text = gitCommands.GetGlobalSetting("difftool." + GlobalDiffTool.Text.Trim() + ".cmd");
if (GlobalDiffTool.Text.Trim().Equals("winmerge", StringComparison.CurrentCultureIgnoreCase))
DiffToolCmdSuggest_Click(null, null);
ResolveDiffToolPath();
}
示例8: GlobalMergeTool_TextChanged
private void GlobalMergeTool_TextChanged(object sender, EventArgs e)
{
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
MergetoolPath.Text = gitCommands.GetGlobalSetting("mergetool." + GlobalMergeTool.Text.Trim() + ".path");
MergeToolCmd.Text = gitCommands.GetGlobalSetting("mergetool." + GlobalMergeTool.Text.Trim() + ".cmd");
button1_Click_1(null, null);
}
示例9: InitMergetool
private void InitMergetool()
{
Cursor.Current = Cursors.WaitCursor;
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
mergetool = GitCommands.GitCommands.GetSetting("merge.tool");
if (string.IsNullOrEmpty(mergetool))
mergetool = gitCommands.GetGlobalSetting("merge.tool");
if (string.IsNullOrEmpty(mergetool))
{
MessageBox.Show(noMergeTool.Text);
return;
}
mergetoolCmd = GitCommands.GitCommands.GetSetting("mergetool." + mergetool + ".cmd");
if (string.IsNullOrEmpty(mergetoolCmd))
mergetoolCmd = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".cmd");
mergetoolPath = GitCommands.GitCommands.GetSetting("mergetool." + mergetool + ".path");
if (string.IsNullOrEmpty(mergetoolPath))
mergetoolPath = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".path");
if (string.IsNullOrEmpty(mergetool) || mergetool == "kdiff3")
mergetoolCmd = mergetoolPath + " \"$BASE\" \"$LOCAL\" \"$REMOTE\" -o \"$MERGED\"";
mergetoolPath = mergetoolCmd.Substring(0, mergetoolCmd.IndexOf(".exe") + 5).Trim(new char[]{'\"', ' '});
mergetoolCmd = mergetoolCmd.Substring(mergetoolCmd.IndexOf(".exe") + 5);
}
示例10: DiffToolCmdSuggest_Click
private void DiffToolCmdSuggest_Click(object sender, EventArgs e)
{
if (!Settings.RunningOnWindows())
return;
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
if (GlobalDiffTool.Text.Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
{
string kdiff3path = gitCommands.GetGlobalSetting("difftool.kdiff3.path");
string regkdiff3path = GetRegistryValue(Registry.LocalMachine, "SOFTWARE\\KDiff3", "") + "\\kdiff3.exe";
DifftoolPath.Text = FindFileInFolders("kdiff3.exe", kdiff3path,
@"c:\Program Files\KDiff3\",
@"c:\Program Files (x86)\KDiff3\",
regkdiff3path);
}
if (GlobalDiffTool.Text.Equals("winmerge", StringComparison.CurrentCultureIgnoreCase))
{
string winmergepath = gitCommands.GetGlobalSetting("difftool.winmerge.path");
DifftoolPath.Text = FindFileInFolders("winmergeu.exe", winmergepath,
@"c:\Program Files\winmerge\",
@"c:\Program Files (x86)\winmerge\");
}
if (File.Exists(DifftoolPath.Text))
DifftoolCmd.Text = "\"" + DifftoolPath.Text + "\" \"$LOCAL\" \"$REMOTE\"";
}
示例11: CheckMergeTool
private bool CheckMergeTool()
{
DiffTool.Visible = true;
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
if (string.IsNullOrEmpty(gitCommands.GetGlobalSetting("merge.tool")))
{
DiffTool.BackColor = Color.LightSalmon;
DiffTool.Text = "You need to configure merge tool in order to solve mergeconflicts (kdiff3 for example).";
return false;
}
if (Settings.RunningOnWindows())
{
if (gitCommands.GetGlobalSetting("merge.tool").Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
{
string p = gitCommands.GetGlobalSetting("mergetool.kdiff3.path");
if (string.IsNullOrEmpty(p) || !File.Exists(p))
{
DiffTool.BackColor = Color.LightSalmon;
DiffTool.Text = "KDiff3 is configured as mergetool, but the path to kdiff.exe is not configured.";
return false;
}
DiffTool.BackColor = Color.LightGreen;
DiffTool.Text = "KDiff3 is configured as mergetool.";
return true;
}
string mergetool = gitCommands.GetGlobalSetting("merge.tool");
if (mergetool.Equals("p4merge", StringComparison.CurrentCultureIgnoreCase) ||
mergetool.Equals("TortoiseMerge", StringComparison.CurrentCultureIgnoreCase))
{
string p = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".cmd");
if (string.IsNullOrEmpty(p))
{
DiffTool.BackColor = Color.LightSalmon;
DiffTool.Text = mergetool + " is configured as mergetool, this is a custom mergetool and needs a custom cmd to be configured.";
return false;
}
DiffTool.BackColor = Color.LightGreen;
DiffTool.Text = "There is a custom mergetool configured: " + mergetool;
return true;
}
}
DiffTool.BackColor = Color.LightGreen;
DiffTool.Text = "There is a mergetool configured.";
return true;
}
示例12: CheckGlobalUserSettingsValid
private bool CheckGlobalUserSettingsValid()
{
UserNameSet.Visible = true;
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
if (string.IsNullOrEmpty(gitCommands.GetGlobalSetting("user.name")) ||
string.IsNullOrEmpty(gitCommands.GetGlobalSetting("user.email")))
{
UserNameSet.BackColor = Color.LightSalmon;
UserNameSet.Text = "You need to configure a user name and an email address.";
return false;
}
UserNameSet.BackColor = Color.LightGreen;
UserNameSet.Text = "There is a user name and an email address configured.";
return true;
}
示例13: CheckDiffToolConfiguration
private bool CheckDiffToolConfiguration()
{
DiffTool2.Visible = true;
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
if (string.IsNullOrEmpty(FormSettings.GetGlobalDiffToolFromConfig()))
{
DiffTool2.BackColor = Color.LightSalmon;
DiffTool2.Text = "You should configure a diff tool to show file diff in external program (kdiff3 for example).";
return false;
}
if (Settings.RunningOnWindows())
{
if (FormSettings.GetGlobalDiffToolFromConfig().Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
{
string p = gitCommands.GetGlobalSetting("difftool.kdiff3.path");
if (string.IsNullOrEmpty(p) || !File.Exists(p))
{
DiffTool2.BackColor = Color.LightSalmon;
DiffTool2.Text = "KDiff3 is configured as difftool, but the path to kdiff.exe is not configured.";
return false;
}
DiffTool2.BackColor = Color.LightGreen;
DiffTool2.Text = "KDiff3 is configured as difftool.";
return true;
}
}
string difftool = FormSettings.GetGlobalDiffToolFromConfig();
DiffTool2.BackColor = Color.LightGreen;
DiffTool2.Text = "There is a difftool configured: " + difftool;
return true;
}
示例14: button1_Click_1
private void button1_Click_1(object sender, EventArgs e)
{
if (!Settings.RunningOnWindows())
return;
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
if (GlobalMergeTool.Text.Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
{
string kdiff3path = gitCommands.GetGlobalSetting("mergetool.kdiff3.path");
string regkdiff3path = GetRegistryValue(Registry.LocalMachine, "SOFTWARE\\KDiff3", "") + "\\kdiff3.exe";
MergetoolPath.Text = FindFileInFolders("kdiff3.exe", kdiff3path,
@"c:\Program Files\KDiff3\",
@"c:\Program Files (x86)\KDiff3\",
regkdiff3path);
}
if (GlobalMergeTool.Text.Equals("winmerge", StringComparison.CurrentCultureIgnoreCase))
{
string winmergepath = gitCommands.GetGlobalSetting("mergetool.winmerge.path");
MergetoolPath.Text = FindFileInFolders("winmergeu.exe", winmergepath,
@"c:\Program Files\winmerge\",
@"c:\Program Files (x86)\winmerge\");
}
AutoConfigMergeToolcmd();
}
示例15: 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;
}