Ejemplo n.º 1
0
 public void UpdateLocalPatchVersion(PatchModel patch)
 {
     try
     {
         Setting.LocalConfig.Launcher.PatchVersion = patch.Version;
         Setting.LocalConfig.Launcher.Token        = cryption.Encrypt(patch.Version.ToString());
         var file = $"{settingDir}{settingFile}";
         File.WriteAllText(file, JsonConvert.SerializeObject(Setting.LocalConfig));
         ui.UpdateVersion();
     }
     catch (Exception ex)
     {
         Console.WriteLine($"*************MainController.UpdateLocalPatchVersion(): {ex.Message}");
         // If the file can't be wrotten , stop the program.
         UpdateState(State = StateCode.ErrorWritingFail);
         ui.AddMsg(ex.Message);
     }
 }