public bool ResetLauncher(string type) { switch (type) { case "MF": MFPath = ""; MFUsername = ""; MFPassword = ""; MFStartupArgumentList.Clear(); MFInstalledAddonList.Clear(); break; case "GF": GFPath = ""; GFStartupArgumentList.Clear(); GFInstalledAddonList.Clear(); break; } return(SaveConfig()); }
private void InitConfig() { var savedConfig = UtilHelper.ReadJsonFile(configFilePath); MFPath = (savedConfig["MFPath"] ?? "").ToString(); GFPath = (savedConfig["GFPath"] ?? "").ToString(); MFUsername = (savedConfig["MFUsername"] ?? "").ToString(); MFPassword = (savedConfig["MFPassword"] ?? "").ToString(); ExitOnStartup = (bool)(savedConfig["ExitOnStartup"] ?? true); CheckUpdateOnStartup = (bool)(savedConfig["CheckUpdateOnStartup"] ?? true); CheckAddonUpdateOnStartup = (bool)(savedConfig["CheckAddonUpdateOnStartup"] ?? true); var rawMFStartupArgumentList = savedConfig["MFStartupArgumentList"] == null ? new List <JToken>() : savedConfig["MFStartupArgumentList"].ToList(); rawMFStartupArgumentList.ForEach(item => { MFStartupArgumentList.Add(item.ToObject <StartupArgumentModel>()); }); var rawGFStartupArgumentList = savedConfig["GFStartupArgumentList"] == null ? new List <JToken>() : savedConfig["GFStartupArgumentList"].ToList(); rawGFStartupArgumentList.ForEach(item => { GFStartupArgumentList.Add(item.ToObject <StartupArgumentModel>()); }); var rawMFInstalledAddonList = savedConfig["MFInstalledAddonList"] == null ? new List <JToken>() : savedConfig["MFInstalledAddonList"].ToList(); rawMFInstalledAddonList.ForEach(item => { MFInstalledAddonList.Add(item.ToObject <InstalledAddonItemModel>()); }); var rawGFInstalledAddonList = savedConfig["GFInstalledAddonList"] == null ? new List <JToken>() : savedConfig["GFInstalledAddonList"].ToList(); rawGFInstalledAddonList.ForEach(item => { GFInstalledAddonList.Add(item.ToObject <InstalledAddonItemModel>()); }); }