示例#1
0
 public static bool Save(string file = "")
 {
     if (file == "") file = ConfigFile;
     if (_configRoot == null) _configRoot = new DiGitConfig();
     try
     {
         _configRoot.Repositories = RepositoriesManager.Repos.ToArray();
         return SerializeHelper.Save(_configRoot, file);
     }
     catch (Exception ex)
     {
         ErrorHandler.Handle(ex, "Error while saving configuration file '{0}'", file);
         return false;
     }
 }
示例#2
0
 public static bool Load(string file = "", bool showErr = true)
 {
     if (file == "") file = ConfigFile;
     try
     {
         _configRoot = SerializeHelper.Load(typeof(DiGitConfig), file) as DiGitConfig;
         Upgrade();
         return true;
     }
     catch (Exception ex)
     {
         if (showErr)
             ErrorHandler.Handle(ex, "Error while loading configuration file '{0}'", file);
         return false;
     }
 }