/// <summary> /// 加载客户端配置文件 /// </summary> public static UpdaterCore LoadClientConfig(this UpdaterCore updaterCore, bool isFixed = false) { string fileName = updaterCore.clientConfigPath; CheckAndGenerateClinetConfig(fileName, false); string clientConfigFromFile = FileHelper.ReadFromFile(fileName); try { updaterCore.clientConfig = JsonConvert.DeserializeObject <ClientConfig>(clientConfigFromFile); } catch (Exception) { if (!isFixed) { FixClientConfig(fileName); return(updaterCore.LoadClientConfig(true)); } throw; } return(updaterCore); }
/// <summary> /// 窗体加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Updater_Load(object sender, EventArgs e) { updaterCore.LoadClientConfig().GenerateDebugFolder(); //展示本地版本 this.CurrentVersionLabel.Text = updaterCore.clientConfig.CurrentVersion; }