private bool Save()
{
if (otherHome.Checked)
{
Settings.UserProfileHomeDir = false;
if (string.IsNullOrEmpty(otherHomeDir.Text))
{
MessageBox.Show("Please enter a valid HOME directory.");
new FormFixHome().ShowDialog();
}
else
Settings.CustomHomeDir = otherHomeDir.Text;
}
else
{
Settings.CustomHomeDir = "";
Settings.UserProfileHomeDir = userprofileHome.Checked;
}
FormFixHome.CheckHomePath();
GitCommands.GitCommands.SetEnvironmentVariable(true);
GitCommands.Settings.ShowErrorsWhenStagingFiles = showErrorsWhenStagingFiles.Checked;
GitCommands.Settings.FollowRenamesInFileHistory = FollowRenamesInFileHistory.Checked;
if ((int)_NO_TRANSLATE_authorImageSize.Value != GitCommands.Settings.AuthorImageSize)
{
GitCommands.Settings.AuthorImageSize = (int)_NO_TRANSLATE_authorImageSize.Value;
GravatarService.ClearImageCache();
}
GitCommands.Settings.Translation = Language.Text;
GitCommands.Settings.ShowGitStatusInBrowseToolbar = ShowGitStatusInToolbar.Checked;
GitCommands.Settings.AuthorImageCacheDays = (int)_NO_TRANSLATE_DaysToCacheImages.Value;
GitCommands.Settings.Smtp = SmtpServer.Text;
GitCommands.Settings.GitCommand = GitPath.Text;
GitCommands.Settings.GitBinDir = GitBinPath.Text;
GitCommands.Settings.ShowAuthorGravatar = ShowAuthorGravatar.Checked;
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)_NO_TRANSLATE_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(_NO_TRANSLATE_Encoding.Text) || _NO_TRANSLATE_Encoding.Text.StartsWith("Default", StringComparison.CurrentCultureIgnoreCase))
GitCommands.Settings.Encoding = System.Text.Encoding.Default;
else
if (_NO_TRANSLATE_Encoding.Text.Equals("ASCII", StringComparison.CurrentCultureIgnoreCase))
GitCommands.Settings.Encoding = new ASCIIEncoding();
else
if (_NO_TRANSLATE_Encoding.Text.Equals("Unicode", StringComparison.CurrentCultureIgnoreCase))
GitCommands.Settings.Encoding = new UnicodeEncoding();
else
if (_NO_TRANSLATE_Encoding.Text.Equals("UTF7", StringComparison.CurrentCultureIgnoreCase))
GitCommands.Settings.Encoding = new UTF7Encoding();
else
if (_NO_TRANSLATE_Encoding.Text.Equals("UTF8", StringComparison.CurrentCultureIgnoreCase))
GitCommands.Settings.Encoding = new UTF8Encoding(false);
else
if (_NO_TRANSLATE_Encoding.Text.Equals("UTF32", StringComparison.CurrentCultureIgnoreCase))
GitCommands.Settings.Encoding = new UTF32Encoding(true, false);
else
GitCommands.Settings.Encoding = System.Text.Encoding.Default;
Settings.RevisionGridQuickSearchTimeout = (int)RevisionGridQuickSearchTimeout.Value;
Settings.MulticolorBranches = MulticolorBranches.Checked;
Settings.RevisionGraphDrawNonRelativesGray = DrawNonRelativesGray.Checked;
Settings.BranchBorders = BranchBorders.Checked;
Settings.StripedBranchChange = StripedBanchChange.Checked;
Settings.GraphColor = _NO_TRANSLATE_ColorGraphLabel.BackColor;
Settings.TagColor = _NO_TRANSLATE_ColorTagLabel.BackColor;
Settings.BranchColor = _NO_TRANSLATE_ColorBranchLabel.BackColor;
Settings.RemoteBranchColor = _NO_TRANSLATE_ColorRemoteBranchLabel.BackColor;
Settings.OtherTagColor = _NO_TRANSLATE_ColorOtherLabel.BackColor;
Settings.DiffAddedColor = _NO_TRANSLATE_ColorAddedLineLabel.BackColor;
Settings.DiffRemovedColor = _NO_TRANSLATE_ColorRemovedLine.BackColor;
Settings.DiffAddedExtraColor = _NO_TRANSLATE_ColorAddedLineDiffLabel.BackColor;
Settings.DiffRemovedExtraColor = _NO_TRANSLATE_ColorRemovedLineDiffLabel.BackColor;
Settings.DiffSectionColor = _NO_TRANSLATE_ColorSectionLabel.BackColor;
if (DefaultIcon.Checked)
GitCommands.Settings.IconColor = "default";
if (BlueIcon.Checked)
GitCommands.Settings.IconColor = "blue";
if (GreenIcon.Checked)
GitCommands.Settings.IconColor = "green";
if (PurpleIcon.Checked)
GitCommands.Settings.IconColor = "purple";
if (RedIcon.Checked)
GitCommands.Settings.IconColor = "red";
if (YellowIcon.Checked)
GitCommands.Settings.IconColor = "yellow";
if (RandomIcon.Checked)
GitCommands.Settings.IconColor = "random";
EnableSettings();
if (!CanFindGitCmd())
{
if (MessageBox.Show("The command to run git 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 command now?", "Incorrect path", MessageBoxButtons.YesNo) == DialogResult.Yes)
return false;
}
else
{
handleCanFindGitCommand();
}
if (OpenSSH.Checked)
GitCommands.GitCommands.UnSetSsh();
if (Putty.Checked)
GitCommands.GitCommands.SetSsh(PlinkPath.Text);
if (Other.Checked)
GitCommands.GitCommands.SetSsh(OtherSsh.Text);
GitCommands.Settings.SaveSettings();
return true;
}