public static void SaveSettings()
{
try
{
if (Application.UserAppDataRegistry == null)
throw new Exception("Application.UserAppDataRegistry is not available");
var appData = Application.UserAppDataRegistry;
appData.SetValue("gitdir", GitCommand);
appData.SetValue("gitbindir", GitBinDir);
SetEncoding();
appData.SetValue("history", Repositories.SerializeHistoryIntoXml());
appData.SetValue("repositories", Repositories.SerializeRepositories());
appData.SetValue("showauthorgravatar", ShowAuthorGravatar);
appData.SetValue("userprofilehomedir", UserProfileHomeDir);
appData.SetValue("customhomedir", CustomHomeDir);
appData.SetValue("closeCommitDialogAfterCommit", CloseCommitDialogAfterCommit);
appData.SetValue("pushAfterCommit", PushAfterCommit);
appData.SetValue("markIllFormedLinesInCommitMsg", MarkIllFormedLinesInCommitMsg);
appData.SetValue("diffaddedcolor", ColorTranslator.ToHtml(DiffAddedColor));
appData.SetValue("diffremovedcolor", ColorTranslator.ToHtml(DiffRemovedColor));
appData.SetValue("diffaddedextracolor", ColorTranslator.ToHtml(DiffAddedExtraColor));
appData.SetValue("diffremovedextracolor", ColorTranslator.ToHtml(DiffRemovedExtraColor));
appData.SetValue("diffsectioncolor", ColorTranslator.ToHtml(DiffSectionColor));
appData.SetValue("multicolorbranches", MulticolorBranches);
appData.SetValue("branchborders", BranchBorders);
appData.SetValue("stripedbanchchange", StripedBranchChange);
appData.SetValue("tagcolor", ColorTranslator.ToHtml(TagColor));
appData.SetValue("graphcolor", ColorTranslator.ToHtml(GraphColor));
appData.SetValue("branchcolor", ColorTranslator.ToHtml(BranchColor));
appData.SetValue("remotebranchcolor", ColorTranslator.ToHtml(RemoteBranchColor));
appData.SetValue("othertagcolor", ColorTranslator.ToHtml(OtherTagColor));
appData.SetValue("iconcolor", IconColor);
appData.SetValue("translation", Translation);
appData.SetValue("authorImageCacheDays", AuthorImageCacheDays);
appData.SetValue("authorimagesize", AuthorImageSize);
appData.SetValue("maxcommits", MaxCommits);
appData.SetValue("showallbranches", ShowCurrentBranchOnly);
appData.SetValue("branchfilterenabled", BranchFilterEnabled);
appData.SetValue("closeprocessdialog", CloseProcessDialog);
appData.SetValue("showrevisiongraph", ShowRevisionGraph);
appData.SetValue("showauthordate", ShowAuthorDate);
appData.SetValue("orderrevisiongraphbydate", OrderRevisionByDate);
appData.SetValue("showgitcommandline", ShowGitCommandLine);
appData.SetValue("usefastchecks", UseFastChecks);
appData.SetValue("relativedate", RelativeDate);
appData.SetValue("gitssh", GitCommands.GetSsh());
appData.SetValue("pullmerge", PullMerge);
appData.SetValue("autostash", AutoStash);
appData.SetValue("followrenamesinfilehistory", FollowRenamesInFileHistory);
appData.SetValue("plink", Plink);
appData.SetValue("puttygen", Puttygen);
appData.SetValue("pageant", Pageant);
appData.SetValue("smtp", Smtp);
appData.SetValue("dictionary", Dictionary);
appData.SetValue("commitinfoshowcontainedinbranches", CommitInfoShowContainedInBranches);
appData.SetValue("commitinfoshowcontainedintags", CommitInfoShowContainedInTags);
appData.SetValue("revisionGridQuickSearchTimeout", RevisionGridQuickSearchTimeout);
appData.SetValue("showgitstatusinbrowsetoolbar", ShowGitStatusInBrowseToolbar);
appData.SetValue("lastcommitmessage", LastCommitMessage);
appData.SetValue("showerrorswhenstagingfiles", ShowErrorsWhenStagingFiles);
appData.SetValue("revisiongraphdrawnonrelativesgray", RevisionGraphDrawNonRelativesGray);
}
catch (Exception ex)
{
MessageBox.Show("Could not save settings.\n\n" + ex.Message);
}
}