/// <summary> /// if not isAbsolute then path is the mods name /// </summary> public Manager(string path, bool isAbsolute, Func <T, bool> updateCallback = null, System.Action <T> loadedCallback = null) { this.updateCallback = updateCallback; this.loadedCallback = loadedCallback; bool errorFlag = false; string resultPath = null; if (isAbsolute) { resultPath = path; EnsureDirectoryExists(new FileInfo(resultPath).Directory.FullName); errorFlag = !Directory.Exists(new FileInfo(resultPath).Directory.FullName); } if (!isAbsolute || errorFlag) { resultPath = GetFallBackPath(path); EnsureDirectoryExists(new FileInfo(path).Directory.FullName); } this.StateFilePath = resultPath; this.JsonLoader = new JsonFileManager(new JsonManager()); UpdateVersion(); }
/// <summary> /// if not isAbsolute then path is the mods name /// </summary> public Manager(string path, Func <T, bool> updateCallback = null) { bool errorFlag = false; string resultPath = null; resultPath = path; EnsureDirectoryExists(new FileInfo(resultPath).Directory.FullName); errorFlag = !Directory.Exists(new FileInfo(resultPath).Directory.FullName); this.StateFilePath = resultPath; this.JsonLoader = new JsonFileManager(new JsonManager()); this.updateCallback = updateCallback; UpdateVersion(); }
//if not isAbsolute then path is the mods name public Manager(string path, bool isAbsolute) { bool errorFlag = false; string resultPath = null; if (isAbsolute) { resultPath = path; EnsureDirectoryExists(new FileInfo(resultPath).Directory.FullName); errorFlag = !Directory.Exists(new FileInfo(resultPath).Directory.FullName); } if (!isAbsolute || errorFlag) { resultPath = GetFallBackPath(path); EnsureDirectoryExists(new FileInfo(path).Directory.FullName); } this.StateFilePath = resultPath; this.JsonLoader = new JsonFileManager(new JsonManager()); UpdateVersion(); }