/// <summary> /// Constructs an instance of UpdateManager requiring a tweaker settings class and a UI renderer class. /// </summary> /// <param name="settings"></param> /// <param name="output"></param> public UpdateManager(ITweakerSettings settings, ITrigger output) { this.Settings = settings; this.Output = output; // At the moment, the downloader is tightly coupled against this class. // In the future, downloader can be decoupled away in the very case where we have PSO2 private server running a patch server. this.Downloader = new SegaDownloader(output); }
/// <summary> /// Gets the value of the game client version. /// </summary> public static string GetGameVersion(this ITweakerSettings settings) { lock (GameVersionFileLock) { var path = settings.GetGameVersionFilePath(); if (!File.Exists(path)) { return(null); } return(File.ReadAllText(path)); } }
/// <summary> /// Sets the value of the game client version. /// </summary> /// <param name="settings"></param> /// <param name="version"></param> public static void SetGameVersion(this ITweakerSettings settings, string version) { lock (GameVersionFileLock) { var path = settings.GetGameVersionFilePath(); var dir = Path.GetDirectoryName(path); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } File.WriteAllText(path, version); } }
/// <summary> /// Constructs an instance of FanPatcher using given Tweaker settings and output triggers. /// </summary> /// <param name="settings"></param> /// <param name="triggers"></param> public FanPatcher(ITweakerSettings settings, ITrigger triggers) { this.Settings = settings; this.Triggers = triggers; }
#pragma warning restore RECS0154 // Parameter is never used /// <summary> /// Gets the path of the game version file. /// </summary> public static string GetGameVersionFilePath(this ITweakerSettings settings) { return(Path.Combine(settings.GetUserFolderPath(), "version.ver")); }
#pragma warning disable RECS0154 // Parameter is never used /// <summary> /// Gets the value of the PSO2 user profile folder. /// </summary> public static string GetUserFolderPath(this ITweakerSettings settings) { var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); return(Path.Combine(documents, @"SEGA\PHANTASYSTARONLINE2")); }
/// <summary> /// Gets the game file directory where the game asset files usually located in. /// </summary> public static string LicenseDirectory(this ITweakerSettings settings) { return(Path.Combine(settings.GameDirectory, @"data\license")); }
/// <summary> /// Gets the game file directory where the game asset files usually located in. /// </summary> public static string DataWin32Directory(this ITweakerSettings settings) { return(Path.Combine(settings.GameDirectory, @"data\win32")); }
/// <summary> /// Gets the known, usual Tweaker backup directory. /// </summary> public static string BackupDirectory(this ITweakerSettings settings) { return(Path.Combine(settings.DataWin32Directory(), "backup")); }