internal static void Load() { try { if (string.IsNullOrEmpty(Settings.PathToSkyrim)) { return; } string path = $"{Settings.PathToSkyrim}\\version.json"; if (File.Exists(path)) { lock (sync) model = JsonConvert.DeserializeObject <ModVersionModel>(File.ReadAllText(path)); } else { model = new ModVersionModel(); } } catch (Exception e) { Logger.Error("Version_Load", e); model = new ModVersionModel(); } ExperimentalFunctions.Use("ModVerLoad", () => { if (model == null) { model = new ModVersionModel(); } }); }
internal static void Reset() { try { if (string.IsNullOrEmpty(Settings.PathToSkyrim)) { return; } string path = $"{Settings.PathToSkyrim}\\version.json"; lock (sync) if (File.Exists(path)) { File.Delete(path); } model = new ModVersionModel(); } catch (Exception e) { Logger.Error("Version_Reset", e); } }
internal static bool Load() { try { if (string.IsNullOrEmpty(Settings.PathToSkyrim)) { return(false); } string path = $"{Settings.PathToSkyrim}\\version.json"; if (File.Exists(path)) { lock (sync) model = JsonConvert.DeserializeObject <ModVersionModel>(File.ReadAllText(path)); } return(true); } catch (Exception e) { Logger.Error("Version_Load", e); return(false); } }