From ae86b53147006bd58f69f9ed3ae6a0778ccec44e Mon Sep 17 00:00:00 2001 From: uduki Date: Tue, 20 Oct 2026 10:14:26 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=82=A4=E3=83=AB:=20?= =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=87=E3=82=A3=E3=83=B3=E3=82=B0=E8=A6=8F?= =?UTF-8?q?=E7=B4=84=E3=81=AB=E6=BA=96=E6=8B=A0=E3=81=97=E3=81=9F=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=83=95=E3=82=A9=E3=83=BC=E3=83=9E=E3=83=83?= =?UTF-8?q?=E3=83=88=E3=81=AE=E9=81=A9=E7=94=A8=EF=BC=88this.=E3=81=AE?= =?UTF-8?q?=E6=98=8E=E7=A4=BA=E3=80=81=E7=A9=BA=E7=99=BD=E3=82=B9=E3=82=BF?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=81=AE=E7=B5=B1=E4=B8=80=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 自インスタンスメンバーアクセスへの this. 付与(28ファイル) - .editorconfig に準拠したインデント・波括弧・空白スタイルの適用 - UTF-8 (BOMあり)、CRLF改行コード、行末空白除去の整合性検証 --- AddKeyDialog.xaml.cs | 22 +- ConfigDialog.xaml.cs | 44 +- Engines/Evb/EvbDetectionHelper.cs | 2 +- Engines/Evb/EvbEngineModule.cs | 2 +- Engines/Evb/EvbUnpackService.cs | 4 +- Engines/Nwjs/AsarArchiveService.cs | 32 +- .../IiniTitleRepair/GameIniTitleRepair.cs | 14 +- Engines/Rgss/RgssModService.cs | 19 +- Engines/Rgss/SrpgModService.cs | 24 +- Engines/Tkool/TkoolGameItem.cs | 502 +++---- Engines/Tkool/TkoolInjectionService.cs | 6 +- Engines/Tkool/TkoolModService.cs | 34 +- Engines/Tkool/TkoolResourceRepairService.cs | 4 +- Engines/Unity/UnityGameItem.cs | 64 +- Engines/Unity/UnitySaveItem.cs | 74 +- Engines/Unity/UnitySaveManagerService.cs | 18 +- Engines/Wolf/WolfArchiveService.cs | 2 +- Engines/Wolf/WolfModService.cs | 6 +- Engines/Wolf/WolfSaveService.cs | 12 +- MainWindow.xaml.cs | 1155 ++++++++--------- Models/GameItemBase.cs | 76 +- Models/ModPluginDefinition.cs | 8 +- Models/SaveDataPropertyEntry.cs | 32 +- SaveEditorWindow.xaml.cs | 322 ++--- Services/Codecs/EasySave3Codec.cs | 20 +- Services/GameScannerService.cs | 114 +- Services/WindowResizeService.cs | 4 +- WolfSaveEditorDialog.xaml.cs | 126 +- 28 files changed, 1362 insertions(+), 1380 deletions(-) diff --git a/AddKeyDialog.xaml.cs b/AddKeyDialog.xaml.cs index 0632752..126d5d8 100644 --- a/AddKeyDialog.xaml.cs +++ b/AddKeyDialog.xaml.cs @@ -16,37 +16,37 @@ namespace GameLauncher public AddKeyDialog() { - InitializeComponent(); - txtKeyName.Focus(); + this.InitializeComponent(); + this.txtKeyName.Focus(); } private void btnOk_Click(object sender, RoutedEventArgs e) { - var keyName = txtKeyName.Text.Trim(); + var keyName = this.txtKeyName.Text.Trim(); if (string.IsNullOrWhiteSpace(keyName)) { MessageBox.Show("キー名を入力してください。", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Warning); return; } - KeyName = keyName; - var selectedTag = (cmbKeyType.SelectedItem as ComboBoxItem)?.Tag?.ToString(); - KeyType = selectedTag switch + this.KeyName = keyName; + var selectedTag = (this.cmbKeyType.SelectedItem as ComboBoxItem)?.Tag?.ToString(); + this.KeyType = selectedTag switch { "Float" => PlayerPrefsType.Float, "String" => PlayerPrefsType.String, _ => PlayerPrefsType.Int }; - KeyValue = txtKeyValue.Text; + this.KeyValue = this.txtKeyValue.Text; - DialogResult = true; - Close(); + this.DialogResult = true; + this.Close(); } private void btnCancel_Click(object sender, RoutedEventArgs e) { - DialogResult = false; - Close(); + this.DialogResult = false; + this.Close(); } } } diff --git a/ConfigDialog.xaml.cs b/ConfigDialog.xaml.cs index 2403368..f4a7ef8 100644 --- a/ConfigDialog.xaml.cs +++ b/ConfigDialog.xaml.cs @@ -19,14 +19,14 @@ namespace GameLauncher public ConfigDialog(LauncherConfig config) { - InitializeComponent(); - _config = config; + this.InitializeComponent(); + this._config = config; - txtRgssExtractorPath.Text = _config.RgssExtractorPath ?? @"C:\Soft\RGSS-Extractor-v1.0\RGSS Extractor.exe"; - txtWolfExtractorPath.Text = _config.WolfExtractorPath ?? string.Empty; - txtWindowResizeToolPath.Text = _config.WindowResizeToolPath ?? string.Empty; - txtBackupsPath.Text = AppPathHelper.GetBackupsDirectory(); - chkDefaultApplyMod.IsChecked = _config.DefaultApplyMod; + this.txtRgssExtractorPath.Text = this._config.RgssExtractorPath ?? @"C:\Soft\RGSS-Extractor-v1.0\RGSS Extractor.exe"; + this.txtWolfExtractorPath.Text = this._config.WolfExtractorPath ?? string.Empty; + this.txtWindowResizeToolPath.Text = this._config.WindowResizeToolPath ?? string.Empty; + this.txtBackupsPath.Text = AppPathHelper.GetBackupsDirectory(); + this.chkDefaultApplyMod.IsChecked = this._config.DefaultApplyMod; } private void btnBrowseExtractor_Click(object sender, RoutedEventArgs e) @@ -38,7 +38,7 @@ namespace GameLauncher FileName = "RGSS Extractor.exe" }; - var currentDir = Path.GetDirectoryName(txtRgssExtractorPath.Text); + var currentDir = Path.GetDirectoryName(this.txtRgssExtractorPath.Text); if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir)) { ofd.InitialDirectory = currentDir; @@ -46,7 +46,7 @@ namespace GameLauncher if (ofd.ShowDialog() == true) { - txtRgssExtractorPath.Text = ofd.FileName; + this.txtRgssExtractorPath.Text = ofd.FileName; } } @@ -59,7 +59,7 @@ namespace GameLauncher FileName = "UberWolfCli.exe" }; - var currentDir = Path.GetDirectoryName(txtWolfExtractorPath.Text); + var currentDir = Path.GetDirectoryName(this.txtWolfExtractorPath.Text); if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir)) { ofd.InitialDirectory = currentDir; @@ -67,7 +67,7 @@ namespace GameLauncher if (ofd.ShowDialog() == true) { - txtWolfExtractorPath.Text = ofd.FileName; + this.txtWolfExtractorPath.Text = ofd.FileName; } } @@ -80,7 +80,7 @@ namespace GameLauncher FileName = "Sizer.exe" }; - var currentDir = Path.GetDirectoryName(txtWindowResizeToolPath.Text); + var currentDir = Path.GetDirectoryName(this.txtWindowResizeToolPath.Text); if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir)) { ofd.InitialDirectory = currentDir; @@ -88,7 +88,7 @@ namespace GameLauncher if (ofd.ShowDialog() == true) { - txtWindowResizeToolPath.Text = ofd.FileName; + this.txtWindowResizeToolPath.Text = ofd.FileName; } } @@ -111,19 +111,19 @@ namespace GameLauncher private void btnSave_Click(object sender, RoutedEventArgs e) { - _config.RgssExtractorPath = txtRgssExtractorPath.Text.Trim(); - _config.WolfExtractorPath = txtWolfExtractorPath.Text.Trim(); - _config.WindowResizeToolPath = txtWindowResizeToolPath.Text.Trim(); - _config.DefaultApplyMod = chkDefaultApplyMod.IsChecked == true; - IsSaved = true; - DialogResult = true; - Close(); + this._config.RgssExtractorPath = this.txtRgssExtractorPath.Text.Trim(); + this._config.WolfExtractorPath = this.txtWolfExtractorPath.Text.Trim(); + this._config.WindowResizeToolPath = this.txtWindowResizeToolPath.Text.Trim(); + this._config.DefaultApplyMod = this.chkDefaultApplyMod.IsChecked == true; + this.IsSaved = true; + this.DialogResult = true; + this.Close(); } private void btnCancel_Click(object sender, RoutedEventArgs e) { - DialogResult = false; - Close(); + this.DialogResult = false; + this.Close(); } } } diff --git a/Engines/Evb/EvbDetectionHelper.cs b/Engines/Evb/EvbDetectionHelper.cs index fe8e165..fc6350c 100644 --- a/Engines/Evb/EvbDetectionHelper.cs +++ b/Engines/Evb/EvbDetectionHelper.cs @@ -29,7 +29,7 @@ namespace GameLauncher.Engines.Evb private const string EnigmaSecondarySection = ".enigma2"; /// EVB virtual filesystem header magic ("EVB\0"). - private static readonly byte[] EvbMagic = { 0x45, 0x56, 0x42, 0x00 }; + private static readonly byte[] EvbMagic = [0x45, 0x56, 0x42, 0x00]; /// Returns true when the given executable is packed with EVB and can be unpacked. /// diff --git a/Engines/Evb/EvbEngineModule.cs b/Engines/Evb/EvbEngineModule.cs index 085c008..894c988 100644 --- a/Engines/Evb/EvbEngineModule.cs +++ b/Engines/Evb/EvbEngineModule.cs @@ -34,7 +34,7 @@ namespace GameLauncher.Engines.Evb /// public string ResolveToolPath(string toolFileName) - => AppPathHelperBridge.Resolve(EngineName, toolFileName); + => AppPathHelperBridge.Resolve(this.EngineName, toolFileName); } /// diff --git a/Engines/Evb/EvbUnpackService.cs b/Engines/Evb/EvbUnpackService.cs index 5c126ce..8be918f 100644 --- a/Engines/Evb/EvbUnpackService.cs +++ b/Engines/Evb/EvbUnpackService.cs @@ -79,7 +79,7 @@ namespace GameLauncher.Engines.Evb try { // Preferred names commonly used by NW.js / RPG Maker / Tyrano bundles. - string[] preferred = { "Game.exe", "game.exe", "nw.exe", "Game_boxed.exe" }; + string[] preferred = ["Game.exe", "game.exe", "nw.exe", "Game_boxed.exe"]; foreach (var name in preferred) { var direct = Path.Combine(outputDirectory, name); @@ -302,7 +302,7 @@ namespace GameLauncher.Engines.Evb { foreach (var backup in Directory.GetFiles(gameRootDir, "*" + ExeBackupSuffix)) { - var original = backup.Substring(0, backup.Length - ExeBackupSuffix.Length); + var original = backup[..^ExeBackupSuffix.Length]; if (!File.Exists(original)) { File.Move(backup, original); diff --git a/Engines/Nwjs/AsarArchiveService.cs b/Engines/Nwjs/AsarArchiveService.cs index f39fdbc..3b1e89b 100644 --- a/Engines/Nwjs/AsarArchiveService.cs +++ b/Engines/Nwjs/AsarArchiveService.cs @@ -170,7 +170,7 @@ namespace GameLauncher.Engines.Nwjs long packageJsonOffset = -1; long packageJsonSize = -1; - TraverseFiles(filesRoot, "", dataOffset, fs.Length, result, includeFileList, + this.TraverseFiles(filesRoot, "", dataOffset, fs.Length, result, includeFileList, ref systemJsonRelative, ref systemJsonOffset, ref systemJsonSize, ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize); @@ -274,7 +274,7 @@ namespace GameLauncher.Engines.Nwjs if (val.TryGetProperty("files", out var subFiles)) { - TraverseFiles(subFiles, path, dataOffset, fileLength, result, includeFileList, + this.TraverseFiles(subFiles, path, dataOffset, fileLength, result, includeFileList, ref systemJsonRelative, ref systemJsonOffset, ref systemJsonSize, ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize); } @@ -395,7 +395,7 @@ namespace GameLauncher.Engines.Nwjs // UNC パス (例: \\server\share\...) の場合 if (normalized.StartsWith(@"\\", StringComparison.Ordinal)) { - return @"\\?\UNC\" + normalized.Substring(2); + return @"\\?\UNC\" + normalized[2..]; } // 相対パスの場合は安全に絶対パスを取得してからプレフィックスを付与 @@ -408,7 +408,7 @@ namespace GameLauncher.Engines.Nwjs } if (full.StartsWith(@"\\", StringComparison.Ordinal)) { - return @"\\?\UNC\" + full.Substring(2); + return @"\\?\UNC\" + full[2..]; } return @"\\?\" + full; } @@ -447,7 +447,7 @@ namespace GameLauncher.Engines.Nwjs } // ヘッダ詳細解析 - var inspect = InspectAsar(targetAsar, includeFileList: true); + var inspect = this.InspectAsar(targetAsar, includeFileList: true); if (!inspect.IsValid || inspect.FileEntries.Count == 0) { return (false, "asar ファイルのヘッダ解析に失敗したか、ファイルが含まれていません。"); @@ -503,20 +503,18 @@ namespace GameLauncher.Engines.Nwjs fs.Seek(dataOffset + entry.Offset, SeekOrigin.Begin); long remaining = entry.Size; - using (var outFs = new FileStream(destFilePath, FileMode.Create, FileAccess.Write, FileShare.None)) + using var outFs = new FileStream(destFilePath, FileMode.Create, FileAccess.Write, FileShare.None); + while (remaining > 0) { - while (remaining > 0) - { - int toRead = (int)Math.Min(remaining, buffer.Length); - int read = fs.Read(buffer, 0, toRead); - if (read == 0) break; + int toRead = (int)Math.Min(remaining, buffer.Length); + int read = fs.Read(buffer, 0, toRead); + if (read == 0) break; - outFs.Write(buffer, 0, read); - remaining -= read; - extractedBytes += read; + outFs.Write(buffer, 0, read); + remaining -= read; + extractedBytes += read; - progress?.Report((extractedBytes, totalBytes, i + 1, totalFiles, Path.GetFileName(entry.RelativePath))); - } + progress?.Report((extractedBytes, totalBytes, i + 1, totalFiles, Path.GetFileName(entry.RelativePath))); } } catch (Exception fileEx) @@ -573,7 +571,7 @@ namespace GameLauncher.Engines.Nwjs : asarPath + AsarBackupSuffix; var originalAsar = asarPath.EndsWith(AsarBackupSuffix, StringComparison.OrdinalIgnoreCase) - ? asarPath.Substring(0, asarPath.Length - AsarBackupSuffix.Length) + ? asarPath[..^AsarBackupSuffix.Length] : asarPath; string extExtractedDir = ToExtendedPath(extractedDir); diff --git a/Engines/Rgss/Games/IiniTitleRepair/GameIniTitleRepair.cs b/Engines/Rgss/Games/IiniTitleRepair/GameIniTitleRepair.cs index cc2538b..1a1c0bb 100644 --- a/Engines/Rgss/Games/IiniTitleRepair/GameIniTitleRepair.cs +++ b/Engines/Rgss/Games/IiniTitleRepair/GameIniTitleRepair.cs @@ -52,7 +52,7 @@ namespace GameLauncher.Engines.Rgss.Games.IiniTitleRepair var trim = line.Trim(); if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase)) { - var val = trim.Substring(6).Trim(); + var val = trim[6..].Trim(); if (!string.IsNullOrWhiteSpace(val) && !val.Contains('\uFFFD')) { tg.Title = val; @@ -73,23 +73,23 @@ namespace GameLauncher.Engines.Rgss.Games.IiniTitleRepair { try { - if (!File.Exists(filePath)) return Array.Empty(); + if (!File.Exists(filePath)) return []; byte[] bytes = File.ReadAllBytes(filePath); - if (bytes.Length == 0) return Array.Empty(); + if (bytes.Length == 0) return []; // 1. UTF-8 BOM (EF BB BF) if (bytes.Length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) { var text = System.Text.Encoding.UTF8.GetString(bytes, 3, bytes.Length - 3); - return text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + return text.Split(["\r\n", "\r", "\n"], StringSplitOptions.None); } // 2. UTF-16 LE BOM (FF FE) if (bytes.Length >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE) { var text = System.Text.Encoding.Unicode.GetString(bytes, 2, bytes.Length - 2); - return text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + return text.Split(["\r\n", "\r", "\n"], StringSplitOptions.None); } // 3. Shift_JIS (CP932) @@ -104,11 +104,11 @@ namespace GameLauncher.Engines.Rgss.Games.IiniTitleRepair } var decoded = encoding.GetString(bytes); - return decoded.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); + return decoded.Split(["\r\n", "\r", "\n"], StringSplitOptions.None); } catch { - return Array.Empty(); + return []; } } } diff --git a/Engines/Rgss/RgssModService.cs b/Engines/Rgss/RgssModService.cs index da1b1cf..0eb1be2 100644 --- a/Engines/Rgss/RgssModService.cs +++ b/Engines/Rgss/RgssModService.cs @@ -415,11 +415,11 @@ namespace GameLauncher.Engines.Rgss { if (game.ApplyMod) { - return await ApplyModAsync(game, pluginSettings, rgssExtractorPath); + return await this.ApplyModAsync(game, pluginSettings, rgssExtractorPath); } else { - return RestoreOriginal(game); + return this.RestoreOriginal(game); } } @@ -439,7 +439,7 @@ namespace GameLauncher.Engines.Rgss // 1. スクリプトファイルが存在しない場合(RGSS暗号化アーカイブ内の場合)、自動抽出 if (string.IsNullOrEmpty(scriptsPath) || !File.Exists(scriptsPath)) { - var (extractSuccess, extractMsg) = await ExtractScriptsAsync(game, rgssExtractorPath); + var (extractSuccess, extractMsg) = await this.ExtractScriptsAsync(game, rgssExtractorPath); if (!extractSuccess) { return (false, $"スクリプトの抽出に失敗したため改造を適用できませんでした: {extractMsg}"); @@ -819,14 +819,13 @@ namespace GameLauncher.Engines.Rgss if (parserType != null) { var parser = Activator.CreateInstance(parserType); - var parseFileMethod = parserType.GetMethod("parse_file", new[] { typeof(string) }); + var parseFileMethod = parserType.GetMethod("parse_file", [typeof(string)]); var getFileDataMethod = parserType.GetMethod("get_filedata"); var closeFileMethod = parserType.GetMethod("close_file"); if (parseFileMethod != null && getFileDataMethod != null && parser != null) { - var entries = parseFileMethod.Invoke(parser, new object[] { archivePath }) as System.Collections.IEnumerable; - if (entries != null) + if (parseFileMethod.Invoke(parser, [archivePath]) is System.Collections.IEnumerable entries) { foreach (var entry in entries) { @@ -839,8 +838,7 @@ namespace GameLauncher.Engines.Rgss (entryName.EndsWith(targetFileName, StringComparison.OrdinalIgnoreCase) || Path.GetFileName(entryName).Equals(targetFileName, StringComparison.OrdinalIgnoreCase))) { - var fileBytes = getFileDataMethod.Invoke(parser, new object[] { entry }) as byte[]; - if (fileBytes != null && fileBytes.Length > 0) + if (getFileDataMethod.Invoke(parser, [entry]) is byte[] fileBytes && fileBytes.Length > 0) { closeFileMethod?.Invoke(parser, null); @@ -873,10 +871,7 @@ namespace GameLauncher.Engines.Rgss }; using var proc = Process.Start(psi); - if (proc != null) - { - proc.WaitForExit(30000); // 最大30秒待機 - } + proc?.WaitForExit(30000); // 最大30秒待機 // RGSS Extractor はツール自身のフォルダ配下に Data\Scripts.rvdata2 等を出力 var possibleOutput = Path.Combine(toolDir, "Data", targetFileName); diff --git a/Engines/Rgss/SrpgModService.cs b/Engines/Rgss/SrpgModService.cs index 2842bcd..0448314 100644 --- a/Engines/Rgss/SrpgModService.cs +++ b/Engines/Rgss/SrpgModService.cs @@ -513,7 +513,7 @@ namespace GameLauncher.Engines.Rgss int endIdx = content.IndexOf(ModEndTag, StringComparison.Ordinal); if (endIdx > startIdx) { - content = content.Substring(0, startIdx).TrimEnd() + "\n\n" + modCode + "\n"; + content = content[..startIdx].TrimEnd() + "\n\n" + modCode + "\n"; File.WriteAllText(scriptPath, content, Encoding.UTF8); return; } @@ -562,7 +562,7 @@ namespace GameLauncher.Engines.Rgss if (!SrpgArchiveService.IsExtracted(gameDir)) { progress?.Report("アーカイブ(data.dts)を初回展開中..."); - var unpackRes = await _archiveService.UnpackDataDtsAsync(gameDir, progress); + var unpackRes = await this._archiveService.UnpackDataDtsAsync(gameDir, progress); if (!unpackRes.Success) { return unpackRes; @@ -571,7 +571,7 @@ namespace GameLauncher.Engines.Rgss var extractedDir = SrpgArchiveService.GetExtractedDirectory(gameDir); progress?.Report("Modスクリプトを生成中..."); - var modBody = GenerateModScript(item); + var modBody = this.GenerateModScript(item); var jsContent = $"{ModStartTag}\n{modBody}\n{ModEndTag}"; // 2. 既存のスクリプトへ注入 @@ -604,7 +604,7 @@ namespace GameLauncher.Engines.Rgss // 3. data.dts を再パック progress?.Report("Modを適用した data.dts を再構築中..."); - var repackRes = await _archiveService.RepackDataDtsAsync(gameDir, progress); + var repackRes = await this._archiveService.RepackDataDtsAsync(gameDir, progress); if (repackRes.Success) { item.IsModded = true; @@ -658,8 +658,8 @@ namespace GameLauncher.Engines.Rgss // 2. バックアップが存在すればバックアップ復元を試行 progress?.Report("オリジナルバックアップから data.dts を復元中..."); - var revertRes = await _archiveService.RevertBackupAsync(gameDir); - if (revertRes.Success) + var (Success, Message) = await this._archiveService.RevertBackupAsync(gameDir); + if (Success) { item.IsModded = false; return (true, "改造プラグインを解除し、元のアーカイブへ復元しました。"); @@ -667,7 +667,7 @@ namespace GameLauncher.Engines.Rgss // バックアップが無い場合は Mod解除状態で再パック progress?.Report("Mod解除状態でアーカイブを再構築中..."); - var repackRes = await _archiveService.RepackDataDtsAsync(gameDir, progress); + var repackRes = await this._archiveService.RepackDataDtsAsync(gameDir, progress); if (repackRes.Success) { item.IsModded = false; @@ -689,7 +689,7 @@ namespace GameLauncher.Engines.Rgss // 1. プロキシDLL解除 if (IsProxyDllEnabled(gameDir)) { - DisableProxyDll(gameDir); + this.DisableProxyDll(gameDir); logs.Add("・プロキシDLL (version.dll) を解除しました"); } @@ -726,10 +726,10 @@ namespace GameLauncher.Engines.Rgss // 3. バックアップからの data.dts 復元 progress?.Report("バックアップから元の data.dts を復元中..."); - var revertRes = await _archiveService.RevertBackupAsync(gameDir); - if (revertRes.Success) + var (Success, Message) = await this._archiveService.RevertBackupAsync(gameDir); + if (Success) { - logs.Add($"・{revertRes.Message}"); + logs.Add($"・{Message}"); } else { @@ -737,7 +737,7 @@ namespace GameLauncher.Engines.Rgss } // 4. 解凍フォルダの退避 - var restoreExtractedRes = _archiveService.RestoreExtractedState(gameDir); + var restoreExtractedRes = this._archiveService.RestoreExtractedState(gameDir); if (restoreExtractedRes.Success && !restoreExtractedRes.Message.Contains("存在しません")) { logs.Add($"・{restoreExtractedRes.Message}"); diff --git a/Engines/Tkool/TkoolGameItem.cs b/Engines/Tkool/TkoolGameItem.cs index b552ed3..e518366 100644 --- a/Engines/Tkool/TkoolGameItem.cs +++ b/Engines/Tkool/TkoolGameItem.cs @@ -28,62 +28,62 @@ namespace GameLauncher.Engines.Tkool public bool SpeedUp { - get => _speedUp; - set { if (_speedUp != value) { _speedUp = value; OnPropertyChanged(); } } + get => this._speedUp; + set { if (this._speedUp != value) { this._speedUp = value; this.OnPropertyChanged(); } } } public bool AntigravityGameTweaks { - get => _antigravityGameTweaks; - set { if (_antigravityGameTweaks != value) { _antigravityGameTweaks = value; OnPropertyChanged(); } } + get => this._antigravityGameTweaks; + set { if (this._antigravityGameTweaks != value) { this._antigravityGameTweaks = value; this.OnPropertyChanged(); } } } public bool DropItem99 { - get => _dropItem99; - set { if (_dropItem99 != value) { _dropItem99 = value; OnPropertyChanged(); } } + get => this._dropItem99; + set { if (this._dropItem99 != value) { this._dropItem99 = value; this.OnPropertyChanged(); } } } public bool TurnStartFullRecover { - get => _turnStartFullRecover; - set { if (_turnStartFullRecover != value) { _turnStartFullRecover = value; OnPropertyChanged(); } } + get => this._turnStartFullRecover; + set { if (this._turnStartFullRecover != value) { this._turnStartFullRecover = value; this.OnPropertyChanged(); } } } public bool TurnStartFullRecoverHp { - get => _turnStartFullRecoverHp; - set { if (_turnStartFullRecoverHp != value) { _turnStartFullRecoverHp = value; OnPropertyChanged(); } } + get => this._turnStartFullRecoverHp; + set { if (this._turnStartFullRecoverHp != value) { this._turnStartFullRecoverHp = value; this.OnPropertyChanged(); } } } public bool TurnStartFullRecoverMp { - get => _turnStartFullRecoverMp; - set { if (_turnStartFullRecoverMp != value) { _turnStartFullRecoverMp = value; OnPropertyChanged(); } } + get => this._turnStartFullRecoverMp; + set { if (this._turnStartFullRecoverMp != value) { this._turnStartFullRecoverMp = value; this.OnPropertyChanged(); } } } public bool TurnStartFullRecoverTp { - get => _turnStartFullRecoverTp; - set { if (_turnStartFullRecoverTp != value) { _turnStartFullRecoverTp = value; OnPropertyChanged(); } } + get => this._turnStartFullRecoverTp; + set { if (this._turnStartFullRecoverTp != value) { this._turnStartFullRecoverTp = value; this.OnPropertyChanged(); } } } public bool MaxGainGold { - get => _maxGainGold; - set { if (_maxGainGold != value) { _maxGainGold = value; OnPropertyChanged(); } } + get => this._maxGainGold; + set { if (this._maxGainGold != value) { this._maxGainGold = value; this.OnPropertyChanged(); } } } public bool MaxGainExp { - get => _maxGainExp; - set { if (_maxGainExp != value) { _maxGainExp = value; OnPropertyChanged(); } } + get => this._maxGainExp; + set { if (this._maxGainExp != value) { this._maxGainExp = value; this.OnPropertyChanged(); } } } public bool InstantMessage { - get => _instantMessage; - set { if (_instantMessage != value) { _instantMessage = value; OnPropertyChanged(); } } + get => this._instantMessage; + set { if (this._instantMessage != value) { this._instantMessage = value; this.OnPropertyChanged(); } } } public event System.ComponentModel.PropertyChangedEventHandler? PropertyChanged; @@ -133,22 +133,22 @@ namespace GameLauncher.Engines.Tkool /// Enigma Virtual Box でパックされた exe を持つゲームかどうか public override bool IsEvbPacked { - get => _isEvbPacked; + get => this._isEvbPacked; set { - if (_isEvbPacked != value) + if (this._isEvbPacked != value) { - _isEvbPacked = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(IsEvb)); - OnPropertyChanged(nameof(EvbBadgeVisibility)); - OnPropertyChanged(nameof(EvbBadgeText)); - OnPropertyChanged(nameof(EvbNeedsUnpackVisibility)); - OnPropertyChanged(nameof(EvbNeedsUnpackBadgeText)); - OnPropertyChanged(nameof(EvbExtractedVisibility)); - OnPropertyChanged(nameof(EvbExtractedBadgeText)); - OnPropertyChanged(nameof(EvbDetailStatusText)); - OnPropertyChanged(nameof(IsEvbToolMissing)); + this._isEvbPacked = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.IsEvb)); + this.OnPropertyChanged(nameof(this.EvbBadgeVisibility)); + this.OnPropertyChanged(nameof(this.EvbBadgeText)); + this.OnPropertyChanged(nameof(this.EvbNeedsUnpackVisibility)); + this.OnPropertyChanged(nameof(this.EvbNeedsUnpackBadgeText)); + this.OnPropertyChanged(nameof(this.EvbExtractedVisibility)); + this.OnPropertyChanged(nameof(this.EvbExtractedBadgeText)); + this.OnPropertyChanged(nameof(this.EvbDetailStatusText)); + this.OnPropertyChanged(nameof(this.IsEvbToolMissing)); } } } @@ -156,20 +156,20 @@ namespace GameLauncher.Engines.Tkool /// EVB 解凍済み(_evb_extracted に出力済み)かどうか public override bool IsEvbExtracted { - get => _isEvbExtracted; + get => this._isEvbExtracted; set { - if (_isEvbExtracted != value) + if (this._isEvbExtracted != value) { - _isEvbExtracted = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(EvbBadgeVisibility)); - OnPropertyChanged(nameof(EvbBadgeText)); - OnPropertyChanged(nameof(EvbNeedsUnpackVisibility)); - OnPropertyChanged(nameof(EvbNeedsUnpackBadgeText)); - OnPropertyChanged(nameof(EvbExtractedVisibility)); - OnPropertyChanged(nameof(EvbExtractedBadgeText)); - OnPropertyChanged(nameof(EvbDetailStatusText)); + this._isEvbExtracted = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.EvbBadgeVisibility)); + this.OnPropertyChanged(nameof(this.EvbBadgeText)); + this.OnPropertyChanged(nameof(this.EvbNeedsUnpackVisibility)); + this.OnPropertyChanged(nameof(this.EvbNeedsUnpackBadgeText)); + this.OnPropertyChanged(nameof(this.EvbExtractedVisibility)); + this.OnPropertyChanged(nameof(this.EvbExtractedBadgeText)); + this.OnPropertyChanged(nameof(this.EvbDetailStatusText)); } } } @@ -177,76 +177,76 @@ namespace GameLauncher.Engines.Tkool /// EVB 解凍先ディレクトリ(ゲームフォルダ内 _evb_extracted) public string? EvbExtractedDirPath { - get => _evbExtractedDirPath; - set { if (_evbExtractedDirPath != value) { _evbExtractedDirPath = value; OnPropertyChanged(); } } + get => this._evbExtractedDirPath; + set { if (this._evbExtractedDirPath != value) { this._evbExtractedDirPath = value; this.OnPropertyChanged(); } } } /// EVB 解凍時に作成した元 exe のバックアップパス(*.glbak) public string? EvbBackupPath { - get => _evbBackupPath; - set { if (_evbBackupPath != value) { _evbBackupPath = value; OnPropertyChanged(); } } + get => this._evbBackupPath; + set { if (this._evbBackupPath != value) { this._evbBackupPath = value; this.OnPropertyChanged(); } } } /// EVB 解凍後に再判定された本来のエンジン名 public string EvbUnderlyingEngine { - get => _evbUnderlyingEngine; - set { if (_evbUnderlyingEngine != value) { _evbUnderlyingEngine = value; OnPropertyChanged(); OnPropertyChanged(nameof(EvbDetailStatusText)); } } + get => this._evbUnderlyingEngine; + set { if (this._evbUnderlyingEngine != value) { this._evbUnderlyingEngine = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.EvbDetailStatusText)); } } } /// EVB として扱うか(UI バッジ判定用) - public override bool IsEvb => IsEvbPacked; + public override bool IsEvb => this.IsEvbPacked; /// EVB バッジの可視性(実際にEVBで圧縮され解凍・管理対象のもののみ Visible) - public override Visibility EvbBadgeVisibility => IsEvbPacked ? Visibility.Visible : Visibility.Collapsed; + public override Visibility EvbBadgeVisibility => this.IsEvbPacked ? Visibility.Visible : Visibility.Collapsed; /// /// EVB バッジのテキスト。実際に Enigma Virtual Box でパックされているゲームのみ "EVB" を返し、 /// それ以外は空文字を返してバッジを非表示にする。 /// - public override string EvbBadgeText => IsEvbPacked ? "EVB" : string.Empty; + public override string EvbBadgeText => this.IsEvbPacked ? "EVB" : string.Empty; /// /// EVB「要解凍」バッジのテキスト。未解凍のときだけ "要解凍" を返し、それ以外は空文字を返す。 /// バッジはテキスト駆動(StringNotEmptyToVisibilityConverter)で表示制御されるため、 /// 無関係なゲームで空のバッジが描画されることはない。 /// - public override string EvbNeedsUnpackBadgeText => (IsEvbPacked && !IsEvbExtracted) ? "要解凍" : string.Empty; + public override string EvbNeedsUnpackBadgeText => (this.IsEvbPacked && !this.IsEvbExtracted) ? "要解凍" : string.Empty; /// EVB 未解凍のときだけ「要解凍」を強調表示するための可視性(一目で分かる導線) - public override Visibility EvbNeedsUnpackVisibility => (IsEvbPacked && !IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed; + public override Visibility EvbNeedsUnpackVisibility => (this.IsEvbPacked && !this.IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed; /// EVB 解凍済みのときだけ「解凍済み」ラベルを表示するための可視性(一目で分かる導線) - public override Visibility EvbExtractedVisibility => (IsEvbPacked && IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed; + public override Visibility EvbExtractedVisibility => (this.IsEvbPacked && this.IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed; /// /// EVB「解凍済み」ラベルのテキスト。EVB パック済みかつ解凍済みのときだけ "解凍済み" を返し、 /// それ以外は空文字を返して非表示にする。 /// - public override string EvbExtractedBadgeText => (IsEvbPacked && IsEvbExtracted) ? "解凍済み" : string.Empty; + public override string EvbExtractedBadgeText => (this.IsEvbPacked && this.IsEvbExtracted) ? "解凍済み" : string.Empty; /// /// Evb 解凍ツール(evbunpack.exe)が未配置かどうか。 /// 選択時のガイドで「README.md を参照してください」と案内するために使用します。 /// - public bool IsEvbToolMissing => IsEvbPacked && !Engines.Evb.EvbUnpackerToolProvider.IsAvailable(); + public bool IsEvbToolMissing => this.IsEvbPacked && !Engines.Evb.EvbUnpackerToolProvider.IsAvailable(); /// EVB 詳細状態テキスト public override string EvbDetailStatusText { get { - if (!IsEvbPacked) + if (!this.IsEvbPacked) { return string.Empty; } - var engine = string.IsNullOrWhiteSpace(EvbUnderlyingEngine) ? "未判定" : EvbUnderlyingEngine; - if (IsEvbToolMissing) + var engine = string.IsNullOrWhiteSpace(this.EvbUnderlyingEngine) ? "未判定" : this.EvbUnderlyingEngine; + if (this.IsEvbToolMissing) { return "evbunpack.exe が未配置です。Engines/Evb/Tools/evbunpack/README.md を参照してください。"; } - return IsEvbExtracted + return this.IsEvbExtracted ? $"Enigma Virtual Box パック済み(解凍済み / 本来: {engine})" : $"Enigma Virtual Box パック済み(未解凍 / 本来: {engine})"; } @@ -259,15 +259,15 @@ namespace GameLauncher.Engines.Tkool /// public string ResolveLaunchExecutable() { - if (!IsEvbPacked || !IsEvbExtracted) + if (!this.IsEvbPacked || !this.IsEvbExtracted) { - return ExecutablePath; + return this.ExecutablePath; } // 解凍先フォルダを決定する(保存済みパスが無ければゲームフォルダ配下から解決)。 - var outputDir = !string.IsNullOrEmpty(EvbExtractedDirPath) - ? EvbExtractedDirPath! - : GameLauncher.Engines.Evb.EvbUnpackService.GetExtractedDir(RootDirectory); + var outputDir = !string.IsNullOrEmpty(this.EvbExtractedDirPath) + ? this.EvbExtractedDirPath! + : GameLauncher.Engines.Evb.EvbUnpackService.GetExtractedDir(this.RootDirectory); // ExecutablePath が空の場合でも、解凍完了マーカーを確認したうえで // 解凍後の exe を起動対象として復元する(再スキャン直後の起動失敗対策)。 @@ -277,27 +277,27 @@ namespace GameLauncher.Engines.Tkool return exe!; } - return ExecutablePath; + return this.ExecutablePath; } /// FOSSIL形態(FOSSILindex.html + 単体Game.exe、data/System.json はディスク上)かどうか public bool IsFossilSingleExe { - get => _isFossilSingleExe; - set { if (_isFossilSingleExe != value) { _isFossilSingleExe = value; OnPropertyChanged(); } } + get => this._isFossilSingleExe; + set { if (this._isFossilSingleExe != value) { this._isFossilSingleExe = value; this.OnPropertyChanged(); } } } /// boxed形態(ゲーム本体をexeへ内包、例: Game_boxed.exe)かどうか public bool IsBoxedExe { - get => _isBoxedExe; - set { if (_isBoxedExe != value) { _isBoxedExe = value; OnPropertyChanged(); } } + get => this._isBoxedExe; + set { if (this._isBoxedExe != value) { this._isBoxedExe = value; this.OnPropertyChanged(); } } } /// いずれかの単体exe梱包形態(FOSSIL / boxed)かどうか - public bool IsStandaloneExePackage => IsFossilSingleExe || IsBoxedExe; + public bool IsStandaloneExePackage => this.IsFossilSingleExe || this.IsBoxedExe; - public override GameEngineKind EngineKind => EngineType switch + public override GameEngineKind EngineKind => this.EngineType switch { TkoolEngineType.Tyrano => GameEngineKind.Tyrano, TkoolEngineType.Wolf => GameEngineKind.Wolf, @@ -309,31 +309,31 @@ namespace GameLauncher.Engines.Tkool public string PluginsJsPath { - get => _pluginsJsPath; - set { if (_pluginsJsPath != value) { _pluginsJsPath = value; OnPropertyChanged(); } } + get => this._pluginsJsPath; + set { if (this._pluginsJsPath != value) { this._pluginsJsPath = value; this.OnPropertyChanged(); } } } public string PluginsDirPath { - get => _pluginsDirPath; - set { if (_pluginsDirPath != value) { _pluginsDirPath = value; OnPropertyChanged(); } } + get => this._pluginsDirPath; + set { if (this._pluginsDirPath != value) { this._pluginsDirPath = value; this.OnPropertyChanged(); } } } - public override bool IsMV => EngineType == TkoolEngineType.MV; - public override bool IsMZ => EngineType == TkoolEngineType.MZ; - public override bool IsTyrano => EngineType == TkoolEngineType.Tyrano; - public override bool IsVX => EngineType == TkoolEngineType.VX; - public override bool IsVXAce => EngineType == TkoolEngineType.VXAce; - public override bool IsWolf => EngineType == TkoolEngineType.Wolf; - public override bool IsSrpgStudio => EngineType == TkoolEngineType.SrpgStudio; - public override bool IsRgss => EngineType is TkoolEngineType.VX or TkoolEngineType.VXAce; - public override bool IsNwjs => EngineType == TkoolEngineType.Nwjs; - public override bool IsOther => EngineType == TkoolEngineType.Other; + public override bool IsMV => this.EngineType == TkoolEngineType.MV; + public override bool IsMZ => this.EngineType == TkoolEngineType.MZ; + public override bool IsTyrano => this.EngineType == TkoolEngineType.Tyrano; + public override bool IsVX => this.EngineType == TkoolEngineType.VX; + public override bool IsVXAce => this.EngineType == TkoolEngineType.VXAce; + public override bool IsWolf => this.EngineType == TkoolEngineType.Wolf; + public override bool IsSrpgStudio => this.EngineType == TkoolEngineType.SrpgStudio; + public override bool IsRgss => this.EngineType is TkoolEngineType.VX or TkoolEngineType.VXAce; + public override bool IsNwjs => this.EngineType == TkoolEngineType.Nwjs; + public override bool IsOther => this.EngineType == TkoolEngineType.Other; /// /// エンジン種別ラベルの表示文字列。該当エンジンが無い場合は空文字を返し、ラベル自体を非表示にします。 /// - public override string EngineLabelText => EngineType switch + public override string EngineLabelText => this.EngineType switch { TkoolEngineType.MV => "MV", TkoolEngineType.MZ => "MZ", @@ -346,7 +346,7 @@ namespace GameLauncher.Engines.Tkool }; /// エンジン種別ラベルの背景色 - public override Brush EngineLabelBackground => EngineType switch + public override Brush EngineLabelBackground => this.EngineType switch { TkoolEngineType.MV => new SolidColorBrush(Color.FromRgb(0x8B, 0x1E, 0x3F)), TkoolEngineType.MZ => new SolidColorBrush(Color.FromRgb(0x1E, 0x5F, 0x8B)), @@ -360,15 +360,15 @@ namespace GameLauncher.Engines.Tkool /// NW.jsバッジのテキスト public override string NwjsBadgeText => - EngineType == TkoolEngineType.Nwjs ? "NW.js" : string.Empty; + this.EngineType == TkoolEngineType.Nwjs ? "NW.js" : string.Empty; /// NW.jsバッジの可視性 public override Visibility NwjsBadgeVisibility => - EngineType == TkoolEngineType.Nwjs ? Visibility.Visible : Visibility.Collapsed; + this.EngineType == TkoolEngineType.Nwjs ? Visibility.Visible : Visibility.Collapsed; /// その他バッジの可視性 public override Visibility OtherBadgeVisibility => - EngineType == TkoolEngineType.Other ? Visibility.Visible : Visibility.Collapsed; + this.EngineType == TkoolEngineType.Other ? Visibility.Visible : Visibility.Collapsed; /// /// 「プリンセスシナジー」(ツクールMZ製・専用改造対象ゲーム)かどうか。 @@ -376,7 +376,7 @@ namespace GameLauncher.Engines.Tkool /// これにより当該機能が他ゲームに表示・適用されるのを防ぎます。 /// public override bool IsPrincessSynergy => - !string.IsNullOrEmpty(Title) && Title.Contains("プリンセスシナジー"); + !string.IsNullOrEmpty(this.Title) && this.Title.Contains("プリンセスシナジー"); // SRPG Studio アーカイブ関連プロパティ private bool _hasSrpgArchive; @@ -385,56 +385,56 @@ namespace GameLauncher.Engines.Tkool public override bool HasSrpgArchive { - get => _hasSrpgArchive; + get => this._hasSrpgArchive; set { - if (_hasSrpgArchive != value) + if (this._hasSrpgArchive != value) { - _hasSrpgArchive = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(SrpgBadgeVisibility)); - OnPropertyChanged(nameof(SrpgBadgeText)); - OnPropertyChanged(nameof(SrpgBadgeBackground)); - OnPropertyChanged(nameof(SrpgDetailStatusText)); + this._hasSrpgArchive = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.SrpgBadgeVisibility)); + this.OnPropertyChanged(nameof(this.SrpgBadgeText)); + this.OnPropertyChanged(nameof(this.SrpgBadgeBackground)); + this.OnPropertyChanged(nameof(this.SrpgDetailStatusText)); } } } public override bool IsSrpgExtracted { - get => _isSrpgExtracted; + get => this._isSrpgExtracted; set { - if (_isSrpgExtracted != value) + if (this._isSrpgExtracted != value) { - _isSrpgExtracted = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(SrpgBadgeText)); - OnPropertyChanged(nameof(SrpgBadgeBackground)); - OnPropertyChanged(nameof(SrpgDetailStatusText)); + this._isSrpgExtracted = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.SrpgBadgeText)); + this.OnPropertyChanged(nameof(this.SrpgBadgeBackground)); + this.OnPropertyChanged(nameof(this.SrpgDetailStatusText)); } } } public string? SrpgArchivePath { - get => _srpgArchivePath; - set { if (_srpgArchivePath != value) { _srpgArchivePath = value; OnPropertyChanged(); } } + get => this._srpgArchivePath; + set { if (this._srpgArchivePath != value) { this._srpgArchivePath = value; this.OnPropertyChanged(); } } } - public override Visibility SrpgBadgeVisibility => (IsSrpgStudio && HasSrpgArchive) ? Visibility.Visible : Visibility.Collapsed; + public override Visibility SrpgBadgeVisibility => (this.IsSrpgStudio && this.HasSrpgArchive) ? Visibility.Visible : Visibility.Collapsed; - public override string SrpgBadgeText => !(IsSrpgStudio && HasSrpgArchive) ? string.Empty : (IsSrpgExtracted ? "SRPG (抽出済)" : "SRPG (暗号化)"); + public override string SrpgBadgeText => !(this.IsSrpgStudio && this.HasSrpgArchive) ? string.Empty : (this.IsSrpgExtracted ? "SRPG (抽出済)" : "SRPG (暗号化)"); - public override Brush SrpgBadgeBackground => !(IsSrpgStudio && HasSrpgArchive) + public override Brush SrpgBadgeBackground => !(this.IsSrpgStudio && this.HasSrpgArchive) ? Brushes.Transparent - : (IsSrpgExtracted + : (this.IsSrpgExtracted ? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B)) : new SolidColorBrush(Color.FromRgb(0x09, 0x84, 0xE3))); - public override string SrpgDetailStatusText => !(IsSrpgStudio && HasSrpgArchive) + public override string SrpgDetailStatusText => !(this.IsSrpgStudio && this.HasSrpgArchive) ? string.Empty - : (IsSrpgExtracted ? "📦 SRPGアーカイブ(スクリプト/リソース抽出済み・改造可能)" : "🔒 SRPG暗号化アーカイブ(ボタンで抽出・改造・再構築可能)"); + : (this.IsSrpgExtracted ? "📦 SRPGアーカイブ(スクリプト/リソース抽出済み・改造可能)" : "🔒 SRPG暗号化アーカイブ(ボタンで抽出・改造・再構築可能)"); // RGSS (VX / VX Ace) アーカイブ関連プロパティ private bool _hasRgssArchive; @@ -443,95 +443,95 @@ namespace GameLauncher.Engines.Tkool public override bool HasRgssArchive { - get => _hasRgssArchive; + get => this._hasRgssArchive; set { - if (_hasRgssArchive != value) + if (this._hasRgssArchive != value) { - _hasRgssArchive = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(RgssBadgeVisibility)); - OnPropertyChanged(nameof(RgssBadgeText)); - OnPropertyChanged(nameof(RgssBadgeBackground)); - OnPropertyChanged(nameof(RgssDetailStatusText)); + this._hasRgssArchive = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.RgssBadgeVisibility)); + this.OnPropertyChanged(nameof(this.RgssBadgeText)); + this.OnPropertyChanged(nameof(this.RgssBadgeBackground)); + this.OnPropertyChanged(nameof(this.RgssDetailStatusText)); } } } public override bool IsRgssExtracted { - get => _isRgssExtracted; + get => this._isRgssExtracted; set { - if (_isRgssExtracted != value) + if (this._isRgssExtracted != value) { - _isRgssExtracted = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(RgssBadgeText)); - OnPropertyChanged(nameof(RgssBadgeBackground)); - OnPropertyChanged(nameof(RgssDetailStatusText)); + this._isRgssExtracted = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.RgssBadgeText)); + this.OnPropertyChanged(nameof(this.RgssBadgeBackground)); + this.OnPropertyChanged(nameof(this.RgssDetailStatusText)); } } } public string? RgssArchivePath { - get => _rgssArchivePath; - set { if (_rgssArchivePath != value) { _rgssArchivePath = value; OnPropertyChanged(); } } + get => this._rgssArchivePath; + set { if (this._rgssArchivePath != value) { this._rgssArchivePath = value; this.OnPropertyChanged(); } } } - public override Visibility RgssBadgeVisibility => (IsRgss && HasRgssArchive) ? Visibility.Visible : Visibility.Collapsed; + public override Visibility RgssBadgeVisibility => (this.IsRgss && this.HasRgssArchive) ? Visibility.Visible : Visibility.Collapsed; - public override string RgssBadgeText => !(IsRgss && HasRgssArchive) ? string.Empty : (IsRgssExtracted ? "RGSS (抽出済)" : "RGSS (暗号化)"); + public override string RgssBadgeText => !(this.IsRgss && this.HasRgssArchive) ? string.Empty : (this.IsRgssExtracted ? "RGSS (抽出済)" : "RGSS (暗号化)"); - public override Brush RgssBadgeBackground => !(IsRgss && HasRgssArchive) + public override Brush RgssBadgeBackground => !(this.IsRgss && this.HasRgssArchive) ? Brushes.Transparent - : (IsRgssExtracted + : (this.IsRgssExtracted ? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B)) : new SolidColorBrush(Color.FromRgb(0xD3, 0x54, 0x00))); - public override string RgssDetailStatusText => !(IsRgss && HasRgssArchive) + public override string RgssDetailStatusText => !(this.IsRgss && this.HasRgssArchive) ? string.Empty - : (IsRgssExtracted ? "📦 RGSSアーカイブ(スクリプト抽出済み・改造可能)" : "🔒 RGSS暗号化アーカイブ(起動時またはボタンでスクリプト抽出可能)"); + : (this.IsRgssExtracted ? "📦 RGSSアーカイブ(スクリプト抽出済み・改造可能)" : "🔒 RGSS暗号化アーカイブ(起動時またはボタンでスクリプト抽出可能)"); public TkoolEngineType EngineType { - get => _engineType; + get => this._engineType; set { - if (_engineType != value) + if (this._engineType != value) { - _engineType = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(EngineKind)); - OnPropertyChanged(nameof(EngineDisplayName)); - OnPropertyChanged(nameof(EngineLabelText)); - OnPropertyChanged(nameof(EngineLabelBackground)); - OnPropertyChanged(nameof(IsMV)); - OnPropertyChanged(nameof(IsMZ)); - OnPropertyChanged(nameof(IsTyrano)); - OnPropertyChanged(nameof(IsVX)); - OnPropertyChanged(nameof(IsVXAce)); - OnPropertyChanged(nameof(IsWolf)); - OnPropertyChanged(nameof(IsSrpgStudio)); - OnPropertyChanged(nameof(IsRgss)); - OnPropertyChanged(nameof(IsNwjs)); - OnPropertyChanged(nameof(IsOther)); - OnPropertyChanged(nameof(NwjsBadgeText)); - OnPropertyChanged(nameof(NwjsBadgeVisibility)); - OnPropertyChanged(nameof(OtherBadgeVisibility)); - OnPropertyChanged(nameof(WolfArchiveBadgeVisibility)); - OnPropertyChanged(nameof(WolfArchiveBadgeText)); - OnPropertyChanged(nameof(WolfArchiveBadgeBackground)); - OnPropertyChanged(nameof(WolfArchiveDetailStatusText)); - OnPropertyChanged(nameof(SrpgBadgeVisibility)); - OnPropertyChanged(nameof(SrpgBadgeText)); - OnPropertyChanged(nameof(SrpgBadgeBackground)); - OnPropertyChanged(nameof(SrpgDetailStatusText)); - OnPropertyChanged(nameof(RgssBadgeVisibility)); - OnPropertyChanged(nameof(RgssBadgeText)); - OnPropertyChanged(nameof(RgssBadgeBackground)); - OnPropertyChanged(nameof(RgssDetailStatusText)); + this._engineType = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.EngineKind)); + this.OnPropertyChanged(nameof(this.EngineDisplayName)); + this.OnPropertyChanged(nameof(this.EngineLabelText)); + this.OnPropertyChanged(nameof(this.EngineLabelBackground)); + this.OnPropertyChanged(nameof(this.IsMV)); + this.OnPropertyChanged(nameof(this.IsMZ)); + this.OnPropertyChanged(nameof(this.IsTyrano)); + this.OnPropertyChanged(nameof(this.IsVX)); + this.OnPropertyChanged(nameof(this.IsVXAce)); + this.OnPropertyChanged(nameof(this.IsWolf)); + this.OnPropertyChanged(nameof(this.IsSrpgStudio)); + this.OnPropertyChanged(nameof(this.IsRgss)); + this.OnPropertyChanged(nameof(this.IsNwjs)); + this.OnPropertyChanged(nameof(this.IsOther)); + this.OnPropertyChanged(nameof(this.NwjsBadgeText)); + this.OnPropertyChanged(nameof(this.NwjsBadgeVisibility)); + this.OnPropertyChanged(nameof(this.OtherBadgeVisibility)); + this.OnPropertyChanged(nameof(this.WolfArchiveBadgeVisibility)); + this.OnPropertyChanged(nameof(this.WolfArchiveBadgeText)); + this.OnPropertyChanged(nameof(this.WolfArchiveBadgeBackground)); + this.OnPropertyChanged(nameof(this.WolfArchiveDetailStatusText)); + this.OnPropertyChanged(nameof(this.SrpgBadgeVisibility)); + this.OnPropertyChanged(nameof(this.SrpgBadgeText)); + this.OnPropertyChanged(nameof(this.SrpgBadgeBackground)); + this.OnPropertyChanged(nameof(this.SrpgDetailStatusText)); + this.OnPropertyChanged(nameof(this.RgssBadgeVisibility)); + this.OnPropertyChanged(nameof(this.RgssBadgeText)); + this.OnPropertyChanged(nameof(this.RgssBadgeBackground)); + this.OnPropertyChanged(nameof(this.RgssDetailStatusText)); } } } @@ -545,31 +545,31 @@ namespace GameLauncher.Engines.Tkool /// プロキシDLL(version.dll 倍速/メモリフック)を適用するか public override bool WolfProxyDll { - get => _wolfProxyDll; - set { if (_wolfProxyDll != value) { _wolfProxyDll = value; OnPropertyChanged(); } } + get => this._wolfProxyDll; + set { if (this._wolfProxyDll != value) { this._wolfProxyDll = value; this.OnPropertyChanged(); } } } /// プロキシDLLのスピード倍率 public double WolfSpeedMultiplier { - get => _wolfSpeedMultiplier; - set { if (_wolfSpeedMultiplier != value) { _wolfSpeedMultiplier = value; OnPropertyChanged(); } } + get => this._wolfSpeedMultiplier; + set { if (this._wolfSpeedMultiplier != value) { this._wolfSpeedMultiplier = value; this.OnPropertyChanged(); } } } /// Data.wolf アーカイブが存在するか public override bool HasWolfArchive { - get => _hasWolfArchive; + get => this._hasWolfArchive; set { - if (_hasWolfArchive != value) + if (this._hasWolfArchive != value) { - _hasWolfArchive = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(WolfArchiveBadgeVisibility)); - OnPropertyChanged(nameof(WolfArchiveBadgeText)); - OnPropertyChanged(nameof(WolfArchiveBadgeBackground)); - OnPropertyChanged(nameof(WolfArchiveDetailStatusText)); + this._hasWolfArchive = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.WolfArchiveBadgeVisibility)); + this.OnPropertyChanged(nameof(this.WolfArchiveBadgeText)); + this.OnPropertyChanged(nameof(this.WolfArchiveBadgeBackground)); + this.OnPropertyChanged(nameof(this.WolfArchiveDetailStatusText)); } } } @@ -577,31 +577,31 @@ namespace GameLauncher.Engines.Tkool /// Data.wolf が解凍済み(Dataフォルダが存在)か public override bool IsWolfExtracted { - get => _isWolfExtracted; + get => this._isWolfExtracted; set { - if (_isWolfExtracted != value) + if (this._isWolfExtracted != value) { - _isWolfExtracted = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(WolfArchiveBadgeVisibility)); - OnPropertyChanged(nameof(WolfArchiveBadgeText)); - OnPropertyChanged(nameof(WolfArchiveBadgeBackground)); - OnPropertyChanged(nameof(WolfArchiveDetailStatusText)); + this._isWolfExtracted = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.WolfArchiveBadgeVisibility)); + this.OnPropertyChanged(nameof(this.WolfArchiveBadgeText)); + this.OnPropertyChanged(nameof(this.WolfArchiveBadgeBackground)); + this.OnPropertyChanged(nameof(this.WolfArchiveDetailStatusText)); } } } - public override Visibility WolfArchiveBadgeVisibility => (IsWolf && HasWolfArchive) ? Visibility.Visible : Visibility.Collapsed; - public override string WolfArchiveBadgeText => !(IsWolf && HasWolfArchive) ? string.Empty : (IsWolfExtracted ? "Data解凍済" : "Data.wolf保護"); - public override Brush WolfArchiveBadgeBackground => !(IsWolf && HasWolfArchive) + public override Visibility WolfArchiveBadgeVisibility => (this.IsWolf && this.HasWolfArchive) ? Visibility.Visible : Visibility.Collapsed; + public override string WolfArchiveBadgeText => !(this.IsWolf && this.HasWolfArchive) ? string.Empty : (this.IsWolfExtracted ? "Data解凍済" : "Data.wolf保護"); + public override Brush WolfArchiveBadgeBackground => !(this.IsWolf && this.HasWolfArchive) ? Brushes.Transparent - : (IsWolfExtracted + : (this.IsWolfExtracted ? new SolidColorBrush(Color.FromRgb(0x00, 0xB8, 0x94)) : new SolidColorBrush(Color.FromRgb(0x63, 0x6E, 0x72))); - public override string WolfArchiveDetailStatusText => !(IsWolf && HasWolfArchive) + public override string WolfArchiveDetailStatusText => !(this.IsWolf && this.HasWolfArchive) ? string.Empty - : (IsWolfExtracted + : (this.IsWolfExtracted ? "Data フォルダに解凍・抽出済みです。ウディタは Data フォルダのマップ・イベント・データベース等を優先して読み込みます。直接ファイルを改造できます。" : "Data.wolf アーカイブで暗号化・保護されています。下の「Data.wolf を解凍」を実行すると、全データを展開して直接編集・改造可能になります。"); @@ -612,124 +612,124 @@ namespace GameLauncher.Engines.Tkool /// SRPG Studio プロキシDLL(version.dll 倍速機能)を適用するか public override bool SrpgProxyDll { - get => _srpgProxyDll; - set { if (_srpgProxyDll != value) { _srpgProxyDll = value; OnPropertyChanged(); } } + get => this._srpgProxyDll; + set { if (this._srpgProxyDll != value) { this._srpgProxyDll = value; this.OnPropertyChanged(); } } } /// SRPG Studio プロキシDLLのスピード倍率 public double SrpgSpeedMultiplier { - get => _srpgSpeedMultiplier; - set { if (_srpgSpeedMultiplier != value) { _srpgSpeedMultiplier = value; OnPropertyChanged(); } } + get => this._srpgSpeedMultiplier; + set { if (this._srpgSpeedMultiplier != value) { this._srpgSpeedMultiplier = value; this.OnPropertyChanged(); } } } /// SRPG Studio プラグイン改造オプション(PluginOptionsのエイリアス) - public ObservableCollection SrpgModOptions => PluginOptions; + public ObservableCollection SrpgModOptions => this.PluginOptions; public override bool IsModded { - get => _isModded; - set { if (_isModded != value) { _isModded = value; OnPropertyChanged(); } } + get => this._isModded; + set { if (this._isModded != value) { this._isModded = value; this.OnPropertyChanged(); } } } public bool HasCustomApplyMod { - get => _hasCustomApplyMod; - set { if (_hasCustomApplyMod != value) { _hasCustomApplyMod = value; OnPropertyChanged(); } } + get => this._hasCustomApplyMod; + set { if (this._hasCustomApplyMod != value) { this._hasCustomApplyMod = value; this.OnPropertyChanged(); } } } public override bool ApplyMod { - get => _applyMod; + get => this._applyMod; set { - if (_applyMod != value) + if (this._applyMod != value) { - _applyMod = value; - if (!_isInitializingApplyMod) + this._applyMod = value; + if (!this._isInitializingApplyMod) { - HasCustomApplyMod = true; + this.HasCustomApplyMod = true; } - OnPropertyChanged(); + this.OnPropertyChanged(); } } } public void SetDefaultApplyMod(bool defaultVal) { - if (!_hasCustomApplyMod) + if (!this._hasCustomApplyMod) { - _isInitializingApplyMod = true; - _applyMod = defaultVal; - _isInitializingApplyMod = false; - OnPropertyChanged(nameof(ApplyMod)); + this._isInitializingApplyMod = true; + this._applyMod = defaultVal; + this._isInitializingApplyMod = false; + this.OnPropertyChanged(nameof(this.ApplyMod)); } } public override bool IsAsar { - get => _isAsar; + get => this._isAsar; set { - if (_isAsar != value) + if (this._isAsar != value) { - _isAsar = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(AsarBadgeVisibility)); - OnPropertyChanged(nameof(AsarBadgeText)); - OnPropertyChanged(nameof(AsarBadgeBackground)); - OnPropertyChanged(nameof(AsarDetailStatusText)); + this._isAsar = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.AsarBadgeVisibility)); + this.OnPropertyChanged(nameof(this.AsarBadgeText)); + this.OnPropertyChanged(nameof(this.AsarBadgeBackground)); + this.OnPropertyChanged(nameof(this.AsarDetailStatusText)); } } } public override bool IsAsarExtracted { - get => _isAsarExtracted; + get => this._isAsarExtracted; set { - if (_isAsarExtracted != value) + if (this._isAsarExtracted != value) { - _isAsarExtracted = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(AsarBadgeText)); - OnPropertyChanged(nameof(AsarBadgeBackground)); - OnPropertyChanged(nameof(AsarDetailStatusText)); + this._isAsarExtracted = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.AsarBadgeText)); + this.OnPropertyChanged(nameof(this.AsarBadgeBackground)); + this.OnPropertyChanged(nameof(this.AsarDetailStatusText)); } } } public string? AsarPath { - get => _asarPath; - set { if (_asarPath != value) { _asarPath = value; OnPropertyChanged(); } } + get => this._asarPath; + set { if (this._asarPath != value) { this._asarPath = value; this.OnPropertyChanged(); } } } public string? AsarExtractedDirPath { - get => _asarExtractedDirPath; - set { if (_asarExtractedDirPath != value) { _asarExtractedDirPath = value; OnPropertyChanged(); } } + get => this._asarExtractedDirPath; + set { if (this._asarExtractedDirPath != value) { this._asarExtractedDirPath = value; this.OnPropertyChanged(); } } } public string? RelativePluginsJsInAsar { - get => _relativePluginsJsInAsar; - set { if (_relativePluginsJsInAsar != value) { _relativePluginsJsInAsar = value; OnPropertyChanged(); } } + get => this._relativePluginsJsInAsar; + set { if (this._relativePluginsJsInAsar != value) { this._relativePluginsJsInAsar = value; this.OnPropertyChanged(); } } } - public override Visibility AsarBadgeVisibility => IsAsar ? Visibility.Visible : Visibility.Collapsed; + public override Visibility AsarBadgeVisibility => this.IsAsar ? Visibility.Visible : Visibility.Collapsed; - public override string AsarBadgeText => !IsAsar ? string.Empty : (IsAsarExtracted ? "ASAR (解凍済)" : "ASAR (圧縮)"); + public override string AsarBadgeText => !this.IsAsar ? string.Empty : (this.IsAsarExtracted ? "ASAR (解凍済)" : "ASAR (圧縮)"); - public override Brush AsarBadgeBackground => !IsAsar + public override Brush AsarBadgeBackground => !this.IsAsar ? Brushes.Transparent - : (IsAsarExtracted + : (this.IsAsarExtracted ? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B)) : new SolidColorBrush(Color.FromRgb(0x5E, 0x35, 0xB1))); - public override string AsarDetailStatusText => !IsAsar + public override string AsarDetailStatusText => !this.IsAsar ? string.Empty - : (IsAsarExtracted ? "📦 app.asar 形式(解凍済み・改造可能)" : "📦 app.asar 形式(圧縮中・起動時またはボタンで解凍可能)"); + : (this.IsAsarExtracted ? "📦 app.asar 形式(解凍済み・改造可能)" : "📦 app.asar 形式(圧縮中・起動時またはボタンで解凍可能)"); private Dictionary _pluginSettings = new(StringComparer.OrdinalIgnoreCase); private ObservableCollection _pluginOptions = []; @@ -810,14 +810,14 @@ namespace GameLauncher.Engines.Tkool public bool IsPluginEnabled(string pluginId, Dictionary? defaultSettings = null, bool fallbackVal = true) { - if (_pluginSettings.TryGetValue(pluginId, out var val)) + if (this._pluginSettings.TryGetValue(pluginId, out var val)) { return val; } if (pluginId is "BattleTurnRecoverHp" or "BattleTurnRecoverMp" or "BattleTurnRecoverTp") { - if (_pluginSettings.TryGetValue("BattleTurnRecover", out var legacyVal)) + if (this._pluginSettings.TryGetValue("BattleTurnRecover", out var legacyVal)) { return legacyVal; } @@ -969,11 +969,11 @@ namespace GameLauncher.Engines.Tkool public ModPluginOptions ModOptions { - get => _modOptions; - set { if (_modOptions != value) { _modOptions = value; OnPropertyChanged(); } } + get => this._modOptions; + set { if (this._modOptions != value) { this._modOptions = value; this.OnPropertyChanged(); } } } - public string EngineDisplayName => EngineType switch + public string EngineDisplayName => this.EngineType switch { TkoolEngineType.MV => "RPGツクールMV", TkoolEngineType.MZ => "RPGツクールMZ", diff --git a/Engines/Tkool/TkoolInjectionService.cs b/Engines/Tkool/TkoolInjectionService.cs index 0e98bf8..fc50775 100644 --- a/Engines/Tkool/TkoolInjectionService.cs +++ b/Engines/Tkool/TkoolInjectionService.cs @@ -159,9 +159,9 @@ namespace GameLauncher.Engines.Tkool var entry = $"{BeginMarker}{{\"name\":\"{ModPluginId}\",\"status\":true,\"description\":\"GameLauncher mod\",\"parameters\":{{}}}}{EndMarker}"; - var prefix = content.Substring(0, arrayStart + 1); + var prefix = content[..(arrayStart + 1)]; var inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1); - var suffix = content.Substring(arrayEnd); + var suffix = content[arrayEnd..]; var trimmedInner = inner.Trim(); var newInner = string.IsNullOrEmpty(trimmedInner) @@ -198,7 +198,7 @@ namespace GameLauncher.Engines.Tkool while (scan >= 0 && char.IsWhiteSpace(content[scan])) scan--; if (scan >= 0 && content[scan] == ',') cutStart = scan; - content = content.Substring(0, cutStart) + content.Substring(end); + content = content[..cutStart] + content[end..]; } while (content != prev); diff --git a/Engines/Tkool/TkoolModService.cs b/Engines/Tkool/TkoolModService.cs index 638c7ac..3774b05 100644 --- a/Engines/Tkool/TkoolModService.cs +++ b/Engines/Tkool/TkoolModService.cs @@ -41,11 +41,11 @@ namespace GameLauncher.Engines.Tkool private List _availablePlugins = []; /// 現在認識されている利用可能なプラグイン一覧 - public IReadOnlyList AvailablePlugins => _availablePlugins; + public IReadOnlyList AvailablePlugins => this._availablePlugins; public TkoolModService() { - LoadAvailablePlugins(); + this.LoadAvailablePlugins(); } /// @@ -105,7 +105,7 @@ namespace GameLauncher.Engines.Tkool } } - _availablePlugins = list; + this._availablePlugins = list; return list; } @@ -159,11 +159,11 @@ namespace GameLauncher.Engines.Tkool { if (game.ApplyMod) { - return ApplyMod(game, defaultSettings); + return this.ApplyMod(game, defaultSettings); } else { - return RestoreOriginal(game); + return this.RestoreOriginal(game); } } catch (Exception ex) @@ -216,18 +216,16 @@ namespace GameLauncher.Engines.Tkool string baseContent = File.ReadAllText(backupPath, Encoding.UTF8); // 最新の動的プラグイン一覧を取得 - if (_availablePlugins.Count == 0) + if (this._availablePlugins.Count == 0) { - LoadAvailablePlugins(); + this.LoadAvailablePlugins(); } // 有効化対象のプラグインを取得 // ※ResourceLoaderFix はリソース読み込み不具合の必須救済プラグインのため、常に有効化・先頭配置 - var fixPlugin = _availablePlugins.FirstOrDefault(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase)); - var pluginsToEnable = _availablePlugins - .Where(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase) - ? true - : game.IsPluginEnabled(p.Id, defaultSettings, fallbackVal: true)) + var fixPlugin = this._availablePlugins.FirstOrDefault(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase)); + var pluginsToEnable = this._availablePlugins + .Where(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase) || game.IsPluginEnabled(p.Id, defaultSettings, fallbackVal: true)) .ToList(); // ResourceLoaderFix を最優先(先頭)に配置して、他プラグイン実行前のリソース要求も確実に救済 @@ -238,7 +236,7 @@ namespace GameLauncher.Engines.Tkool } // 3. ゲーム側の plugins ディレクトリから不要な旧プラグインや無効プラグインを安全に掃除 - var allManaged = GetAllManagedPluginNames(_availablePlugins); + var allManaged = GetAllManagedPluginNames(this._availablePlugins); var enabledIds = new HashSet(pluginsToEnable.Select(p => p.Id), StringComparer.OrdinalIgnoreCase); foreach (var pluginId in allManaged) @@ -257,7 +255,7 @@ namespace GameLauncher.Engines.Tkool // 4. 有効対象のプラグインファイルをゲーム側へ配置 foreach (var plugin in pluginsToEnable) { - CopyPluginToGame(plugin, pluginsDir); + this.CopyPluginToGame(plugin, pluginsDir); } // 5. plugins.js をパース・再構築して有効プラグインを追加 @@ -309,7 +307,7 @@ namespace GameLauncher.Engines.Tkool // 2. ゲーム側の plugins フォルダから新旧すべてのプラグインファイルを安全に削除(ゴミを残さない) if (!string.IsNullOrEmpty(pluginsDir) && Directory.Exists(pluginsDir)) { - var allManaged = GetAllManagedPluginNames(_availablePlugins); + var allManaged = GetAllManagedPluginNames(this._availablePlugins); foreach (var pluginName in allManaged) { var targetFile = Path.Combine(pluginsDir, $"{pluginName}.js"); @@ -356,9 +354,9 @@ namespace GameLauncher.Engines.Tkool return content; } - string prefix = content.Substring(0, arrayStart + 1); + string prefix = content[..(arrayStart + 1)]; string inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1); - string suffix = content.Substring(arrayEnd); + string suffix = content[arrayEnd..]; // 新旧すべてのプラグイン名を除去対象とする var managedSet = GetAllManagedPluginNames(); @@ -412,7 +410,7 @@ namespace GameLauncher.Engines.Tkool if (depth == 0) { - string objText = inner.Substring(objStart, i - objStart).Trim(); + string objText = inner[objStart..i].Trim(); // このオブジェクトが新旧管理対象プラグインかどうか判定 var match = Regex.Match(objText, @"""name""\s*:\s*""([^""]+)"""); if (match.Success && managedSet.Contains(match.Groups[1].Value)) diff --git a/Engines/Tkool/TkoolResourceRepairService.cs b/Engines/Tkool/TkoolResourceRepairService.cs index b34edc5..21c80b4 100644 --- a/Engines/Tkool/TkoolResourceRepairService.cs +++ b/Engines/Tkool/TkoolResourceRepairService.cs @@ -297,7 +297,7 @@ namespace GameLauncher.Engines.Tkool // 拡張子がある場合とない場合(.png を補完)を検討 var extensionsToCheck = string.IsNullOrEmpty(reqExt) ? new[] { ".png", ".ogg", ".m4a" } - : new[] { reqExt }; + : [reqExt]; foreach (var ext in extensionsToCheck) { @@ -513,7 +513,7 @@ namespace GameLauncher.Engines.Tkool bytes.Add(Convert.ToByte(hexPart.Substring(i + 1, 2), 16)); } } - return Encoding.UTF8.GetString(bytes.ToArray()); + return Encoding.UTF8.GetString([.. bytes]); } catch { diff --git a/Engines/Unity/UnityGameItem.cs b/Engines/Unity/UnityGameItem.cs index 43376e0..668425a 100644 --- a/Engines/Unity/UnityGameItem.cs +++ b/Engines/Unity/UnityGameItem.cs @@ -21,22 +21,22 @@ namespace GameLauncher.Engines.Unity /// [Game]_Data ディレクトリ絶対パス public string DataDirectoryPath { - get => _dataDirectoryPath; - set { if (_dataDirectoryPath != value) { _dataDirectoryPath = value; OnPropertyChanged(); } } + get => this._dataDirectoryPath; + set { if (this._dataDirectoryPath != value) { this._dataDirectoryPath = value; this.OnPropertyChanged(); } } } /// app.info 由来の会社名/開発者名 public string CompanyName { - get => _companyName; + get => this._companyName; set { - if (_companyName != value) + if (this._companyName != value) { - _companyName = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(RegistryPath)); - OnPropertyChanged(nameof(LocalLowPath)); + this._companyName = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.RegistryPath)); + this.OnPropertyChanged(nameof(this.LocalLowPath)); } } } @@ -44,35 +44,35 @@ namespace GameLauncher.Engines.Unity /// app.info 由来の製品名 public string ProductName { - get => _productName; + get => this._productName; set { - if (_productName != value) + if (this._productName != value) { - _productName = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(RegistryPath)); - OnPropertyChanged(nameof(LocalLowPath)); + this._productName = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.RegistryPath)); + this.OnPropertyChanged(nameof(this.LocalLowPath)); } } } - public override bool IsIL2CPP => BackendType == UnityBackendType.IL2CPP; - public override bool IsMono => BackendType == UnityBackendType.Mono; + public override bool IsIL2CPP => this.BackendType == UnityBackendType.IL2CPP; + public override bool IsMono => this.BackendType == UnityBackendType.Mono; /// バックエンド形式 (IL2CPP / Mono) public UnityBackendType BackendType { - get => _backendType; + get => this._backendType; set { - if (_backendType != value) + if (this._backendType != value) { - _backendType = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(BackendBadgeText)); - OnPropertyChanged(nameof(IsIL2CPP)); - OnPropertyChanged(nameof(IsMono)); + this._backendType = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.BackendBadgeText)); + this.OnPropertyChanged(nameof(this.IsIL2CPP)); + this.OnPropertyChanged(nameof(this.IsMono)); } } } @@ -80,15 +80,15 @@ namespace GameLauncher.Engines.Unity /// Unityバージョン文字列 public override string UnityVersion { - get => _unityVersion; - set { if (_unityVersion != value) { _unityVersion = value; OnPropertyChanged(); } } + get => this._unityVersion; + set { if (this._unityVersion != value) { this._unityVersion = value; this.OnPropertyChanged(); } } } /// セーブデータ(レジストリまたはファイル)が検出されたかどうか public override bool HasSaveData { - get => _hasSaveData; - set { if (_hasSaveData != value) { _hasSaveData = value; OnPropertyChanged(); } } + get => this._hasSaveData; + set { if (this._hasSaveData != value) { this._hasSaveData = value; this.OnPropertyChanged(); } } } /// @@ -99,9 +99,9 @@ namespace GameLauncher.Engines.Unity { get { - if (string.IsNullOrEmpty(CompanyName) || string.IsNullOrEmpty(ProductName)) + if (string.IsNullOrEmpty(this.CompanyName) || string.IsNullOrEmpty(this.ProductName)) return string.Empty; - return $@"Software\{CompanyName}\{ProductName}"; + return $@"Software\{this.CompanyName}\{this.ProductName}"; } } @@ -113,18 +113,18 @@ namespace GameLauncher.Engines.Unity { get { - if (string.IsNullOrEmpty(CompanyName) || string.IsNullOrEmpty(ProductName)) + if (string.IsNullOrEmpty(this.CompanyName) || string.IsNullOrEmpty(this.ProductName)) return string.Empty; var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var appData = Path.GetDirectoryName(localAppData); if (string.IsNullOrEmpty(appData)) return string.Empty; - return Path.Combine(appData, "LocalLow", CompanyName, ProductName); + return Path.Combine(appData, "LocalLow", this.CompanyName, this.ProductName); } } - public override string BackendBadgeText => BackendType switch + public override string BackendBadgeText => this.BackendType switch { UnityBackendType.IL2CPP => "IL2CPP", UnityBackendType.Mono => "Mono", diff --git a/Engines/Unity/UnitySaveItem.cs b/Engines/Unity/UnitySaveItem.cs index 2c34982..a2f8bc0 100644 --- a/Engines/Unity/UnitySaveItem.cs +++ b/Engines/Unity/UnitySaveItem.cs @@ -28,35 +28,35 @@ namespace GameLauncher.Engines.Unity /// レジストリの生キー名(例: ClearedLevel_h1378399435) public string RawKey { - get => _rawKey; - set { if (_rawKey != value) { _rawKey = value; OnPropertyChanged(); } } + get => this._rawKey; + set { if (this._rawKey != value) { this._rawKey = value; this.OnPropertyChanged(); } } } /// Unityのハッシュを除去した整形式キー名(例: ClearedLevel) public string CleanKey { - get => _cleanKey; - set { if (_cleanKey != value) { _cleanKey = value; OnPropertyChanged(); } } + get => this._cleanKey; + set { if (this._cleanKey != value) { this._cleanKey = value; this.OnPropertyChanged(); } } } /// 値のデータ型 public PlayerPrefsType Type { - get => _type; - set { if (_type != value) { _type = value; OnPropertyChanged(); OnPropertyChanged(nameof(TypeDisplay)); } } + get => this._type; + set { if (this._type != value) { this._type = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.TypeDisplay)); } } } /// 実際の値(int, float, string, byte[]) public object? Value { - get => _value; + get => this._value; set { - if (!Equals(_value, value)) + if (!Equals(this._value, value)) { - _value = value; - OnPropertyChanged(); - UpdateEditValue(); + this._value = value; + this.OnPropertyChanged(); + this.UpdateEditValue(); } } } @@ -64,15 +64,15 @@ namespace GameLauncher.Engines.Unity /// UI表示・編集用の文字列値 public string EditValue { - get => _editValue; + get => this._editValue; set { - if (_editValue != value) + if (this._editValue != value) { - _editValue = value; - _isModified = true; - OnPropertyChanged(); - OnPropertyChanged(nameof(IsModified)); + this._editValue = value; + this._isModified = true; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.IsModified)); } } } @@ -80,11 +80,11 @@ namespace GameLauncher.Engines.Unity /// 値が変更されたかどうか public bool IsModified { - get => _isModified; - set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } } + get => this._isModified; + set { if (this._isModified != value) { this._isModified = value; this.OnPropertyChanged(); } } } - public string TypeDisplay => Type switch + public string TypeDisplay => this.Type switch { PlayerPrefsType.Int => "Int (数値)", PlayerPrefsType.Float => "Float (小数)", @@ -95,19 +95,19 @@ namespace GameLauncher.Engines.Unity private void UpdateEditValue() { - if (_value == null) + if (this._value == null) { - _editValue = string.Empty; + this._editValue = string.Empty; } - else if (_value is byte[] bytes) + else if (this._value is byte[] bytes) { try { var text = System.Text.Encoding.UTF8.GetString(bytes).TrimEnd('\0'); if (text.All(c => !char.IsControl(c) || c == '\r' || c == '\n' || c == '\t')) { - _editValue = text; - _type = PlayerPrefsType.String; + this._editValue = text; + this._type = PlayerPrefsType.String; return; } } @@ -118,21 +118,21 @@ namespace GameLauncher.Engines.Unity float f = BitConverter.ToSingle(bytes, 0); if (!float.IsNaN(f) && !float.IsInfinity(f)) { - _editValue = f.ToString("G"); - _type = PlayerPrefsType.Float; + this._editValue = f.ToString("G"); + this._type = PlayerPrefsType.Float; return; } } - _editValue = BitConverter.ToString(bytes).Replace("-", " "); + this._editValue = BitConverter.ToString(bytes).Replace("-", " "); } else { - _editValue = _value.ToString() ?? string.Empty; + this._editValue = this._value.ToString() ?? string.Empty; } - _isModified = false; - OnPropertyChanged(nameof(EditValue)); - OnPropertyChanged(nameof(IsModified)); + this._isModified = false; + this.OnPropertyChanged(nameof(this.EditValue)); + this.OnPropertyChanged(nameof(this.IsModified)); } } @@ -152,13 +152,13 @@ namespace GameLauncher.Engines.Unity { get { - if (FileSize < 1024) return $"{FileSize} B"; - if (FileSize < 1024 * 1024) return $"{FileSize / 1024.0:F1} KB"; - return $"{FileSize / (1024.0 * 1024.0):F2} MB"; + if (this.FileSize < 1024) return $"{this.FileSize} B"; + if (this.FileSize < 1024 * 1024) return $"{this.FileSize / 1024.0:F1} KB"; + return $"{this.FileSize / (1024.0 * 1024.0):F2} MB"; } } - public string LastModifiedDisplay => LastModified.ToString("yyyy/MM/dd HH:mm:ss"); + public string LastModifiedDisplay => this.LastModified.ToString("yyyy/MM/dd HH:mm:ss"); } /// @@ -172,6 +172,6 @@ namespace GameLauncher.Engines.Unity public string BackupType { get; set; } = string.Empty; // "Registry (.reg)" または "ファイル" public string Note { get; set; } = string.Empty; - public string TimestampDisplay => Timestamp.ToString("yyyy/MM/dd HH:mm:ss"); + public string TimestampDisplay => this.Timestamp.ToString("yyyy/MM/dd HH:mm:ss"); } } diff --git a/Engines/Unity/UnitySaveManagerService.cs b/Engines/Unity/UnitySaveManagerService.cs index 2469970..7e5e661 100644 --- a/Engines/Unity/UnitySaveManagerService.cs +++ b/Engines/Unity/UnitySaveManagerService.cs @@ -81,7 +81,7 @@ namespace GameLauncher.Engines.Unity catch { } // キー名昇順でソート - return list.OrderBy(e => e.CleanKey, StringComparer.OrdinalIgnoreCase).ToList(); + return [.. list.OrderBy(e => e.CleanKey, StringComparer.OrdinalIgnoreCase)]; } /// @@ -319,7 +319,7 @@ namespace GameLauncher.Engines.Unity proc?.WaitForExit(3000); // JSONバックアップも併せて出力 - var entries = GetPlayerPrefs(registryPath); + var entries = this.GetPlayerPrefs(registryPath); var jsonBackupFile = Path.Combine(backupDir, $"PlayerPrefs_{timestamp}.json"); var serializableList = entries.Select(e => new { @@ -416,7 +416,7 @@ namespace GameLauncher.Engines.Unity FileSize = fi.Length, LastModified = fi.LastWriteTime, LocationType = "LocalLow", - IsTextOrJson = CheckIsTextOrJson(f) + IsTextOrJson = this.CheckIsTextOrJson(f) }); } } @@ -429,7 +429,7 @@ namespace GameLauncher.Engines.Unity try { // ルート直下 - CollectCandidateFiles(game.RootDirectory, "ゲームフォルダ", list); + this.CollectCandidateFiles(game.RootDirectory, "ゲームフォルダ", list); // Save / SaveData / saves / savedata サブフォルダ var subNames = new[] { "Save", "SaveData", "saves", "savedata", "Save_Data" }; @@ -438,21 +438,21 @@ namespace GameLauncher.Engines.Unity var subPath = Path.Combine(game.RootDirectory, sub); if (Directory.Exists(subPath)) { - CollectCandidateFiles(subPath, "ゲームフォルダ/" + sub, list, isStrict: false); + this.CollectCandidateFiles(subPath, "ゲームフォルダ/" + sub, list, isStrict: false); } } // Dataフォルダ直下のセーブファイル候補 if (!string.IsNullOrEmpty(game.DataDirectoryPath) && Directory.Exists(game.DataDirectoryPath)) { - CollectCandidateFiles(game.DataDirectoryPath, "Dataフォルダ", list); + this.CollectCandidateFiles(game.DataDirectoryPath, "Dataフォルダ", list); } } catch { } } // 更新日時降順でソート - return list.OrderByDescending(f => f.LastModified).ToList(); + return [.. list.OrderByDescending(f => f.LastModified)]; } private void CollectCandidateFiles(string dir, string locationLabel, List list, bool isStrict = true) @@ -494,7 +494,7 @@ namespace GameLauncher.Engines.Unity FileSize = fi.Length, LastModified = fi.LastWriteTime, LocationType = locationLabel, - IsTextOrJson = CheckIsTextOrJson(f) + IsTextOrJson = this.CheckIsTextOrJson(f) }); } } @@ -649,7 +649,7 @@ namespace GameLauncher.Engines.Unity } catch { } - return list.OrderByDescending(b => b.Timestamp).ToList(); + return [.. list.OrderByDescending(b => b.Timestamp)]; } /// diff --git a/Engines/Wolf/WolfArchiveService.cs b/Engines/Wolf/WolfArchiveService.cs index d30df5e..2fd8752 100644 --- a/Engines/Wolf/WolfArchiveService.cs +++ b/Engines/Wolf/WolfArchiveService.cs @@ -85,7 +85,7 @@ namespace GameLauncher.Engines.Wolf return (false, "ゲームのルートディレクトリが見つかりません。"); } - var extractorPath = ResolveExtractorPath(customExtractorPath); + var extractorPath = this.ResolveExtractorPath(customExtractorPath); if (string.IsNullOrEmpty(extractorPath) || !File.Exists(extractorPath)) { return (false, "Wolf RPG アーカイブ解凍ツール(UberWolfCli.exe / WolfDec.exe)が見つかりません。設定ダイアログからツールのパスを指定してください。"); diff --git a/Engines/Wolf/WolfModService.cs b/Engines/Wolf/WolfModService.cs index 6d7c2e1..5468079 100644 --- a/Engines/Wolf/WolfModService.cs +++ b/Engines/Wolf/WolfModService.cs @@ -51,7 +51,7 @@ namespace GameLauncher.Engines.Wolf try { // 1. プロキシDLL本体の探索 (Tools\speedhack-i686\version.dll) - var sourceDllPath = ResolveProxyDllPath(); + var sourceDllPath = this.ResolveProxyDllPath(); if (string.IsNullOrEmpty(sourceDllPath) || !File.Exists(sourceDllPath)) { return (false, "プロキシDLL(Engines\\Wolf\\Tools\\speedhack-i686\\version.dll)が見つかりません。"); @@ -73,7 +73,7 @@ namespace GameLauncher.Engines.Wolf File.Copy(sourceDllPath, targetDllPath, overwrite: true); // 4. speedhack_config.json の生成・書き込み - var configContent = GenerateSpeedhackConfig(baseSpeed, toggleSpeed, holdSpeed); + var configContent = this.GenerateSpeedhackConfig(baseSpeed, toggleSpeed, holdSpeed); File.WriteAllText(targetConfigPath, configContent, new UTF8Encoding(false)); game.WolfProxyDll = true; @@ -138,7 +138,7 @@ namespace GameLauncher.Engines.Wolf var sb = new StringBuilder(); // 1. プロキシDLLの解除 - var (dllSuccess, dllMsg) = RemoveProxyDll(game); + var (dllSuccess, dllMsg) = this.RemoveProxyDll(game); sb.AppendLine(dllMsg); // 2. Game.exe バックアップからの復元(存在する場合) diff --git a/Engines/Wolf/WolfSaveService.cs b/Engines/Wolf/WolfSaveService.cs index ab7fbe2..d6ff471 100644 --- a/Engines/Wolf/WolfSaveService.cs +++ b/Engines/Wolf/WolfSaveService.cs @@ -108,7 +108,7 @@ namespace GameLauncher.Engines.Wolf catch { } } - return result.Distinct(StringComparer.OrdinalIgnoreCase).ToList(); + return [.. result.Distinct(StringComparer.OrdinalIgnoreCase)]; } /// @@ -186,7 +186,7 @@ namespace GameLauncher.Engines.Wolf throw new FileNotFoundException($"セーブデータファイルが見つかりません: {filePath}"); byte[] rawBytes = File.ReadAllBytes(filePath); - byte[] decrypted = Decrypt(rawBytes); + byte[] decrypted = this.Decrypt(rawBytes); var result = new WolfSaveData { @@ -217,10 +217,10 @@ namespace GameLauncher.Engines.Wolf } // セーブデータ内の全文字列スキャン - ScanStrings(result, decrypted, enc); + this.ScanStrings(result, decrypted, enc); // セーブデータ内の通常変数スキャン - ScanVariables(result, decrypted); + this.ScanVariables(result, decrypted); return result; } @@ -293,7 +293,7 @@ namespace GameLauncher.Engines.Wolf throw new InvalidOperationException("保存対象のデータが空です。"); // 1. バックアップ作成 (Backups フォルダへ) - string? backupPath = BackupSaveFile(model.FilePath, folderName, rootDirectory); + string? backupPath = this.BackupSaveFile(model.FilePath, folderName, rootDirectory); // 2. 変数・項目の変更を RawDecryptedBytes に書き戻し foreach (var item in model.Variables) @@ -306,7 +306,7 @@ namespace GameLauncher.Engines.Wolf } // 3. 暗号化 & チェックサム再計算 - byte[] encrypted = Encrypt(model.RawDecryptedBytes); + byte[] encrypted = this.Encrypt(model.RawDecryptedBytes); // 4. アトミック書き込み string tempFile = model.FilePath + ".tmp_" + Guid.NewGuid().ToString("N"); diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 9fd71b3..d1962e6 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -52,7 +52,7 @@ namespace GameLauncher private Process? _lastStartedProcess; private readonly ObservableCollection _games = []; - private ListCollectionView _gamesView = null!; + private readonly ListCollectionView _gamesView = null!; private readonly GameItemComparer _gameComparer = new() { SortOrder = GameSortOrder.LastLaunchedDesc }; private readonly HashSet _scannedPaths = new(StringComparer.OrdinalIgnoreCase); private CancellationTokenSource? _scanCts; @@ -60,28 +60,28 @@ namespace GameLauncher private readonly string _configFilePath; private LauncherConfig _config = new(); - private bool _isInitialized; + private readonly bool _isInitialized; private readonly System.Collections.Concurrent.ConcurrentQueue _logQueue = new(); - private System.Windows.Threading.DispatcherTimer? _logFlushTimer; + private readonly System.Windows.Threading.DispatcherTimer? _logFlushTimer; public MainWindow() { - InitializeComponent(); + this.InitializeComponent(); - _configFilePath = Path.Combine(AppPathHelper.GetExeDirectory(), "config.json"); + this._configFilePath = Path.Combine(AppPathHelper.GetExeDirectory(), "config.json"); - _gamesView = (ListCollectionView)CollectionViewSource.GetDefaultView(_games); - _gamesView.Filter = FilterGameItem; - _gamesView.CustomSort = _gameComparer; - lstGames.ItemsSource = _gamesView; + this._gamesView = (ListCollectionView)CollectionViewSource.GetDefaultView(this._games); + this._gamesView.Filter = this.FilterGameItem; + this._gamesView.CustomSort = this._gameComparer; + this.lstGames.ItemsSource = this._gamesView; // 初期ソート順 - ApplySortOrderToComboBox(GameSortOrder.LastLaunchedDesc); + this.ApplySortOrderToComboBox(GameSortOrder.LastLaunchedDesc); // 保存された設定の読み込み - LoadConfig(); + this.LoadConfig(); - _isInitialized = true; + this._isInitialized = true; // ログの非同期バッファリング更新タイマー(100ms周期で一括フラッシュしUI負荷をゼロ化) this._logFlushTimer = new System.Windows.Threading.DispatcherTimer @@ -92,23 +92,23 @@ namespace GameLauncher this._logFlushTimer.Start(); // ウィンドウ描画後に初期処理(即時一覧作成&裏での更新監視)を開始 - ContentRendered += MainWindow_ContentRendered; - Closing += MainWindow_Closing; + ContentRendered += this.MainWindow_ContentRendered; + Closing += this.MainWindow_Closing; } #region 設定のロード & セーブ private void btnOpenConfig_Click(object sender, RoutedEventArgs e) { - var dialog = new ConfigDialog(_config) + var dialog = new ConfigDialog(this._config) { Owner = this }; if (dialog.ShowDialog() == true) { - SaveConfig(); - AppendLog($"[設定変更] 設定を保存しました。(RGSS Extractor: {_config.RgssExtractorPath})"); + this.SaveConfig(); + this.AppendLog($"[設定変更] 設定を保存しました。(RGSS Extractor: {this._config.RgssExtractorPath})"); } } @@ -116,96 +116,93 @@ namespace GameLauncher { try { - if (File.Exists(_configFilePath)) + if (File.Exists(this._configFilePath)) { - string json = File.ReadAllText(_configFilePath); + string json = File.ReadAllText(this._configFilePath); var config = JsonSerializer.Deserialize(json); if (config != null) { - _config = config; - _gameComparer.SortOrder = _config.SortOrder; - ApplySortOrderToComboBox(_config.SortOrder); + this._config = config; + this._gameComparer.SortOrder = this._config.SortOrder; + this.ApplySortOrderToComboBox(this._config.SortOrder); // フィルター設定の復元 - RestoreFilterSettings(); + this.RestoreFilterSettings(); } } } catch { } - SyncDefaultPluginSettingsWithAvailablePlugins(); + this.SyncDefaultPluginSettingsWithAvailablePlugins(); } private void RestoreFilterSettings() { - switch (_config.SelectedTab) + switch (this._config.SelectedTab) { - case 1: tabMV.IsChecked = true; break; - case 2: tabMZ.IsChecked = true; break; - case 3: tabVXAce.IsChecked = true; break; - case 4: tabVX.IsChecked = true; break; - case 5: tabTyrano.IsChecked = true; break; - case 6: tabUnity.IsChecked = true; break; - case 7: tabWolf.IsChecked = true; break; - case 8: tabSrpg.IsChecked = true; break; - case 9: tabNwjs.IsChecked = true; break; - case 10: tabOther.IsChecked = true; break; - default: tabAll.IsChecked = true; break; + case 1: this.tabMV.IsChecked = true; break; + case 2: this.tabMZ.IsChecked = true; break; + case 3: this.tabVXAce.IsChecked = true; break; + case 4: this.tabVX.IsChecked = true; break; + case 5: this.tabTyrano.IsChecked = true; break; + case 6: this.tabUnity.IsChecked = true; break; + case 7: this.tabWolf.IsChecked = true; break; + case 8: this.tabSrpg.IsChecked = true; break; + case 9: this.tabNwjs.IsChecked = true; break; + case 10: this.tabOther.IsChecked = true; break; + default: this.tabAll.IsChecked = true; break; } - if (pnlUnityBackendFilter != null) - { - pnlUnityBackendFilter.Visibility = tabUnity.IsChecked == true ? Visibility.Visible : Visibility.Collapsed; - } + this.pnlUnityBackendFilter?.Visibility = this.tabUnity.IsChecked == true ? Visibility.Visible : Visibility.Collapsed; // Unityフィルター - if (_config.UnityBackendFilter == "IL2CPP") rbUnityIL2CPP.IsChecked = true; - else if (_config.UnityBackendFilter == "Mono") rbUnityMono.IsChecked = true; - else rbUnityAll.IsChecked = true; + if (this._config.UnityBackendFilter == "IL2CPP") this.rbUnityIL2CPP.IsChecked = true; + else if (this._config.UnityBackendFilter == "Mono") this.rbUnityMono.IsChecked = true; + else this.rbUnityAll.IsChecked = true; - chkFilterModdedOnly.IsChecked = _config.TkoolFilterModdedOnly; - chkFilterAsarOnly.IsChecked = _config.TkoolFilterAsarOnly; - chkFilterRgssOnly.IsChecked = _config.TkoolFilterRgssOnly; - chkFilterSaveOnly.IsChecked = _config.UnityFilterSaveOnly; - chkFilterBookmarkedOnly.IsChecked = _config.FilterBookmarkedOnly; + this.chkFilterModdedOnly.IsChecked = this._config.TkoolFilterModdedOnly; + this.chkFilterAsarOnly.IsChecked = this._config.TkoolFilterAsarOnly; + this.chkFilterRgssOnly.IsChecked = this._config.TkoolFilterRgssOnly; + this.chkFilterSaveOnly.IsChecked = this._config.UnityFilterSaveOnly; + this.chkFilterBookmarkedOnly.IsChecked = this._config.FilterBookmarkedOnly; } private void SaveConfig() { - if (!_isInitialized) return; + if (!this._isInitialized) return; try { - _config.SortOrder = _gameComparer.SortOrder; + this._config.SortOrder = this._gameComparer.SortOrder; int tabIndex = 0; - if (tabMV.IsChecked == true) tabIndex = 1; - else if (tabMZ.IsChecked == true) tabIndex = 2; - else if (tabVXAce.IsChecked == true) tabIndex = 3; - else if (tabVX.IsChecked == true) tabIndex = 4; - else if (tabTyrano.IsChecked == true) tabIndex = 5; - else if (tabUnity.IsChecked == true) tabIndex = 6; - else if (tabWolf.IsChecked == true) tabIndex = 7; - else if (tabSrpg.IsChecked == true) tabIndex = 8; - else if (tabNwjs.IsChecked == true) tabIndex = 9; - else if (tabOther.IsChecked == true) tabIndex = 10; + if (this.tabMV.IsChecked == true) tabIndex = 1; + else if (this.tabMZ.IsChecked == true) tabIndex = 2; + else if (this.tabVXAce.IsChecked == true) tabIndex = 3; + else if (this.tabVX.IsChecked == true) tabIndex = 4; + else if (this.tabTyrano.IsChecked == true) tabIndex = 5; + else if (this.tabUnity.IsChecked == true) tabIndex = 6; + else if (this.tabWolf.IsChecked == true) tabIndex = 7; + else if (this.tabSrpg.IsChecked == true) tabIndex = 8; + else if (this.tabNwjs.IsChecked == true) tabIndex = 9; + else if (this.tabOther.IsChecked == true) tabIndex = 10; - _config.SelectedTab = tabIndex; - _config.UnityBackendFilter = rbUnityIL2CPP.IsChecked == true ? "IL2CPP" : (rbUnityMono.IsChecked == true ? "Mono" : "All"); + this._config.SelectedTab = tabIndex; + this._config.UnityBackendFilter = this.rbUnityIL2CPP.IsChecked == true ? "IL2CPP" : (this.rbUnityMono.IsChecked == true ? "Mono" : "All"); - _config.TkoolFilterModdedOnly = chkFilterModdedOnly.IsChecked == true; - _config.TkoolFilterAsarOnly = chkFilterAsarOnly.IsChecked == true; - _config.TkoolFilterRgssOnly = chkFilterRgssOnly.IsChecked == true; - _config.UnityFilterSaveOnly = chkFilterSaveOnly.IsChecked == true; - _config.FilterBookmarkedOnly = chkFilterBookmarkedOnly.IsChecked == true; + this._config.TkoolFilterModdedOnly = this.chkFilterModdedOnly.IsChecked == true; + this._config.TkoolFilterAsarOnly = this.chkFilterAsarOnly.IsChecked == true; + this._config.TkoolFilterRgssOnly = this.chkFilterRgssOnly.IsChecked == true; + this._config.UnityFilterSaveOnly = this.chkFilterSaveOnly.IsChecked == true; + this._config.FilterBookmarkedOnly = this.chkFilterBookmarkedOnly.IsChecked == true; var options = new JsonSerializerOptions { WriteIndented = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }; - string json = JsonSerializer.Serialize(_config, options); - File.WriteAllText(_configFilePath, json); + string json = JsonSerializer.Serialize(this._config, options); + File.WriteAllText(this._configFilePath, json); } catch { } } @@ -215,9 +212,9 @@ namespace GameLauncher try { bool modified = false; - if (_modService.AvailablePlugins.Count == 0) + if (this._modService.AvailablePlugins.Count == 0) { - _modService.LoadAvailablePlugins(); + this._modService.LoadAvailablePlugins(); } foreach (var plugin in this._modService.AvailablePlugins) @@ -257,9 +254,9 @@ namespace GameLauncher } } - if (modified || !File.Exists(_configFilePath)) + if (modified || !File.Exists(this._configFilePath)) { - SaveConfig(); + this.SaveConfig(); } } catch { } @@ -267,11 +264,11 @@ namespace GameLauncher private void ApplySortOrderToComboBox(GameSortOrder order) { - foreach (ComboBoxItem item in cmbSortOrder.Items) + foreach (ComboBoxItem item in this.cmbSortOrder.Items) { if (item.Tag is string tag && Enum.TryParse(tag, out var parsed) && parsed == order) { - cmbSortOrder.SelectedItem = item; + this.cmbSortOrder.SelectedItem = item; break; } } @@ -283,84 +280,84 @@ namespace GameLauncher private async void MainWindow_ContentRendered(object? sender, EventArgs e) { - ContentRendered -= MainWindow_ContentRendered; + ContentRendered -= this.MainWindow_ContentRendered; - AppendLog("統合ゲームランチャー (Game Launcher) を起動しました。"); + this.AppendLog("統合ゲームランチャー (Game Launcher) を起動しました。"); // 0. ツクール改造プラグインの動的検出 - _modService.LoadAvailablePlugins(); - AppendLog($"ツクールプラグインフォルダから {_modService.AvailablePlugins.Count} 件のプラグインを認識しました。"); + this._modService.LoadAvailablePlugins(); + this.AppendLog($"ツクールプラグインフォルダから {this._modService.AvailablePlugins.Count} 件のプラグインを認識しました。"); // 1. キャッシュから全ゲームを瞬時にロードし、0秒で一覧に表示 - var cached = _scannerService.LoadCachedGamesFast(); + var cached = this._scannerService.LoadCachedGamesFast(); foreach (var item in cached) { if (item is TkoolGameItem tg) { - tg.SetDefaultApplyMod(_config.DefaultApplyMod); + tg.SetDefaultApplyMod(this._config.DefaultApplyMod); } - _games.Add(item); - _scannedPaths.Add(item.RootDirectory); + this._games.Add(item); + this._scannedPaths.Add(item.RootDirectory); } - _gamesView.Refresh(); - UpdateStatusLabels(); + this._gamesView.Refresh(); + this.UpdateStatusLabels(); - if (_games.Count > 0) + if (this._games.Count > 0) { - int tkoolCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano && !tg.IsRgss && !tg.IsWolf && !tg.IsSrpgStudio && !tg.IsNwjs); - int rgssCount = _games.Count(g => g is TkoolGameItem tg && tg.IsRgss); - int tyranoCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType == TkoolEngineType.Tyrano); - int wolfCount = _games.Count(g => g is TkoolGameItem tg && tg.IsWolf); - int srpgCount = _games.Count(g => g is TkoolGameItem tg && tg.IsSrpgStudio); - int nwjsCount = _games.Count(g => g is TkoolGameItem tg && tg.IsNwjs); - int unityCount = _games.Count(g => g is UnityGameItem); + int tkoolCount = this._games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano && !tg.IsRgss && !tg.IsWolf && !tg.IsSrpgStudio && !tg.IsNwjs); + int rgssCount = this._games.Count(g => g is TkoolGameItem tg && tg.IsRgss); + int tyranoCount = this._games.Count(g => g is TkoolGameItem tg && tg.EngineType == TkoolEngineType.Tyrano); + int wolfCount = this._games.Count(g => g is TkoolGameItem tg && tg.IsWolf); + int srpgCount = this._games.Count(g => g is TkoolGameItem tg && tg.IsSrpgStudio); + int nwjsCount = this._games.Count(g => g is TkoolGameItem tg && tg.IsNwjs); + int unityCount = this._games.Count(g => g is UnityGameItem); - AppendLog($"キャッシュから計 {_games.Count} 件(ツクールMV/MZ: {tkoolCount}, ツクールVX系: {rgssCount}, ティラノ: {tyranoCount}, ウディタ: {wolfCount}, SRPG Studio: {srpgCount}, NW.js: {nwjsCount}, Unity: {unityCount})を即時表示しました。(待たずに即起動可能です)"); - lblStatusEngine.Text = "裏で更新・実在検証を実行中..."; + this.AppendLog($"キャッシュから計 {this._games.Count} 件(ツクールMV/MZ: {tkoolCount}, ツクールVX系: {rgssCount}, ティラノ: {tyranoCount}, ウディタ: {wolfCount}, SRPG Studio: {srpgCount}, NW.js: {nwjsCount}, Unity: {unityCount})を即時表示しました。(待たずに即起動可能です)"); + this.lblStatusEngine.Text = "裏で更新・実在検証を実行中..."; } else { - AppendLog("キャッシュは見つかりませんでした。初回フルスキャンを実行します。"); - lblStatusEngine.Text = "初回スキャンを実行中..."; + this.AppendLog("キャッシュは見つかりませんでした。初回フルスキャンを実行します。"); + this.lblStatusEngine.Text = "初回スキャンを実行中..."; } // 2. 裏で実在検証・差分スキャンを実行 - await RunVerificationAndScanAsync(); + await this.RunVerificationAndScanAsync(); } private async Task RunVerificationAndScanAsync() { - _scanCts?.Cancel(); - _scanCts = new CancellationTokenSource(); - var ct = _scanCts.Token; + this._scanCts?.Cancel(); + this._scanCts = new CancellationTokenSource(); + var ct = this._scanCts.Token; try { - lblLogActivity.Text = "● スキャン中..."; + this.lblLogActivity.Text = "● スキャン中..."; // 2-1. 実在検証 & アイコン・セーブ情報エンリッチ - if (_games.Count > 0) + if (this._games.Count > 0) { - await _scannerService.VerifyAndEnrichGamesAsync( - _games.ToList(), + await this._scannerService.VerifyAndEnrichGamesAsync( + [.. this._games], onGameUpdated: game => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { - if (lstGames.SelectedItem == game) + if (this.lstGames.SelectedItem == game) { - UpdateSelectedPanel(game); + this.UpdateSelectedPanel(game); } }); }, onGameRemoved: game => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { - _games.Remove(game); - _scannedPaths.Remove(game.RootDirectory); - UpdateStatusLabels(); + this._games.Remove(game); + this._scannedPaths.Remove(game.RootDirectory); + this.UpdateStatusLabels(); }); }, ct: ct); @@ -368,76 +365,76 @@ namespace GameLauncher // 2-2. 差分スキャン(新規フォルダの走査) var targetDirs = new List(GameScannerService.DefaultTargetDirectories); - if (_config.TargetDirectories != null) + if (this._config.TargetDirectories != null) { - targetDirs.AddRange(_config.TargetDirectories); + targetDirs.AddRange(this._config.TargetDirectories); } var progress = new Progress(newGame => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { if (newGame is TkoolGameItem tg) { - tg.SetDefaultApplyMod(_config.DefaultApplyMod); - tg.SyncPluginOptions(_modService.AvailablePlugins, _config.DefaultPluginSettings); + tg.SetDefaultApplyMod(this._config.DefaultApplyMod); + tg.SyncPluginOptions(this._modService.AvailablePlugins, this._config.DefaultPluginSettings); } - _games.Add(newGame); - _scannedPaths.Add(newGame.RootDirectory); - UpdateStatusLabels(); + this._games.Add(newGame); + this._scannedPaths.Add(newGame.RootDirectory); + this.UpdateStatusLabels(); - _scannedCountSinceLastSave++; - if (_scannedCountSinceLastSave >= 5) + this._scannedCountSinceLastSave++; + if (this._scannedCountSinceLastSave >= 5) { - _scannedCountSinceLastSave = 0; - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannedCountSinceLastSave = 0; + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } }); }); - await _scannerService.ScanDirectoriesAsync(targetDirs, progress, _scannedPaths, ct); + await this._scannerService.ScanDirectoriesAsync(targetDirs, progress, this._scannedPaths, ct); // キャッシュの最終同期(削除されたゲームのブックマークもここで除去する) - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); - lblStatusEngine.Text = "準備完了"; - lblLogActivity.Text = ""; - AppendLog($"スキャンが完了しました。総ゲーム数: {_games.Count} 件。"); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); + this.lblStatusEngine.Text = "準備完了"; + this.lblLogActivity.Text = ""; + this.AppendLog($"スキャンが完了しました。総ゲーム数: {this._games.Count} 件。"); } catch (OperationCanceledException) { - lblStatusEngine.Text = "スキャン中断"; - lblLogActivity.Text = ""; + this.lblStatusEngine.Text = "スキャン中断"; + this.lblLogActivity.Text = ""; } catch (Exception ex) { - lblStatusEngine.Text = "スキャンエラー"; - lblLogActivity.Text = ""; - AppendLog($"スキャン中にエラーが発生しました: {ex.Message}"); + this.lblStatusEngine.Text = "スキャンエラー"; + this.lblLogActivity.Text = ""; + this.AppendLog($"スキャン中にエラーが発生しました: {ex.Message}"); } } private async void btnRescan_Click(object sender, RoutedEventArgs e) { - btnRescan.IsEnabled = false; - AppendLog("手動再スキャンを開始します..."); - _scannedPaths.Clear(); - foreach (var g in _games) + this.btnRescan.IsEnabled = false; + this.AppendLog("手動再スキャンを開始します..."); + this._scannedPaths.Clear(); + foreach (var g in this._games) { - _scannedPaths.Add(g.RootDirectory); + this._scannedPaths.Add(g.RootDirectory); } - await RunVerificationAndScanAsync(); - btnRescan.IsEnabled = true; + await this.RunVerificationAndScanAsync(); + this.btnRescan.IsEnabled = true; } private void MainWindow_Closing(object? sender, CancelEventArgs e) { - _scanCts?.Cancel(); - SaveConfig(); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scanCts?.Cancel(); + this.SaveConfig(); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } #endregion @@ -449,7 +446,7 @@ namespace GameLauncher if (item is not GameItemBase game) return false; // 1. テキスト検索 - string query = txtSearch.Text.Trim(); + string query = this.txtSearch.Text.Trim(); if (!string.IsNullOrEmpty(query)) { bool matchesTitle = game.Title.Contains(query, StringComparison.OrdinalIgnoreCase); @@ -470,125 +467,122 @@ namespace GameLauncher } // 2. エンジンの種類フィルター - if (tabMV.IsChecked == true) + if (this.tabMV.IsChecked == true) { if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.MV) return false; } - else if (tabMZ.IsChecked == true) + else if (this.tabMZ.IsChecked == true) { if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.MZ) return false; } - else if (tabVXAce.IsChecked == true) + else if (this.tabVXAce.IsChecked == true) { if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.VXAce) return false; } - else if (tabVX.IsChecked == true) + else if (this.tabVX.IsChecked == true) { if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.VX) return false; } - else if (tabTyrano.IsChecked == true) + else if (this.tabTyrano.IsChecked == true) { if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.Tyrano) return false; } - else if (tabWolf.IsChecked == true) + else if (this.tabWolf.IsChecked == true) { if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.Wolf) return false; } - else if (tabSrpg.IsChecked == true) + else if (this.tabSrpg.IsChecked == true) { if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.SrpgStudio) return false; } - else if (tabUnity.IsChecked == true) + else if (this.tabUnity.IsChecked == true) { if (game is not UnityGameItem ug) return false; - if (rbUnityIL2CPP.IsChecked == true && ug.BackendType != UnityBackendType.IL2CPP) return false; - if (rbUnityMono.IsChecked == true && ug.BackendType != UnityBackendType.Mono) return false; + if (this.rbUnityIL2CPP.IsChecked == true && ug.BackendType != UnityBackendType.IL2CPP) return false; + if (this.rbUnityMono.IsChecked == true && ug.BackendType != UnityBackendType.Mono) return false; } - else if (tabNwjs.IsChecked == true) + else if (this.tabNwjs.IsChecked == true) { if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.Nwjs) return false; } - else if (tabOther.IsChecked == true) + else if (this.tabOther.IsChecked == true) { if (!game.IsOther) return false; } // 3. 追加属性フィルター(全タブ共通) - if (chkFilterBookmarkedOnly.IsChecked == true && !game.IsBookmarked) return false; - if (chkFilterModdedOnly.IsChecked == true && !game.IsModded) return false; - if (chkFilterAsarOnly.IsChecked == true && (game is not TkoolGameItem tgAsar || !tgAsar.IsAsar)) return false; - if (chkFilterRgssOnly.IsChecked == true && (game is not TkoolGameItem tgRgss || !tgRgss.HasRgssArchive)) return false; - if (chkFilterSrpgOnly.IsChecked == true && (game is not TkoolGameItem tgSrpg || !tgSrpg.HasSrpgArchive)) return false; - if (chkFilterSaveOnly.IsChecked == true && (game is not UnityGameItem ugSave || !ugSave.HasSaveData)) return false; + if (this.chkFilterBookmarkedOnly.IsChecked == true && !game.IsBookmarked) return false; + if (this.chkFilterModdedOnly.IsChecked == true && !game.IsModded) return false; + if (this.chkFilterAsarOnly.IsChecked == true && (game is not TkoolGameItem tgAsar || !tgAsar.IsAsar)) return false; + if (this.chkFilterRgssOnly.IsChecked == true && (game is not TkoolGameItem tgRgss || !tgRgss.HasRgssArchive)) return false; + if (this.chkFilterSrpgOnly.IsChecked == true && (game is not TkoolGameItem tgSrpg || !tgSrpg.HasSrpgArchive)) return false; + if (this.chkFilterSaveOnly.IsChecked == true && (game is not UnityGameItem ugSave || !ugSave.HasSaveData)) return false; return true; } private void EngineTab_Checked(object sender, RoutedEventArgs e) { - if (!_isInitialized) return; + if (!this._isInitialized) return; - if (pnlUnityBackendFilter != null) - { - pnlUnityBackendFilter.Visibility = tabUnity.IsChecked == true ? Visibility.Visible : Visibility.Collapsed; - } + this.pnlUnityBackendFilter?.Visibility = this.tabUnity.IsChecked == true ? Visibility.Visible : Visibility.Collapsed; - _gamesView?.Refresh(); - UpdateStatusLabels(); - SaveConfig(); + this._gamesView?.Refresh(); + this.UpdateStatusLabels(); + this.SaveConfig(); } private void FilterChanged(object sender, RoutedEventArgs e) { - if (!_isInitialized) return; - _gamesView?.Refresh(); - UpdateStatusLabels(); - SaveConfig(); + if (!this._isInitialized) return; + this._gamesView?.Refresh(); + this.UpdateStatusLabels(); + this.SaveConfig(); } private void txtSearch_TextChanged(object sender, TextChangedEventArgs e) { - if (!_isInitialized) return; - _gamesView?.Refresh(); - UpdateStatusLabels(); + if (!this._isInitialized) return; + this._gamesView?.Refresh(); + this.UpdateStatusLabels(); } private void btnClearSearch_Click(object sender, RoutedEventArgs e) { - txtSearch.Text = string.Empty; + this.txtSearch.Text = string.Empty; } private void cmbSortOrder_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if (!_isInitialized) return; - if (cmbSortOrder.SelectedItem is ComboBoxItem item && + if (!this._isInitialized) return; + if (this.cmbSortOrder.SelectedItem is ComboBoxItem item && item.Tag is string tag && Enum.TryParse(tag, out var order)) { - _gameComparer.SortOrder = order; - _gamesView?.Refresh(); - SaveConfig(); + this._gameComparer.SortOrder = order; + this._gamesView?.Refresh(); + this.SaveConfig(); } } private void UpdateStatusLabels() { - if (lblStatusSummary == null || lblStatusBreakdown == null) return; + if (this.lblStatusSummary == null || this.lblStatusBreakdown == null) return; - int total = _games.Count; - int visible = _gamesView?.Count ?? 0; - int tkoolCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano && !tg.IsRgss && !tg.IsWolf && !tg.IsSrpgStudio && !tg.IsNwjs && !tg.IsOther); - int rgssCount = _games.Count(g => g is TkoolGameItem tg && tg.IsRgss); - int tyranoCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType == TkoolEngineType.Tyrano); - int wolfCount = _games.Count(g => g is TkoolGameItem tg && tg.IsWolf); - int srpgCount = _games.Count(g => g is TkoolGameItem tg && tg.IsSrpgStudio); - int nwjsCount = _games.Count(g => g is TkoolGameItem tg && tg.IsNwjs); - int unityCount = _games.Count(g => g is UnityGameItem); - int otherCount = _games.Count(g => g.IsOther); - int bookmarkCount = _games.Count(g => g.IsBookmarked); + int total = this._games.Count; + int visible = this._gamesView?.Count ?? 0; + int tkoolCount = this._games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano && !tg.IsRgss && !tg.IsWolf && !tg.IsSrpgStudio && !tg.IsNwjs && !tg.IsOther); + int rgssCount = this._games.Count(g => g is TkoolGameItem tg && tg.IsRgss); + int tyranoCount = this._games.Count(g => g is TkoolGameItem tg && tg.EngineType == TkoolEngineType.Tyrano); + int wolfCount = this._games.Count(g => g is TkoolGameItem tg && tg.IsWolf); + int srpgCount = this._games.Count(g => g is TkoolGameItem tg && tg.IsSrpgStudio); + int nwjsCount = this._games.Count(g => g is TkoolGameItem tg && tg.IsNwjs); + int unityCount = this._games.Count(g => g is UnityGameItem); + int otherCount = this._games.Count(g => g.IsOther); + int bookmarkCount = this._games.Count(g => g.IsBookmarked); - lblStatusSummary.Text = $"総ゲーム数: {total} 件 | 表示: {visible} 件 | ★ ブックマーク: {bookmarkCount} 件"; - lblStatusBreakdown.Text = $"(ツクールMV/MZ: {tkoolCount}, ツクールVX系: {rgssCount}, ティラノ: {tyranoCount}, ウディタ: {wolfCount}, SRPG Studio: {srpgCount}, NW.js: {nwjsCount}, Unity: {unityCount}, その他: {otherCount})"; + this.lblStatusSummary.Text = $"総ゲーム数: {total} 件 | 表示: {visible} 件 | ★ ブックマーク: {bookmarkCount} 件"; + this.lblStatusBreakdown.Text = $"(ツクールMV/MZ: {tkoolCount}, ツクールVX系: {rgssCount}, ティラノ: {tyranoCount}, ウディタ: {wolfCount}, SRPG Studio: {srpgCount}, NW.js: {nwjsCount}, Unity: {unityCount}, その他: {otherCount})"; } #endregion @@ -597,45 +591,44 @@ namespace GameLauncher private void lstGames_SelectionChanged(object sender, SelectionChangedEventArgs e) { - var selected = lstGames.SelectedItem as GameItemBase; - if (selected == null) + if (this.lstGames.SelectedItem is not GameItemBase selected) { - pnlNoSelection.Visibility = Visibility.Visible; - pnlSelectedContent.Visibility = Visibility.Collapsed; + this.pnlNoSelection.Visibility = Visibility.Visible; + this.pnlSelectedContent.Visibility = Visibility.Collapsed; return; } - pnlNoSelection.Visibility = Visibility.Collapsed; - pnlSelectedContent.Visibility = Visibility.Visible; + this.pnlNoSelection.Visibility = Visibility.Collapsed; + this.pnlSelectedContent.Visibility = Visibility.Visible; - UpdateSelectedPanel(selected); + this.UpdateSelectedPanel(selected); } private void UpdateSelectedPanel(GameItemBase game) { if (game is TkoolGameItem tg) { - pnlTkoolDetails.Visibility = Visibility.Visible; - pnlUnityDetails.Visibility = Visibility.Collapsed; + this.pnlTkoolDetails.Visibility = Visibility.Visible; + this.pnlUnityDetails.Visibility = Visibility.Collapsed; // プラグイン設定の同期(未初期化の場合) if (tg.PluginOptions.Count == 0) { - tg.SyncPluginOptions(_modService.AvailablePlugins, _config.DefaultPluginSettings); + tg.SyncPluginOptions(this._modService.AvailablePlugins, this._config.DefaultPluginSettings); } } else if (game is UnityGameItem) { - pnlTkoolDetails.Visibility = Visibility.Collapsed; - pnlUnityDetails.Visibility = Visibility.Visible; + this.pnlTkoolDetails.Visibility = Visibility.Collapsed; + this.pnlUnityDetails.Visibility = Visibility.Visible; } } private async void lstGames_MouseDoubleClick(object sender, MouseButtonEventArgs e) { - if (lstGames.SelectedItem is GameItemBase game) + if (this.lstGames.SelectedItem is GameItemBase game) { - await LaunchGameAsync(game); + await this.LaunchGameAsync(game); } } @@ -645,17 +638,17 @@ namespace GameLauncher private async void btnLaunchGame_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is GameItemBase game) + if (this.lstGames.SelectedItem is GameItemBase game) { - await LaunchGameAsync(game); + await this.LaunchGameAsync(game); } } private async void MenuLaunch_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is GameItemBase game) + if (this.lstGames.SelectedItem is GameItemBase game) { - await LaunchGameAsync(game); + await this.LaunchGameAsync(game); } } @@ -681,7 +674,7 @@ namespace GameLauncher if (string.IsNullOrEmpty(effectiveExe) || !File.Exists(effectiveExe)) { MessageBox.Show($"実行ファイルが見つかりません:\n{effectiveExe}", "起動エラー", MessageBoxButton.OK, MessageBoxImage.Warning); - AppendLog($"[起動失敗] 実行ファイルが見つかりません: {effectiveExe}"); + this.AppendLog($"[起動失敗] 実行ファイルが見つかりません: {effectiveExe}"); return; } @@ -689,21 +682,21 @@ namespace GameLauncher { if (game is TkoolGameItem tg) { - await LaunchTkoolGameAsync(tg); + await this.LaunchTkoolGameAsync(tg); } else if (game is UnityGameItem ug) { - LaunchUnityGame(ug); + this.LaunchUnityGame(ug); } else { - StartGameProcess(game); + this.StartGameProcess(game); } } catch (Exception ex) { MessageBox.Show($"ゲーム起動中にエラーが発生しました:\n{ex.Message}", "起動エラー", MessageBoxButton.OK, MessageBoxImage.Error); - AppendLog($"[起動エラー] {game.Title}: {ex.Message}"); + this.AppendLog($"[起動エラー] {game.Title}: {ex.Message}"); } } @@ -715,17 +708,17 @@ namespace GameLauncher // プロキシDLLの適用または解除の同期 if (tg.WolfProxyDll) { - var (pSuccess, pMsg) = _wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0); - AppendLog($"[ウディタ プロキシDLL] {pMsg.Replace("\n", " ")}"); + var (pSuccess, pMsg) = this._wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0); + this.AppendLog($"[ウディタ プロキシDLL] {pMsg.Replace("\n", " ")}"); } - else if (_wolfModService.IsProxyDllInstalled(tg)) + else if (this._wolfModService.IsProxyDllInstalled(tg)) { - var (pSuccess, pMsg) = _wolfModService.RemoveProxyDll(tg); - AppendLog($"[ウディタ プロキシDLL] {pMsg}"); + var (pSuccess, pMsg) = this._wolfModService.RemoveProxyDll(tg); + this.AppendLog($"[ウディタ プロキシDLL] {pMsg}"); } - AppendLog($"[ウディタ起動] {tg.Title} を起動します..."); - StartGameProcess(tg); + this.AppendLog($"[ウディタ起動] {tg.Title} を起動します..."); + this.StartGameProcess(tg); return; } @@ -735,17 +728,17 @@ namespace GameLauncher // プロキシDLLの適用または解除の同期 if (tg.SrpgProxyDll) { - bool ok = _srpgModService.EnableProxyDll(tg.RootDirectory, tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0); - AppendLog($"[SRPG Studio プロキシDLL] 倍速プロキシDLLを配置しました (倍率: {(tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0):F1}x)"); + bool ok = this._srpgModService.EnableProxyDll(tg.RootDirectory, tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0); + this.AppendLog($"[SRPG Studio プロキシDLL] 倍速プロキシDLLを配置しました (倍率: {(tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0):F1}x)"); } else if (SrpgModService.IsProxyDllEnabled(tg.RootDirectory)) { - _srpgModService.DisableProxyDll(tg.RootDirectory); - AppendLog("[SRPG Studio プロキシDLL] プロキシDLLを解除しました"); + this._srpgModService.DisableProxyDll(tg.RootDirectory); + this.AppendLog("[SRPG Studio プロキシDLL] プロキシDLLを解除しました"); } - AppendLog($"[SRPG Studio起動] {tg.Title} を起動します..."); - StartGameProcess(tg); + this.AppendLog($"[SRPG Studio起動] {tg.Title} を起動します..."); + this.StartGameProcess(tg); return; } @@ -753,8 +746,8 @@ namespace GameLauncher // EVB 解凍済みなら解凍後の exe を起動対象に切り替えます。 if (tg.IsStandaloneExePackage) { - AppendLog($"[単体exe起動] {tg.Title}: 起動のみ対応(埋め込み展開機能は廃止)。"); - StartGameProcess(tg); + this.AppendLog($"[単体exe起動] {tg.Title}: 起動のみ対応(埋め込み展開機能は廃止)。"); + this.StartGameProcess(tg); return; } @@ -771,7 +764,7 @@ namespace GameLauncher if (ask == MessageBoxResult.Yes) { - await ExtractAsarForGame(tg, autoLaunchAfter: true); + await this.ExtractAsarForGame(tg, autoLaunchAfter: true); return; } else if (ask == MessageBoxResult.Cancel) @@ -783,8 +776,8 @@ namespace GameLauncher // RGSSゲーム(ツクールVX / VX Ace)の場合 if (tg.IsRgss) { - var (success, msg) = await _rgssModService.ApplyOrRestoreModAsync(tg, tg.PluginSettings, _config.RgssExtractorPath); - AppendLog($"[RGSS改造処理] {tg.Title}: {msg}"); + var (success, msg) = await this._rgssModService.ApplyOrRestoreModAsync(tg, tg.PluginSettings, this._config.RgssExtractorPath); + this.AppendLog($"[RGSS改造処理] {tg.Title}: {msg}"); if (!success && tg.ApplyMod) { var res = MessageBox.Show( @@ -800,45 +793,45 @@ namespace GameLauncher { if (tg.ApplyMod) { - var (success, msg) = _tyranoModService.ApplyMod(tg, tg.PluginSettings); - AppendLog($"[ティラノ改造] {tg.Title}: {msg}"); + var (success, msg) = this._tyranoModService.ApplyMod(tg, tg.PluginSettings); + this.AppendLog($"[ティラノ改造] {tg.Title}: {msg}"); } else { - var (success, msg) = _tyranoModService.RestoreOriginal(tg); - AppendLog($"[ティラノ復元] {tg.Title}: {msg}"); + var (success, msg) = this._tyranoModService.RestoreOriginal(tg); + this.AppendLog($"[ティラノ復元] {tg.Title}: {msg}"); } } // その他のゲーム(ツクール以外のゲーム) else if (tg.IsOther) { - AppendLog($"[その他起動] {tg.Title} を起動します..."); + this.AppendLog($"[その他起動] {tg.Title} を起動します..."); } // スクリプト改造の適用または復元(ツクールMV/MZ) else { - var (success, msg) = _modService.ApplyOrRestoreMod(tg, _config.DefaultPluginSettings); - AppendLog($"[ツクール改造処理] {tg.Title}: {msg}"); + var (success, msg) = this._modService.ApplyOrRestoreMod(tg, this._config.DefaultPluginSettings); + this.AppendLog($"[ツクール改造処理] {tg.Title}: {msg}"); } - StartGameProcess(tg); + this.StartGameProcess(tg); // RGSSゲーム(ツクールVX / VX Ace)で外部ツール方式のウィンドウ拡大がONの場合、起動後に拡大を適用 if (tg.IsRgss && tg.IsPluginEnabled("RgssWindowResizeExternal", tg.PluginSettings, false)) { - var resizeProc = _lastStartedProcess; + var resizeProc = this._lastStartedProcess; if (resizeProc != null) { - var (resizeOk, resizeMsg) = await _windowResizeService.ApplyResizeAsync(resizeProc, _config.WindowResizeToolPath); - AppendLog($"[ウィンドウ拡大] {tg.Title}: {resizeMsg}"); + var (resizeOk, resizeMsg) = await this._windowResizeService.ApplyResizeAsync(resizeProc, this._config.WindowResizeToolPath); + this.AppendLog($"[ウィンドウ拡大] {tg.Title}: {resizeMsg}"); } } } private void LaunchUnityGame(UnityGameItem ug) { - AppendLog($"[Unity起動] {ug.Title} (Backend: {ug.BackendBadgeText}) を起動します..."); - StartGameProcess(ug); + this.AppendLog($"[Unity起動] {ug.Title} (Backend: {ug.BackendBadgeText}) を起動します..."); + this.StartGameProcess(ug); } private void StartGameProcess(GameItemBase game) @@ -862,7 +855,7 @@ namespace GameLauncher if (game is TkoolGameItem && launchExe != game.ExecutablePath) { - AppendLog($"[EVB起動] 解凍後の実行ファイルを使用: {Path.GetFileName(launchExe)}"); + this.AppendLog($"[EVB起動] 解凍後の実行ファイルを使用: {Path.GetFileName(launchExe)}"); } var workingDir = Path.GetDirectoryName(launchExe) ?? game.RootDirectory; @@ -887,21 +880,21 @@ namespace GameLauncher Directory.CreateDirectory(profileDir); } startInfo.Arguments = $"--user-data-dir=\"{profileDir}\" --allow-file-access-from-files"; - AppendLog($"[プロファイル] 専用プロファイルを指定: {Path.GetFileName(profileDir)}"); + this.AppendLog($"[プロファイル] 専用プロファイルを指定: {Path.GetFileName(profileDir)}"); } catch (Exception pEx) { - AppendLog($"[警告] 専用プロファイルの準備に失敗しました(通常引数で起動します): {pEx.Message}"); + this.AppendLog($"[警告] 専用プロファイルの準備に失敗しました(通常引数で起動します): {pEx.Message}"); } } - _lastStartedProcess = Process.Start(startInfo); + this._lastStartedProcess = Process.Start(startInfo); game.LastLaunched = DateTime.Now; - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); - AppendLog($"🚀 {game.Title} を起動しました。"); + this.AppendLog($"🚀 {game.Title} を起動しました。"); } #endregion @@ -910,8 +903,7 @@ namespace GameLauncher private void listContextMenu_ContextMenuOpening(object sender, ContextMenuEventArgs e) { - var selected = lstGames.SelectedItem as GameItemBase; - if (selected == null) + if (this.lstGames.SelectedItem is not GameItemBase selected) { e.Handled = true; return; @@ -921,59 +913,59 @@ namespace GameLauncher bool isUnity = selected is UnityGameItem; // ツクール専用メニュー - menuTkoolOpenFolder.Visibility = isTkool ? Visibility.Visible : Visibility.Collapsed; - menuTkoolRepairResources.Visibility = isTkool ? Visibility.Visible : Visibility.Collapsed; - menuTkoolRestoreOriginal.Visibility = isTkool ? Visibility.Visible : Visibility.Collapsed; + this.menuTkoolOpenFolder.Visibility = isTkool ? Visibility.Visible : Visibility.Collapsed; + this.menuTkoolRepairResources.Visibility = isTkool ? Visibility.Visible : Visibility.Collapsed; + this.menuTkoolRestoreOriginal.Visibility = isTkool ? Visibility.Visible : Visibility.Collapsed; if (selected is TkoolGameItem tg) { // ASAR メニュー if (tg.IsAsar) { - menuTkoolExtractAsar.Visibility = !tg.IsAsarExtracted ? Visibility.Visible : Visibility.Collapsed; - menuTkoolRestoreAsar.Visibility = tg.IsAsarExtracted ? Visibility.Visible : Visibility.Collapsed; + this.menuTkoolExtractAsar.Visibility = !tg.IsAsarExtracted ? Visibility.Visible : Visibility.Collapsed; + this.menuTkoolRestoreAsar.Visibility = tg.IsAsarExtracted ? Visibility.Visible : Visibility.Collapsed; } else { - menuTkoolExtractAsar.Visibility = Visibility.Collapsed; - menuTkoolRestoreAsar.Visibility = Visibility.Collapsed; + this.menuTkoolExtractAsar.Visibility = Visibility.Collapsed; + this.menuTkoolRestoreAsar.Visibility = Visibility.Collapsed; } // RGSS メニュー if (tg.IsRgss && tg.HasRgssArchive) { - menuTkoolExtractRgss.Visibility = !tg.IsRgssExtracted ? Visibility.Visible : Visibility.Collapsed; - menuTkoolRestoreRgss.Visibility = tg.IsRgssExtracted ? Visibility.Visible : Visibility.Collapsed; + this.menuTkoolExtractRgss.Visibility = !tg.IsRgssExtracted ? Visibility.Visible : Visibility.Collapsed; + this.menuTkoolRestoreRgss.Visibility = tg.IsRgssExtracted ? Visibility.Visible : Visibility.Collapsed; } else { - menuTkoolExtractRgss.Visibility = Visibility.Collapsed; - menuTkoolRestoreRgss.Visibility = Visibility.Collapsed; + this.menuTkoolExtractRgss.Visibility = Visibility.Collapsed; + this.menuTkoolRestoreRgss.Visibility = Visibility.Collapsed; } // plugins.js は MV/MZ のみ - menuTkoolOpenPluginsJs.Visibility = (tg.IsMV || tg.IsMZ) && File.Exists(tg.PluginsJsPath) ? Visibility.Visible : Visibility.Collapsed; + this.menuTkoolOpenPluginsJs.Visibility = (tg.IsMV || tg.IsMZ) && File.Exists(tg.PluginsJsPath) ? Visibility.Visible : Visibility.Collapsed; // 専用プロファイルフォルダは Chromium/NW.js 系(MV/MZ/Tyrano)のみ - menuTkoolOpenProfile.Visibility = !tg.IsRgss ? Visibility.Visible : Visibility.Collapsed; + this.menuTkoolOpenProfile.Visibility = !tg.IsRgss ? Visibility.Visible : Visibility.Collapsed; } else { - menuTkoolExtractAsar.Visibility = Visibility.Collapsed; - menuTkoolRestoreAsar.Visibility = Visibility.Collapsed; - menuTkoolExtractRgss.Visibility = Visibility.Collapsed; - menuTkoolRestoreRgss.Visibility = Visibility.Collapsed; - menuTkoolRepairResources.Visibility = Visibility.Collapsed; - menuTkoolOpenPluginsJs.Visibility = Visibility.Collapsed; - menuTkoolOpenProfile.Visibility = Visibility.Collapsed; + this.menuTkoolExtractAsar.Visibility = Visibility.Collapsed; + this.menuTkoolRestoreAsar.Visibility = Visibility.Collapsed; + this.menuTkoolExtractRgss.Visibility = Visibility.Collapsed; + this.menuTkoolRestoreRgss.Visibility = Visibility.Collapsed; + this.menuTkoolRepairResources.Visibility = Visibility.Collapsed; + this.menuTkoolOpenPluginsJs.Visibility = Visibility.Collapsed; + this.menuTkoolOpenProfile.Visibility = Visibility.Collapsed; } // Unity専用メニュー - menuUnitySaveEditor.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; - menuUnityOpenFolder.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; - menuUnityOpenLocalLow.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; - menuUnityOpenRegedit.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; - menuUnityBackupSave.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; + this.menuUnitySaveEditor.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; + this.menuUnityOpenFolder.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; + this.menuUnityOpenLocalLow.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; + this.menuUnityOpenRegedit.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; + this.menuUnityBackupSave.Visibility = isUnity ? Visibility.Visible : Visibility.Collapsed; } #endregion @@ -982,17 +974,17 @@ namespace GameLauncher private async void btnExtractAsar_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - await ExtractAsarForGame(tg, autoLaunchAfter: false); + await this.ExtractAsarForGame(tg, autoLaunchAfter: false); } } private async void MenuExtractAsar_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - await ExtractAsarForGame(tg, autoLaunchAfter: false); + await this.ExtractAsarForGame(tg, autoLaunchAfter: false); } } @@ -1000,13 +992,13 @@ namespace GameLauncher { if (!tg.IsAsar || string.IsNullOrEmpty(tg.AsarPath)) return; - btnExtractAsar.IsEnabled = false; - pbAsarProgress.Visibility = Visibility.Visible; - lblAsarProgressStatus.Visibility = Visibility.Visible; - pbAsarProgress.Value = 0; - lblAsarProgressStatus.Text = "ASAR を解凍中..."; + this.btnExtractAsar.IsEnabled = false; + this.pbAsarProgress.Visibility = Visibility.Visible; + this.lblAsarProgressStatus.Visibility = Visibility.Visible; + this.pbAsarProgress.Value = 0; + this.lblAsarProgressStatus.Text = "ASAR を解凍中..."; - AppendLog($"[ASAR解凍開始] {tg.Title} ({tg.AsarPath})"); + this.AppendLog($"[ASAR解凍開始] {tg.Title} ({tg.AsarPath})"); var outputDir = tg.AsarExtractedDirPath; if (string.IsNullOrEmpty(outputDir)) @@ -1018,15 +1010,15 @@ namespace GameLauncher var progress = new Progress<(long extractedBytes, long totalBytes, int currentFileIndex, int totalFiles, string currentFileName)>(p => { int pct = p.totalFiles > 0 ? (int)((double)p.currentFileIndex / p.totalFiles * 100) : 0; - pbAsarProgress.Value = pct; - lblAsarProgressStatus.Text = $"解凍中 ({p.currentFileIndex}/{p.totalFiles}): {p.currentFileName}"; + this.pbAsarProgress.Value = pct; + this.lblAsarProgressStatus.Text = $"解凍中 ({p.currentFileIndex}/{p.totalFiles}): {p.currentFileName}"; }); - var (success, message) = await _asarService.ExtractAsarAsync(tg.AsarPath, outputDir, progress); + var (success, message) = await this._asarService.ExtractAsarAsync(tg.AsarPath, outputDir, progress); - pbAsarProgress.Visibility = Visibility.Collapsed; - lblAsarProgressStatus.Visibility = Visibility.Collapsed; - btnExtractAsar.IsEnabled = true; + this.pbAsarProgress.Visibility = Visibility.Collapsed; + this.lblAsarProgressStatus.Visibility = Visibility.Collapsed; + this.btnExtractAsar.IsEnabled = true; if (success) { @@ -1038,36 +1030,36 @@ namespace GameLauncher tg.PluginsJsPath = Path.Combine(outputDir, relJs.Replace('/', Path.DirectorySeparatorChar)); tg.PluginsDirPath = Path.Combine(Path.GetDirectoryName(tg.PluginsJsPath)!, "plugins"); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); - AppendLog($"[ASAR解凍成功] {message}"); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); + this.AppendLog($"[ASAR解凍成功] {message}"); MessageBox.Show(message, "ASAR 解凍完了", MessageBoxButton.OK, MessageBoxImage.Information); if (autoLaunchAfter) { - await LaunchGameAsync(tg); + await this.LaunchGameAsync(tg); } } else { - AppendLog($"[ASAR解凍失敗] {message}"); + this.AppendLog($"[ASAR解凍失敗] {message}"); MessageBox.Show(message, "ASAR 解凍エラー", MessageBoxButton.OK, MessageBoxImage.Error); } } private async void btnRestoreAsar_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - await RestoreAsarForGame(tg); + await this.RestoreAsarForGame(tg); } } private async void MenuRestoreAsar_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - await RestoreAsarForGame(tg); + await this.RestoreAsarForGame(tg); } } @@ -1077,13 +1069,13 @@ namespace GameLauncher /// private async void btnEvbUnpack_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsEvbPacked) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsEvbPacked) return; - btnEvbUnpack.IsEnabled = false; - AppendLog($"[EVB解凍開始] {tg.Title}"); + this.btnEvbUnpack.IsEnabled = false; + this.AppendLog($"[EVB解凍開始] {tg.Title}"); try { - var progress = new Progress(m => AppendLog($"[EVB解凍] {m}")); + var progress = new Progress(m => this.AppendLog($"[EVB解凍] {m}")); var result = await Task.Run(() => new EvbUnpackService().Unpack(tg.RootDirectory, progress)); @@ -1095,31 +1087,31 @@ namespace GameLauncher tg.EvbUnderlyingEngine = result.UnderlyingEngine == EngineDetectionHelper.EngineUnknown ? string.Empty : result.UnderlyingEngine; - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); - AppendLog("[EVB解凍完了] =============================="); - AppendLog($" ・対象 : {tg.Title}"); - AppendLog($" ・出力先 : {result.OutputDirectory}"); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); + this.AppendLog("[EVB解凍完了] =============================="); + this.AppendLog($" ・対象 : {tg.Title}"); + this.AppendLog($" ・出力先 : {result.OutputDirectory}"); if (!string.IsNullOrEmpty(result.BackupExePath)) { - AppendLog($" ・元exe : {Path.GetFileName(result.BackupExePath)}(.glbak に退避済み)"); + this.AppendLog($" ・元exe : {Path.GetFileName(result.BackupExePath)}(.glbak に退避済み)"); } - AppendLog($" ・本来のエンジン: {(string.IsNullOrEmpty(tg.EvbUnderlyingEngine) ? "未判定" : tg.EvbUnderlyingEngine)}"); - AppendLog(" ・次の操作: 再スキャンすると解凍後の内容で起動できます。"); - AppendLog("[EVB解凍完了] =============================="); + this.AppendLog($" ・本来のエンジン: {(string.IsNullOrEmpty(tg.EvbUnderlyingEngine) ? "未判定" : tg.EvbUnderlyingEngine)}"); + this.AppendLog(" ・次の操作: 再スキャンすると解凍後の内容で起動できます。"); + this.AppendLog("[EVB解凍完了] =============================="); } else { - AppendLog("[EVB解凍失敗] =============================="); - AppendLog($" ・対象 : {tg.Title}"); - AppendLog($" ・原因 : {result.Message}"); - AppendLog(" ・対処 : evbunpack.exe の配置確認、または -pe 10_70 / 7_80 を変えて再試行してください。"); - AppendLog("[EVB解凍失敗] =============================="); + this.AppendLog("[EVB解凍失敗] =============================="); + this.AppendLog($" ・対象 : {tg.Title}"); + this.AppendLog($" ・原因 : {result.Message}"); + this.AppendLog(" ・対処 : evbunpack.exe の配置確認、または -pe 10_70 / 7_80 を変えて再試行してください。"); + this.AppendLog("[EVB解凍失敗] =============================="); } } finally { - btnEvbUnpack.IsEnabled = true; + this.btnEvbUnpack.IsEnabled = true; } } @@ -1128,9 +1120,9 @@ namespace GameLauncher /// private void btnEvbRestore_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsEvbPacked) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsEvbPacked) return; - var progress = new Progress(m => AppendLog($"[EVB復元] {m}")); + var progress = new Progress(m => this.AppendLog($"[EVB復元] {m}")); var restored = EvbUnpackService.Restore(tg.RootDirectory, progress); if (restored) @@ -1138,19 +1130,19 @@ namespace GameLauncher tg.IsEvbExtracted = false; tg.EvbExtractedDirPath = null; tg.EvbUnderlyingEngine = string.Empty; - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); - AppendLog("[EVB復元完了] =============================="); - AppendLog($" ・対象 : {tg.Title}"); - AppendLog(" ・内容 : 解凍フォルダを削除し、元 exe(.glbak)を復元しました。"); - AppendLog("[EVB復元完了] =============================="); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); + this.AppendLog("[EVB復元完了] =============================="); + this.AppendLog($" ・対象 : {tg.Title}"); + this.AppendLog(" ・内容 : 解凍フォルダを削除し、元 exe(.glbak)を復元しました。"); + this.AppendLog("[EVB復元完了] =============================="); } else { - AppendLog("[EVB復元] =============================="); - AppendLog($" ・対象 : {tg.Title}"); - AppendLog(" ・内容 : 復元対象(解凍フォルダ / .glbak)がありません。"); - AppendLog("[EVB復元] =============================="); + this.AppendLog("[EVB復元] =============================="); + this.AppendLog($" ・対象 : {tg.Title}"); + this.AppendLog(" ・内容 : 復元対象(解凍フォルダ / .glbak)がありません。"); + this.AppendLog("[EVB復元] =============================="); } } @@ -1225,24 +1217,24 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - btnRestoreAsar.IsEnabled = false; - AppendLog($"[ASAR復元開始] {tg.Title}"); + this.btnRestoreAsar.IsEnabled = false; + this.AppendLog($"[ASAR復元開始] {tg.Title}"); - var (success, message) = await _asarService.RestoreAsarAsync(tg.AsarPath, tg.AsarExtractedDirPath); - btnRestoreAsar.IsEnabled = true; + var (success, message) = await this._asarService.RestoreAsarAsync(tg.AsarPath, tg.AsarExtractedDirPath); + this.btnRestoreAsar.IsEnabled = true; if (success) { tg.IsAsarExtracted = false; tg.IsModded = false; - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); - AppendLog($"[ASAR復元成功] {message}"); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); + this.AppendLog($"[ASAR復元成功] {message}"); MessageBox.Show(message, "ASAR 復元完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { - AppendLog($"[ASAR復元失敗] {message}"); + this.AppendLog($"[ASAR復元失敗] {message}"); MessageBox.Show(message, "ASAR 復元エラー", MessageBoxButton.OK, MessageBoxImage.Error); } } @@ -1251,17 +1243,17 @@ namespace GameLauncher private async void btnExtractRgss_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - await ExtractRgssForGame(tg); + await this.ExtractRgssForGame(tg); } } private async void MenuExtractRgss_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - await ExtractRgssForGame(tg); + await this.ExtractRgssForGame(tg); } } @@ -1269,47 +1261,47 @@ namespace GameLauncher { if (!tg.IsRgss) return; - btnExtractRgss.IsEnabled = false; - pbRgssProgress.Visibility = Visibility.Visible; - pbRgssProgress.IsIndeterminate = true; - lblRgssProgressStatus.Visibility = Visibility.Visible; - lblRgssProgressStatus.Text = "RGSSスクリプトを抽出中..."; + this.btnExtractRgss.IsEnabled = false; + this.pbRgssProgress.Visibility = Visibility.Visible; + this.pbRgssProgress.IsIndeterminate = true; + this.lblRgssProgressStatus.Visibility = Visibility.Visible; + this.lblRgssProgressStatus.Text = "RGSSスクリプトを抽出中..."; - AppendLog($"[RGSS抽出開始] {tg.Title} (アーカイブ: {tg.RgssArchivePath})"); + this.AppendLog($"[RGSS抽出開始] {tg.Title} (アーカイブ: {tg.RgssArchivePath})"); - var (success, message) = await _rgssModService.ExtractScriptsAsync(tg, _config.RgssExtractorPath); + var (success, message) = await this._rgssModService.ExtractScriptsAsync(tg, this._config.RgssExtractorPath); - pbRgssProgress.Visibility = Visibility.Collapsed; - lblRgssProgressStatus.Visibility = Visibility.Collapsed; - btnExtractRgss.IsEnabled = true; + this.pbRgssProgress.Visibility = Visibility.Collapsed; + this.lblRgssProgressStatus.Visibility = Visibility.Collapsed; + this.btnExtractRgss.IsEnabled = true; if (success) { - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); - AppendLog($"[RGSS抽出成功] {message}"); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); + this.AppendLog($"[RGSS抽出成功] {message}"); MessageBox.Show(message, "RGSS スクリプト抽出完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { - AppendLog($"[RGSS抽出失敗] {message}"); + this.AppendLog($"[RGSS抽出失敗] {message}"); MessageBox.Show(message, "RGSS スクリプト抽出エラー", MessageBoxButton.OK, MessageBoxImage.Error); } } private void btnRestoreRgss_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - RestoreRgssForGame(tg); + this.RestoreRgssForGame(tg); } } private void MenuRestoreRgss_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - RestoreRgssForGame(tg); + this.RestoreRgssForGame(tg); } } @@ -1325,20 +1317,20 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - AppendLog($"[RGSS復元開始] {tg.Title}"); - var (success, message) = _rgssModService.RestoreOriginal(tg); + this.AppendLog($"[RGSS復元開始] {tg.Title}"); + var (success, message) = this._rgssModService.RestoreOriginal(tg); if (success) { tg.IsModded = false; - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); - AppendLog($"[RGSS復元成功] {message}"); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); + this.AppendLog($"[RGSS復元成功] {message}"); MessageBox.Show(message, "RGSS 復元完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { - AppendLog($"[RGSS復元失敗] {message}"); + this.AppendLog($"[RGSS復元失敗] {message}"); MessageBox.Show(message, "RGSS 復元エラー", MessageBoxButton.OK, MessageBoxImage.Error); } } @@ -1347,44 +1339,44 @@ namespace GameLauncher private void btnRestoreOriginal_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - RestoreOriginalMod(tg); + this.RestoreOriginalMod(tg); } } private void MenuRestoreOriginal_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - RestoreOriginalMod(tg); + this.RestoreOriginalMod(tg); } } private void RestoreOriginalMod(TkoolGameItem tg) { - var result = tg.IsRgss - ? _rgssModService.RestoreOriginal(tg) + var (Success, Message) = tg.IsRgss + ? this._rgssModService.RestoreOriginal(tg) : (tg.EngineType == TkoolEngineType.Tyrano - ? _tyranoModService.RestoreOriginal(tg) - : _modService.RestoreOriginal(tg)); + ? this._tyranoModService.RestoreOriginal(tg) + : this._modService.RestoreOriginal(tg)); tg.IsModded = false; - AppendLog($"[改造解除] {tg.Title}: {result.Message}"); + this.AppendLog($"[改造解除] {tg.Title}: {Message}"); - if (result.Success) + if (Success) { - MessageBox.Show(result.Message, "改造解除・復元完了", MessageBoxButton.OK, MessageBoxImage.Information); + MessageBox.Show(Message, "改造解除・復元完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { - MessageBox.Show(result.Message, "復元エラー", MessageBoxButton.OK, MessageBoxImage.Warning); + MessageBox.Show(Message, "復元エラー", MessageBoxButton.OK, MessageBoxImage.Warning); } } private void MenuOpenProfileFolder_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { var dir = AppPathHelper.GetGameProfileDirectory(tg.FolderName, tg.RootDirectory); if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); @@ -1394,7 +1386,7 @@ namespace GameLauncher private void MenuOpenPluginsJs_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg && File.Exists(tg.PluginsJsPath)) + if (this.lstGames.SelectedItem is TkoolGameItem tg && File.Exists(tg.PluginsJsPath)) { Process.Start(new ProcessStartInfo { FileName = tg.PluginsJsPath, UseShellExecute = true }); } @@ -1405,9 +1397,9 @@ namespace GameLauncher /// private async void MenuRepairResources_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg) + if (this.lstGames.SelectedItem is TkoolGameItem tg) { - AppendLog($"[リソース修復] {tg.Title}: 手動での完全再検査を開始します..."); + this.AppendLog($"[リソース修復] {tg.Title}: 手動での完全再検査を開始します..."); this.pbGlobalProgress.Visibility = Visibility.Visible; this.pbGlobalProgress.IsIndeterminate = true; @@ -1432,13 +1424,13 @@ namespace GameLauncher try { - var result = await _tkoolResourceRepairService.RepairGameResourcesAsync( + var result = await this._tkoolResourceRepairService.RepairGameResourcesAsync( tg, forceRescan: true, progress: progress, - uiLogCallback: msg => AppendLog(msg)); + uiLogCallback: msg => this.AppendLog(msg)); - AppendLog($"[リソース修復完了] {tg.Title}: {result.Message}"); + this.AppendLog($"[リソース修復完了] {tg.Title}: {result.Message}"); var askOpenLog = MessageBox.Show( $"{result.Message}\n\n詳細ログファイルを出力しました:\n{result.LogFilePath}\n\nログファイルを開きますか?", "リソース修復結果", @@ -1452,7 +1444,7 @@ namespace GameLauncher } catch (Exception ex) { - AppendLog($"[リソース修復エラー] {tg.Title}: {ex.Message}"); + this.AppendLog($"[リソース修復エラー] {tg.Title}: {ex.Message}"); MessageBox.Show($"リソース修復中にエラーが発生しました:\n{ex.Message}", "修復エラー", MessageBoxButton.OK, MessageBoxImage.Error); } finally @@ -1470,17 +1462,17 @@ namespace GameLauncher private void btnOpenSaveEditor_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is UnityGameItem ug) + if (this.lstGames.SelectedItem is UnityGameItem ug) { - OpenSaveEditor(ug); + this.OpenSaveEditor(ug); } } private void MenuOpenSaveEditor_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is UnityGameItem ug) + if (this.lstGames.SelectedItem is UnityGameItem ug) { - OpenSaveEditor(ug); + this.OpenSaveEditor(ug); } } @@ -1488,7 +1480,7 @@ namespace GameLauncher { try { - AppendLog($"[セーブエディタ起動] {ug.Title} のセーブエディタを開きます..."); + this.AppendLog($"[セーブエディタ起動] {ug.Title} のセーブエディタを開きます..."); var win = new SaveEditorWindow(ug) { Owner = this @@ -1496,31 +1488,31 @@ namespace GameLauncher win.ShowDialog(); // セーブ状態の再チェック - ug.HasSaveData = _scannerService.CheckHasSaveData(ug); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); - AppendLog($"[セーブエディタ終了] {ug.Title} のセーブエディタを閉じました。"); + ug.HasSaveData = this._scannerService.CheckHasSaveData(ug); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); + this.AppendLog($"[セーブエディタ終了] {ug.Title} のセーブエディタを閉じました。"); } catch (Exception ex) { MessageBox.Show($"セーブエディタの起動中にエラーが発生しました:\n{ex.Message}", "エラー", MessageBoxButton.OK, MessageBoxImage.Error); - AppendLog($"[セーブエディタエラー] {ex.Message}"); + this.AppendLog($"[セーブエディタエラー] {ex.Message}"); } } private void btnOpenLocalLow_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is UnityGameItem ug) + if (this.lstGames.SelectedItem is UnityGameItem ug) { - OpenLocalLow(ug); + this.OpenLocalLow(ug); } } private void MenuOpenLocalLow_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is UnityGameItem ug) + if (this.lstGames.SelectedItem is UnityGameItem ug) { - OpenLocalLow(ug); + this.OpenLocalLow(ug); } } @@ -1547,17 +1539,17 @@ namespace GameLauncher private void btnOpenRegedit_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is UnityGameItem ug) + if (this.lstGames.SelectedItem is UnityGameItem ug) { - OpenRegedit(ug); + this.OpenRegedit(ug); } } private void MenuOpenRegedit_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is UnityGameItem ug) + if (this.lstGames.SelectedItem is UnityGameItem ug) { - OpenRegedit(ug); + this.OpenRegedit(ug); } } @@ -1569,10 +1561,7 @@ namespace GameLauncher if (!string.IsNullOrEmpty(ug.RegistryPath)) { using var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Regedit"); - if (key != null) - { - key.SetValue("LastKey", $@"HKEY_CURRENT_USER\{ug.RegistryPath}"); - } + key?.SetValue("LastKey", $@"HKEY_CURRENT_USER\{ug.RegistryPath}"); } Process.Start(new ProcessStartInfo { FileName = "regedit.exe", UseShellExecute = true }); } @@ -1584,17 +1573,17 @@ namespace GameLauncher private void btnQuickBackup_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is UnityGameItem ug) + if (this.lstGames.SelectedItem is UnityGameItem ug) { - PerformUnityQuickBackup(ug); + this.PerformUnityQuickBackup(ug); } } private void MenuBackupSave_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is UnityGameItem ug) + if (this.lstGames.SelectedItem is UnityGameItem ug) { - PerformUnityQuickBackup(ug); + this.PerformUnityQuickBackup(ug); } } @@ -1608,35 +1597,35 @@ namespace GameLauncher // 1. レジストリ (PlayerPrefs) if (!string.IsNullOrEmpty(ug.RegistryPath)) { - var regRes = _unitySaveService.BackupRegistry(ug.RegistryPath, backupDir); + var regRes = this._unitySaveService.BackupRegistry(ug.RegistryPath, backupDir); if (regRes != null) backedUpCount++; } // 2. ディスクセーブファイル - var files = _unitySaveService.GetSaveFiles(ug); + var files = this._unitySaveService.GetSaveFiles(ug); foreach (var f in files) { - var fileRes = _unitySaveService.BackupSaveFile(f.FilePath, backupDir); + var fileRes = this._unitySaveService.BackupSaveFile(f.FilePath, backupDir); if (fileRes != null) backedUpCount++; } if (backedUpCount > 0) { ug.HasSaveData = true; - AppendLog($"[セーブバックアップ完了] {ug.Title}: {backedUpCount} 個の項目を保存しました。(保存先: {backupDir})"); + this.AppendLog($"[セーブバックアップ完了] {ug.Title}: {backedUpCount} 個の項目を保存しました。(保存先: {backupDir})"); MessageBox.Show($"セーブデータのバックアップが完了しました!({backedUpCount} 個のファイル/レジストリ)\n\n保存先:\n{backupDir}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { - AppendLog($"[セーブバックアップ警告] {ug.Title}: バックアップ対象が見つかりませんでした。"); + this.AppendLog($"[セーブバックアップ警告] {ug.Title}: バックアップ対象が見つかりませんでした。"); MessageBox.Show("バックアップ対象のセーブデータ(レジストリまたはファイル)が見つかりませんでした。", "バックアップ確認", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { - AppendLog($"[セーブバックアップ失敗] {ex.Message}"); + this.AppendLog($"[セーブバックアップ失敗] {ex.Message}"); MessageBox.Show($"バックアップ中にエラーが発生しました:\n{ex.Message}", "エラー", MessageBoxButton.OK, MessageBoxImage.Error); } } @@ -1647,9 +1636,9 @@ namespace GameLauncher private void btnOpenWolfSaveEditor_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) + if (this.lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) { - var dialog = new WolfSaveEditorDialog(tg, _wolfSaveService) + var dialog = new WolfSaveEditorDialog(tg, this._wolfSaveService) { Owner = this }; @@ -1659,55 +1648,55 @@ namespace GameLauncher private void chkWolfProxyDll_Checked(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) + if (this.lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) { - var (success, msg) = _wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0); - AppendLog($"[ウディタ プロキシDLL] {msg.Replace("\n", " ")}"); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + var (success, msg) = this._wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0); + this.AppendLog($"[ウディタ プロキシDLL] {msg.Replace("\n", " ")}"); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } } private void chkWolfProxyDll_Unchecked(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) + if (this.lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) { - var (success, msg) = _wolfModService.RemoveProxyDll(tg); - AppendLog($"[ウディタ プロキシDLL] {msg}"); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + var (success, msg) = this._wolfModService.RemoveProxyDll(tg); + this.AppendLog($"[ウディタ プロキシDLL] {msg}"); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } } private void btnApplyWolfProxyDll_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) + if (this.lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) { - var (success, msg) = _wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0); + var (success, msg) = this._wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0); tg.WolfProxyDll = true; - AppendLog($"[ウディタ プロキシDLL] {msg.Replace("\n", " ")}"); + this.AppendLog($"[ウディタ プロキシDLL] {msg.Replace("\n", " ")}"); MessageBox.Show(msg, "プロキシDLL適用", MessageBoxButton.OK, MessageBoxImage.Information); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } } private void btnRemoveWolfProxyDll_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) + if (this.lstGames.SelectedItem is TkoolGameItem tg && tg.IsWolf) { - var (success, msg) = _wolfModService.RemoveProxyDll(tg); + var (success, msg) = this._wolfModService.RemoveProxyDll(tg); tg.WolfProxyDll = false; - AppendLog($"[ウディタ プロキシDLL] {msg}"); + this.AppendLog($"[ウディタ プロキシDLL] {msg}"); MessageBox.Show(msg, "プロキシDLL解除", MessageBoxButton.OK, MessageBoxImage.Information); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } } private async void btnExtractWolf_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsWolf) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsWolf) return; var confirm = MessageBox.Show( $"Data.wolf アーカイブを解凍・抽出しますか?\n\n対象: {tg.Title}\n展開先: {Path.Combine(tg.RootDirectory, "Data")}\n\n解凍すると、ウディタのエディタやファイル直接編集によるデータ改造が可能になります。", @@ -1715,24 +1704,24 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - pbWolfProgress.Visibility = Visibility.Visible; - pbWolfProgress.IsIndeterminate = true; - lblWolfProgressStatus.Visibility = Visibility.Visible; - lblWolfProgressStatus.Text = "Data.wolf を解凍しています..."; - btnExtractWolf.IsEnabled = false; + this.pbWolfProgress.Visibility = Visibility.Visible; + this.pbWolfProgress.IsIndeterminate = true; + this.lblWolfProgressStatus.Visibility = Visibility.Visible; + this.lblWolfProgressStatus.Text = "Data.wolf を解凍しています..."; + this.btnExtractWolf.IsEnabled = false; var progress = new Progress(status => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { - lblWolfProgressStatus.Text = status; - AppendLog($"[ウディタ解凍] {status}"); + this.lblWolfProgressStatus.Text = status; + this.AppendLog($"[ウディタ解凍] {status}"); }); }); try { - var (success, msg) = await _wolfArchiveService.ExtractArchiveAsync(tg, _config.WolfExtractorPath, progress); + var (success, msg) = await this._wolfArchiveService.ExtractArchiveAsync(tg, this._config.WolfExtractorPath, progress); if (success) { tg.IsWolfExtracted = true; @@ -1742,20 +1731,20 @@ namespace GameLauncher { MessageBox.Show(msg, "解凍エラー", MessageBoxButton.OK, MessageBoxImage.Warning); } - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } finally { - pbWolfProgress.Visibility = Visibility.Collapsed; - lblWolfProgressStatus.Visibility = Visibility.Collapsed; - btnExtractWolf.IsEnabled = true; + this.pbWolfProgress.Visibility = Visibility.Collapsed; + this.lblWolfProgressStatus.Visibility = Visibility.Collapsed; + this.btnExtractWolf.IsEnabled = true; } } private void btnRestoreWolfArchive_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsWolf) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsWolf) return; var confirm = MessageBox.Show( "解凍された Data フォルダを Backups フォルダへ退避し、元の Data.wolf アーカイブ優先読み込みに復元しますか?", @@ -1763,14 +1752,14 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - var (success, msg) = _wolfArchiveService.RestoreArchiveState(tg); + var (success, msg) = this._wolfArchiveService.RestoreArchiveState(tg); if (success) { tg.IsWolfExtracted = false; - AppendLog($"[ウディタ復元] {tg.Title}: {msg.Replace("\n", " ")}"); + this.AppendLog($"[ウディタ復元] {tg.Title}: {msg.Replace("\n", " ")}"); MessageBox.Show(msg, "復元完了", MessageBoxButton.OK, MessageBoxImage.Information); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } else { @@ -1780,7 +1769,7 @@ namespace GameLauncher private void btnRestoreWolfAll_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsWolf) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsWolf) return; var confirm = MessageBox.Show( $"【完全復元】\n{tg.Title} に対するすべての改造(プロキシDLL、パッチ等)を解除し、元の状態に戻しますか?\n※セーブデータはそのまま維持されます。", @@ -1788,9 +1777,9 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - var (success, msg) = _wolfModService.RestoreAllMods(tg); + var (success, msg) = this._wolfModService.RestoreAllMods(tg); tg.WolfProxyDll = false; - AppendLog($"[ウディタ完全復元] {tg.Title}:\n{msg}"); + this.AppendLog($"[ウディタ完全復元] {tg.Title}:\n{msg}"); MessageBox.Show($"すべての改造を解除しました:\n\n{msg}", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information); } @@ -1800,59 +1789,59 @@ namespace GameLauncher private void chkSrpgProxyDll_Checked(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; tg.SrpgProxyDll = true; - bool ok = _srpgModService.EnableProxyDll(tg.RootDirectory, tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0); + bool ok = this._srpgModService.EnableProxyDll(tg.RootDirectory, tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0); if (ok) { - AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLLを有効化しました (F6で倍速切替)"); + this.AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLLを有効化しました (F6で倍速切替)"); } - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } private void chkSrpgProxyDll_Unchecked(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; tg.SrpgProxyDll = false; - _srpgModService.DisableProxyDll(tg.RootDirectory); - AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLLを解除しました"); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._srpgModService.DisableProxyDll(tg.RootDirectory); + this.AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLLを解除しました"); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } private void btnApplySrpgProxyDll_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; tg.SrpgProxyDll = true; - bool ok = _srpgModService.EnableProxyDll(tg.RootDirectory, tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0); + bool ok = this._srpgModService.EnableProxyDll(tg.RootDirectory, tg.SrpgSpeedMultiplier > 0 ? tg.SrpgSpeedMultiplier : 3.0); if (ok) { - AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLL (version.dll) を配置しました"); + this.AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLL (version.dll) を配置しました"); MessageBox.Show("プロキシDLL (version.dll) を配置しました。\nゲーム起動後、[F6] キーで倍速切替、[Ctrl] キー押し続けで早送りができます。", "プロキシDLL配置完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("プロキシDLLの配置に失敗しました。\nEngines/Rgss/Tools/speedhack-i686/version.dll が存在するか確認してください。", "エラー", MessageBoxButton.OK, MessageBoxImage.Warning); } - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } private void btnRemoveSrpgProxyDll_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; tg.SrpgProxyDll = false; - bool ok = _srpgModService.DisableProxyDll(tg.RootDirectory); - AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLL (version.dll) を解除しました"); + bool ok = this._srpgModService.DisableProxyDll(tg.RootDirectory); + this.AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLL (version.dll) を解除しました"); MessageBox.Show("プロキシDLL (version.dll) を解除しました。", "プロキシDLL解除完了", MessageBoxButton.OK, MessageBoxImage.Information); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } private async void btnApplySrpgMod_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; var enabledMods = tg.SrpgModOptions.Where(m => m.IsEnabled).ToList(); if (enabledMods.Count == 0) @@ -1867,48 +1856,48 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - pbSrpgProgress.Visibility = Visibility.Visible; - pbSrpgProgress.IsIndeterminate = true; - lblSrpgProgressStatus.Visibility = Visibility.Visible; - lblSrpgProgressStatus.Text = "改造プラグインを適用・再パック中..."; - btnApplySrpgMod.IsEnabled = false; + this.pbSrpgProgress.Visibility = Visibility.Visible; + this.pbSrpgProgress.IsIndeterminate = true; + this.lblSrpgProgressStatus.Visibility = Visibility.Visible; + this.lblSrpgProgressStatus.Text = "改造プラグインを適用・再パック中..."; + this.btnApplySrpgMod.IsEnabled = false; var progress = new Progress(status => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { - lblSrpgProgressStatus.Text = status; - AppendLog($"[SRPG Studio 改造] {status}"); + this.lblSrpgProgressStatus.Text = status; + this.AppendLog($"[SRPG Studio 改造] {status}"); }); }); try { - var (success, msg) = await _srpgModService.ApplyModAndRepackAsync(tg, progress); + var (success, msg) = await this._srpgModService.ApplyModAndRepackAsync(tg, progress); if (success) { - AppendLog($"[SRPG Studio 改造成功] {tg.Title}: {msg}"); + this.AppendLog($"[SRPG Studio 改造成功] {tg.Title}: {msg}"); MessageBox.Show(msg, "改造適用完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { - AppendLog($"[SRPG Studio 改造失敗] {tg.Title}: {msg}"); + this.AppendLog($"[SRPG Studio 改造失敗] {tg.Title}: {msg}"); MessageBox.Show(msg, "改造適用エラー", MessageBoxButton.OK, MessageBoxImage.Warning); } - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } finally { - pbSrpgProgress.Visibility = Visibility.Collapsed; - lblSrpgProgressStatus.Visibility = Visibility.Collapsed; - btnApplySrpgMod.IsEnabled = true; + this.pbSrpgProgress.Visibility = Visibility.Collapsed; + this.lblSrpgProgressStatus.Visibility = Visibility.Collapsed; + this.btnApplySrpgMod.IsEnabled = true; } } private async void btnRemoveSrpgMod_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; var confirm = MessageBox.Show( $"改造プラグインを解除し、元のアーカイブへ復元しますか?\n\n対象: {tg.Title}", @@ -1916,50 +1905,50 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - pbSrpgProgress.Visibility = Visibility.Visible; - pbSrpgProgress.IsIndeterminate = true; - lblSrpgProgressStatus.Visibility = Visibility.Visible; - lblSrpgProgressStatus.Text = "改造プラグインを解除中..."; - btnRemoveSrpgMod.IsEnabled = false; + this.pbSrpgProgress.Visibility = Visibility.Visible; + this.pbSrpgProgress.IsIndeterminate = true; + this.lblSrpgProgressStatus.Visibility = Visibility.Visible; + this.lblSrpgProgressStatus.Text = "改造プラグインを解除中..."; + this.btnRemoveSrpgMod.IsEnabled = false; var progress = new Progress(status => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { - lblSrpgProgressStatus.Text = status; - AppendLog($"[SRPG Studio 解除] {status}"); + this.lblSrpgProgressStatus.Text = status; + this.AppendLog($"[SRPG Studio 解除] {status}"); }); }); try { - var (success, msg) = await _srpgModService.RemoveModAndRepackAsync(tg, progress); + var (success, msg) = await this._srpgModService.RemoveModAndRepackAsync(tg, progress); if (success) { // チェックをすべてオフにする foreach (var mod in tg.SrpgModOptions) mod.IsEnabled = false; - AppendLog($"[SRPG Studio 解除成功] {tg.Title}: {msg}"); + this.AppendLog($"[SRPG Studio 解除成功] {tg.Title}: {msg}"); MessageBox.Show(msg, "改造解除完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { - AppendLog($"[SRPG Studio 解除失敗] {tg.Title}: {msg}"); + this.AppendLog($"[SRPG Studio 解除失敗] {tg.Title}: {msg}"); MessageBox.Show(msg, "改造解除エラー", MessageBoxButton.OK, MessageBoxImage.Warning); } - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } finally { - pbSrpgProgress.Visibility = Visibility.Collapsed; - lblSrpgProgressStatus.Visibility = Visibility.Collapsed; - btnRemoveSrpgMod.IsEnabled = true; + this.pbSrpgProgress.Visibility = Visibility.Collapsed; + this.lblSrpgProgressStatus.Visibility = Visibility.Collapsed; + this.btnRemoveSrpgMod.IsEnabled = true; } } private async void btnUnpackSrpg_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; var confirm = MessageBox.Show( $"data.dts アーカイブを解凍・抽出しますか?\n\n対象: {tg.Title}\n展開先: {Path.Combine(tg.RootDirectory, SrpgArchiveService.ExtractedDirName)}\n\n解凍すると、ゲーム内のスクリプト (Script) やプラグイン (Plugin) を自由に編集できるようになります。", @@ -1967,49 +1956,49 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - pbSrpgProgress.Visibility = Visibility.Visible; - pbSrpgProgress.IsIndeterminate = true; - lblSrpgProgressStatus.Visibility = Visibility.Visible; - lblSrpgProgressStatus.Text = "data.dts を解凍しています..."; - btnUnpackSrpg.IsEnabled = false; + this.pbSrpgProgress.Visibility = Visibility.Visible; + this.pbSrpgProgress.IsIndeterminate = true; + this.lblSrpgProgressStatus.Visibility = Visibility.Visible; + this.lblSrpgProgressStatus.Text = "data.dts を解凍しています..."; + this.btnUnpackSrpg.IsEnabled = false; var progress = new Progress(status => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { - lblSrpgProgressStatus.Text = status; - AppendLog($"[SRPG Studio 解凍] {status}"); + this.lblSrpgProgressStatus.Text = status; + this.AppendLog($"[SRPG Studio 解凍] {status}"); }); }); try { - var (success, msg) = await _srpgArchiveService.UnpackDataDtsAsync(tg.RootDirectory, progress); + var (success, msg) = await this._srpgArchiveService.UnpackDataDtsAsync(tg.RootDirectory, progress); if (success) { tg.IsSrpgExtracted = true; - AppendLog($"[SRPG Studio 解凍成功] {tg.Title}: {msg.Replace("\n", " ")}"); + this.AppendLog($"[SRPG Studio 解凍成功] {tg.Title}: {msg.Replace("\n", " ")}"); MessageBox.Show(msg, "解凍完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { - AppendLog($"[SRPG Studio 解凍失敗] {tg.Title}: {msg}"); + this.AppendLog($"[SRPG Studio 解凍失敗] {tg.Title}: {msg}"); MessageBox.Show(msg, "解凍エラー", MessageBoxButton.OK, MessageBoxImage.Warning); } - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } finally { - pbSrpgProgress.Visibility = Visibility.Collapsed; - lblSrpgProgressStatus.Visibility = Visibility.Collapsed; - btnUnpackSrpg.IsEnabled = true; + this.pbSrpgProgress.Visibility = Visibility.Collapsed; + this.lblSrpgProgressStatus.Visibility = Visibility.Collapsed; + this.btnUnpackSrpg.IsEnabled = true; } } private async void btnRepackSrpg_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; var confirm = MessageBox.Show( $"解凍フォルダの内容から data.dts を再構築(再パック)しますか?\n(現在の data.dts は Backups フォルダに自動保存されます)\n\n対象: {tg.Title}", @@ -2017,48 +2006,48 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - pbSrpgProgress.Visibility = Visibility.Visible; - pbSrpgProgress.IsIndeterminate = true; - lblSrpgProgressStatus.Visibility = Visibility.Visible; - lblSrpgProgressStatus.Text = "data.dts を再構築中..."; - btnRepackSrpg.IsEnabled = false; + this.pbSrpgProgress.Visibility = Visibility.Visible; + this.pbSrpgProgress.IsIndeterminate = true; + this.lblSrpgProgressStatus.Visibility = Visibility.Visible; + this.lblSrpgProgressStatus.Text = "data.dts を再構築中..."; + this.btnRepackSrpg.IsEnabled = false; var progress = new Progress(status => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { - lblSrpgProgressStatus.Text = status; - AppendLog($"[SRPG Studio 再構築] {status}"); + this.lblSrpgProgressStatus.Text = status; + this.AppendLog($"[SRPG Studio 再構築] {status}"); }); }); try { - var (success, msg) = await _srpgArchiveService.RepackDataDtsAsync(tg.RootDirectory, progress); + var (success, msg) = await this._srpgArchiveService.RepackDataDtsAsync(tg.RootDirectory, progress); if (success) { - AppendLog($"[SRPG Studio 再構築成功] {tg.Title}: {msg.Replace("\n", " ")}"); + this.AppendLog($"[SRPG Studio 再構築成功] {tg.Title}: {msg.Replace("\n", " ")}"); MessageBox.Show(msg, "再構築完了", MessageBoxButton.OK, MessageBoxImage.Information); } else { - AppendLog($"[SRPG Studio 再構築失敗] {tg.Title}: {msg}"); + this.AppendLog($"[SRPG Studio 再構築失敗] {tg.Title}: {msg}"); MessageBox.Show(msg, "再構築エラー", MessageBoxButton.OK, MessageBoxImage.Warning); } - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } finally { - pbSrpgProgress.Visibility = Visibility.Collapsed; - lblSrpgProgressStatus.Visibility = Visibility.Collapsed; - btnRepackSrpg.IsEnabled = true; + this.pbSrpgProgress.Visibility = Visibility.Collapsed; + this.lblSrpgProgressStatus.Visibility = Visibility.Collapsed; + this.btnRepackSrpg.IsEnabled = true; } } private async void btnRestoreSrpgAll_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; + if (this.lstGames.SelectedItem is not TkoolGameItem tg || !tg.IsSrpgStudio) return; var confirm = MessageBox.Show( $"【完全復元】\n{tg.Title} に対するすべての改造(プロキシDLL・Modプラグイン・解凍フォルダ退避等)を解除し、元の安全な状態に戻しますか?\n※セーブデータはそのまま維持されます。\n※解凍データは Backups フォルダに安全退避されます。", @@ -2066,33 +2055,33 @@ namespace GameLauncher if (confirm != MessageBoxResult.Yes) return; - pbSrpgProgress.Visibility = Visibility.Visible; - pbSrpgProgress.IsIndeterminate = true; - lblSrpgProgressStatus.Visibility = Visibility.Visible; - lblSrpgProgressStatus.Text = "すべての改造を解除中..."; + this.pbSrpgProgress.Visibility = Visibility.Visible; + this.pbSrpgProgress.IsIndeterminate = true; + this.lblSrpgProgressStatus.Visibility = Visibility.Visible; + this.lblSrpgProgressStatus.Text = "すべての改造を解除中..."; var progress = new Progress(status => { - Dispatcher.Invoke(() => + this.Dispatcher.Invoke(() => { - lblSrpgProgressStatus.Text = status; - AppendLog($"[SRPG Studio 完全復元] {status}"); + this.lblSrpgProgressStatus.Text = status; + this.AppendLog($"[SRPG Studio 完全復元] {status}"); }); }); try { - var (success, msg) = await _srpgModService.RestoreAllModsAsync(tg, progress); + var (success, msg) = await this._srpgModService.RestoreAllModsAsync(tg, progress); foreach (var mod in tg.SrpgModOptions) mod.IsEnabled = false; - AppendLog($"[SRPG Studio 完全復元] {tg.Title}:\n{msg}"); + this.AppendLog($"[SRPG Studio 完全復元] {tg.Title}:\n{msg}"); MessageBox.Show($"すべての改造を解除しました:\n\n{msg}", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information); - _scannerService.SaveCache(_games); - _scannerService.SaveBookmarks(_games); + this._scannerService.SaveCache(this._games); + this._scannerService.SaveBookmarks(this._games); } finally { - pbSrpgProgress.Visibility = Visibility.Collapsed; - lblSrpgProgressStatus.Visibility = Visibility.Collapsed; + this.pbSrpgProgress.Visibility = Visibility.Collapsed; + this.lblSrpgProgressStatus.Visibility = Visibility.Collapsed; } } @@ -2102,7 +2091,7 @@ namespace GameLauncher private void btnOpenFolder_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is GameItemBase game && Directory.Exists(game.RootDirectory)) + if (this.lstGames.SelectedItem is GameItemBase game && Directory.Exists(game.RootDirectory)) { Process.Start(new ProcessStartInfo { FileName = game.RootDirectory, UseShellExecute = true }); } @@ -2110,7 +2099,7 @@ namespace GameLauncher private void MenuOpenFolder_Click(object sender, RoutedEventArgs e) { - if (lstGames.SelectedItem is GameItemBase game && Directory.Exists(game.RootDirectory)) + if (this.lstGames.SelectedItem is GameItemBase game && Directory.Exists(game.RootDirectory)) { Process.Start(new ProcessStartInfo { FileName = game.RootDirectory, UseShellExecute = true }); } @@ -2138,7 +2127,7 @@ namespace GameLauncher // テキストボックスの行数が多すぎる場合は古いログを切り詰める(メモリ肥大化・クラッシュ防止) if (this.txtLog.Text.Length > 100000) { - this.txtLog.Text = this.txtLog.Text.Substring(this.txtLog.Text.Length - 50000); + this.txtLog.Text = this.txtLog.Text[^50000..]; } this.txtLog.AppendText(sb.ToString()); this.scrollLog.ScrollToEnd(); diff --git a/Models/GameItemBase.cs b/Models/GameItemBase.cs index 3d46ce1..1f062e2 100644 --- a/Models/GameItemBase.cs +++ b/Models/GameItemBase.cs @@ -34,51 +34,51 @@ namespace GameLauncher.Models /// ゲームの表示タイトル public string Title { - get => _title; - set { if (_title != value) { _title = value; OnPropertyChanged(); } } + get => this._title; + set { if (this._title != value) { this._title = value; this.OnPropertyChanged(); } } } /// フォルダ名 public string FolderName { - get => _folderName; - set { if (_folderName != value) { _folderName = value; OnPropertyChanged(); } } + get => this._folderName; + set { if (this._folderName != value) { this._folderName = value; this.OnPropertyChanged(); } } } /// ゲームのルートディレクトリ絶対パス public string RootDirectory { - get => _rootDirectory; - set { if (_rootDirectory != value) { _rootDirectory = value; OnPropertyChanged(); } } + get => this._rootDirectory; + set { if (this._rootDirectory != value) { this._rootDirectory = value; this.OnPropertyChanged(); } } } /// ゲームの実行ファイル(.exe等)絶対パス public string ExecutablePath { - get => _executablePath; - set { if (_executablePath != value) { _executablePath = value; OnPropertyChanged(); } } + get => this._executablePath; + set { if (this._executablePath != value) { this._executablePath = value; this.OnPropertyChanged(); } } } /// アプリアイコン画像 public ImageSource? IconImage { - get => _iconImage; - set { if (_iconImage != value) { _iconImage = value; OnPropertyChanged(); } } + get => this._iconImage; + set { if (this._iconImage != value) { this._iconImage = value; this.OnPropertyChanged(); } } } /// ランチャーからの最終起動日時 public DateTime? LastLaunched { - get => _lastLaunched; + get => this._lastLaunched; set { - if (_lastLaunched != value) + if (this._lastLaunched != value) { - _lastLaunched = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(LastLaunchedDisplay)); - OnPropertyChanged(nameof(LastLaunchedCardDisplay)); - OnPropertyChanged(nameof(LastLaunchedDetailDisplay)); + this._lastLaunched = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.LastLaunchedDisplay)); + this.OnPropertyChanged(nameof(this.LastLaunchedCardDisplay)); + this.OnPropertyChanged(nameof(this.LastLaunchedDetailDisplay)); } } } @@ -86,16 +86,16 @@ namespace GameLauncher.Models /// フォルダ更新日時 public DateTime? FolderLastModified { - get => _folderLastModified; + get => this._folderLastModified; set { - if (_folderLastModified != value) + if (this._folderLastModified != value) { - _folderLastModified = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(FolderLastModifiedDisplay)); - OnPropertyChanged(nameof(FolderLastModifiedCardDisplay)); - OnPropertyChanged(nameof(FolderLastModifiedDetailDisplay)); + this._folderLastModified = value; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.FolderLastModifiedDisplay)); + this.OnPropertyChanged(nameof(this.FolderLastModifiedCardDisplay)); + this.OnPropertyChanged(nameof(this.FolderLastModifiedDetailDisplay)); } } } @@ -128,8 +128,8 @@ namespace GameLauncher.Models /// ゲームエンジンの種別 public abstract GameEngineKind EngineKind { get; } - public bool IsTkoolOrTyrano => EngineKind is GameEngineKind.Tkool or GameEngineKind.Tyrano; - public bool IsUnity => EngineKind == GameEngineKind.Unity; + public bool IsTkoolOrTyrano => this.EngineKind is GameEngineKind.Tkool or GameEngineKind.Tyrano; + public bool IsUnity => this.EngineKind == GameEngineKind.Unity; /// Enigma Virtual Box でパックされたゲームか public virtual bool IsEvb => false; @@ -169,28 +169,28 @@ namespace GameLauncher.Models /// EVB 詳細状態テキスト public virtual string EvbDetailStatusText => string.Empty; - public string LastLaunchedDisplay => LastLaunched.HasValue - ? LastLaunched.Value.ToString("yyyy/MM/dd HH:mm") + public string LastLaunchedDisplay => this.LastLaunched.HasValue + ? this.LastLaunched.Value.ToString("yyyy/MM/dd HH:mm") : "未起動"; - public string LastLaunchedCardDisplay => LastLaunched.HasValue - ? $"▶ {LastLaunched.Value:yy/MM/dd HH:mm}" + public string LastLaunchedCardDisplay => this.LastLaunched.HasValue + ? $"▶ {this.LastLaunched.Value:yy/MM/dd HH:mm}" : "▶ 未起動"; - public string LastLaunchedDetailDisplay => LastLaunched.HasValue - ? LastLaunched.Value.ToString("yyyy/MM/dd HH:mm:ss") + public string LastLaunchedDetailDisplay => this.LastLaunched.HasValue + ? this.LastLaunched.Value.ToString("yyyy/MM/dd HH:mm:ss") : "まだ起動されていません"; - public string FolderLastModifiedDisplay => FolderLastModified.HasValue - ? FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm") + public string FolderLastModifiedDisplay => this.FolderLastModified.HasValue + ? this.FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm") : "-"; - public string FolderLastModifiedCardDisplay => FolderLastModified.HasValue - ? $"📁 {FolderLastModified.Value:yy/MM/dd HH:mm}" + public string FolderLastModifiedCardDisplay => this.FolderLastModified.HasValue + ? $"📁 {this.FolderLastModified.Value:yy/MM/dd HH:mm}" : "📁 -"; - public string FolderLastModifiedDetailDisplay => FolderLastModified.HasValue - ? FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm:ss") + public string FolderLastModifiedDetailDisplay => this.FolderLastModified.HasValue + ? this.FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm:ss") : "不明"; // ================= バッジ・UIバインディング共通仮想プロパティ ================= diff --git a/Models/ModPluginDefinition.cs b/Models/ModPluginDefinition.cs index b62ea1f..a14208a 100644 --- a/Models/ModPluginDefinition.cs +++ b/Models/ModPluginDefinition.cs @@ -114,13 +114,13 @@ namespace GameLauncher.Models public bool IsEnabled { - get => _isEnabled; + get => this._isEnabled; set { - if (_isEnabled != value) + if (this._isEnabled != value) { - _isEnabled = value; - OnPropertyChanged(); + this._isEnabled = value; + this.OnPropertyChanged(); } } } diff --git a/Models/SaveDataPropertyEntry.cs b/Models/SaveDataPropertyEntry.cs index cc43b66..2b88502 100644 --- a/Models/SaveDataPropertyEntry.cs +++ b/Models/SaveDataPropertyEntry.cs @@ -26,36 +26,36 @@ namespace GameLauncher.Models /// 項目名(キー名、変数名) public string Key { - get => _key; - set { if (_key != value) { _key = value; OnPropertyChanged(); } } + get => this._key; + set { if (this._key != value) { this._key = value; this.OnPropertyChanged(); } } } /// 分類・カテゴリ(セクション、オブジェクト名など) public string Category { - get => _category; - set { if (_category != value) { _category = value; OnPropertyChanged(); } } + get => this._category; + set { if (this._category != value) { this._category = value; this.OnPropertyChanged(); } } } /// データ型(Int, Float, Bool, String など) public string Type { - get => _type; - set { if (_type != value) { _type = value; OnPropertyChanged(); } } + get => this._type; + set { if (this._type != value) { this._type = value; this.OnPropertyChanged(); } } } /// GUI編集用の値文字列 public string EditValue { - get => _editValue; + get => this._editValue; set { - if (_editValue != value) + if (this._editValue != value) { - _editValue = value; - _isModified = true; - OnPropertyChanged(); - OnPropertyChanged(nameof(IsModified)); + this._editValue = value; + this._isModified = true; + this.OnPropertyChanged(); + this.OnPropertyChanged(nameof(this.IsModified)); } } } @@ -63,15 +63,15 @@ namespace GameLauncher.Models /// 値がユーザーによって変更されたかどうか public bool IsModified { - get => _isModified; - set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } } + get => this._isModified; + set { if (this._isModified != value) { this._isModified = value; this.OnPropertyChanged(); } } } /// 備考・説明・オフセット位置など public string Description { - get => _description; - set { if (_description != value) { _description = value; OnPropertyChanged(); } } + get => this._description; + set { if (this._description != value) { this._description = value; this.OnPropertyChanged(); } } } /// 内部保持用の生データや元データ(再エンコード用) diff --git a/SaveEditorWindow.xaml.cs b/SaveEditorWindow.xaml.cs index 83b8915..adfa5b4 100644 --- a/SaveEditorWindow.xaml.cs +++ b/SaveEditorWindow.xaml.cs @@ -33,7 +33,7 @@ namespace GameLauncher // PlayerPrefs データ private readonly ObservableCollection _allPrefs = []; - private ListCollectionView _prefsView = null!; + private readonly ListCollectionView _prefsView = null!; // ファイル一覧データ private readonly ObservableCollection _saveFiles = []; @@ -41,7 +41,7 @@ namespace GameLauncher // GUIセーブプロパティデータ private readonly ObservableCollection _guiProperties = []; - private ListCollectionView _guiPropsView = null!; + private readonly ListCollectionView _guiPropsView = null!; private ISaveDataCodec? _currentCodec; // バックアップ一覧データ @@ -49,36 +49,36 @@ namespace GameLauncher public SaveEditorWindow(UnityGameItem game) { - InitializeComponent(); - Game = game; + this.InitializeComponent(); + this.Game = game; - lblGameTitle.Text = game.Title; - lblGameInfo.Text = $"{game.CompanyName} / {game.ProductName} ({game.BackendBadgeText})"; + this.lblGameTitle.Text = game.Title; + this.lblGameInfo.Text = $"{game.CompanyName} / {game.ProductName} ({game.BackendBadgeText})"; // PlayerPrefs ビュー - _prefsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_allPrefs); - _prefsView.Filter = FilterPrefs; - dgPlayerPrefs.ItemsSource = _prefsView; + this._prefsView = (ListCollectionView)CollectionViewSource.GetDefaultView(this._allPrefs); + this._prefsView.Filter = this.FilterPrefs; + this.dgPlayerPrefs.ItemsSource = this._prefsView; // ファイル一覧 - lstSaveFiles.ItemsSource = _saveFiles; + this.lstSaveFiles.ItemsSource = this._saveFiles; // GUI プロパティビュー - _guiPropsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_guiProperties); - _guiPropsView.Filter = FilterGuiProperties; - dgGuiProperties.ItemsSource = _guiPropsView; + this._guiPropsView = (ListCollectionView)CollectionViewSource.GetDefaultView(this._guiProperties); + this._guiPropsView.Filter = this.FilterGuiProperties; + this.dgGuiProperties.ItemsSource = this._guiPropsView; // バックアップ一覧 - dgBackups.ItemsSource = _backups; + this.dgBackups.ItemsSource = this._backups; - Loaded += SaveEditorWindow_Loaded; + Loaded += this.SaveEditorWindow_Loaded; } private void SaveEditorWindow_Loaded(object sender, RoutedEventArgs e) { - ReloadPlayerPrefs(); - ReloadSaveFiles(); - ReloadBackups(); + this.ReloadPlayerPrefs(); + this.ReloadSaveFiles(); + this.ReloadBackups(); } // ==================================================================== @@ -87,26 +87,26 @@ namespace GameLauncher public void ReloadPlayerPrefs() { - _allPrefs.Clear(); - if (string.IsNullOrEmpty(Game.RegistryPath)) + this._allPrefs.Clear(); + if (string.IsNullOrEmpty(this.Game.RegistryPath)) { - lblStatus.Text = "レジストリ情報が設定されていません (app.info が見つかりませんでした)"; + this.lblStatus.Text = "レジストリ情報が設定されていません (app.info が見つかりませんでした)"; return; } - var entries = _saveService.GetPlayerPrefs(Game.RegistryPath); + var entries = this._saveService.GetPlayerPrefs(this.Game.RegistryPath); foreach (var entry in entries) { - _allPrefs.Add(entry); + this._allPrefs.Add(entry); } - lblStatus.Text = $"PlayerPrefs: {entries.Count} 件のキーを読み込みました (HKCU\\{Game.RegistryPath})"; + this.lblStatus.Text = $"PlayerPrefs: {entries.Count} 件のキーを読み込みました (HKCU\\{this.Game.RegistryPath})"; } private bool FilterPrefs(object obj) { if (obj is not PlayerPrefsEntry entry) return false; - var query = txtSearchPrefs.Text.Trim(); + var query = this.txtSearchPrefs.Text.Trim(); if (string.IsNullOrEmpty(query)) return true; return entry.CleanKey.Contains(query, StringComparison.OrdinalIgnoreCase) || @@ -116,26 +116,26 @@ namespace GameLauncher private void txtSearchPrefs_TextChanged(object sender, TextChangedEventArgs e) { - _prefsView.Refresh(); + this._prefsView.Refresh(); } private void dgPlayerPrefs_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if (dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry) + if (this.dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry) { - lblSelectedKeyName.Text = entry.CleanKey; - txtEditValueBar.Text = entry.EditValue; - txtEditValueBar.IsEnabled = true; - btnSaveCurrentPref.IsEnabled = true; - btnDeleteCurrentPref.IsEnabled = true; + this.lblSelectedKeyName.Text = entry.CleanKey; + this.txtEditValueBar.Text = entry.EditValue; + this.txtEditValueBar.IsEnabled = true; + this.btnSaveCurrentPref.IsEnabled = true; + this.btnDeleteCurrentPref.IsEnabled = true; } else { - lblSelectedKeyName.Text = "(なし)"; - txtEditValueBar.Text = string.Empty; - txtEditValueBar.IsEnabled = false; - btnSaveCurrentPref.IsEnabled = false; - btnDeleteCurrentPref.IsEnabled = false; + this.lblSelectedKeyName.Text = "(なし)"; + this.txtEditValueBar.Text = string.Empty; + this.txtEditValueBar.IsEnabled = false; + this.btnSaveCurrentPref.IsEnabled = false; + this.btnDeleteCurrentPref.IsEnabled = false; } } @@ -143,25 +143,25 @@ namespace GameLauncher { if (e.Key == Key.Enter) { - SaveCurrentSelectedPref(); + this.SaveCurrentSelectedPref(); } } private void btnSaveCurrentPref_Click(object sender, RoutedEventArgs e) { - SaveCurrentSelectedPref(); + this.SaveCurrentSelectedPref(); } private void SaveCurrentSelectedPref() { - if (dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return; + if (this.dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return; - entry.EditValue = txtEditValueBar.Text; - bool success = _saveService.SavePlayerPref(Game.RegistryPath, entry); + entry.EditValue = this.txtEditValueBar.Text; + bool success = this._saveService.SavePlayerPref(this.Game.RegistryPath, entry); if (success) { - lblStatus.Text = $"キー '{entry.CleanKey}' の値を正常に更新しました。"; - dgPlayerPrefs.Items.Refresh(); + this.lblStatus.Text = $"キー '{entry.CleanKey}' の値を正常に更新しました。"; + this.dgPlayerPrefs.Items.Refresh(); } else { @@ -172,16 +172,16 @@ namespace GameLauncher private void btnDeleteCurrentPref_Click(object sender, RoutedEventArgs e) { - if (dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return; + if (this.dgPlayerPrefs.SelectedItem is not PlayerPrefsEntry entry) return; var res = MessageBox.Show($"キー '{entry.CleanKey}' ({entry.RawKey}) をレジストリから削除しますか?", "キー削除の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (res != MessageBoxResult.Yes) return; - if (_saveService.DeletePlayerPref(Game.RegistryPath, entry.RawKey)) + if (this._saveService.DeletePlayerPref(this.Game.RegistryPath, entry.RawKey)) { - _allPrefs.Remove(entry); - lblStatus.Text = $"キー '{entry.CleanKey}' を削除しました。"; + this._allPrefs.Remove(entry); + this.lblStatus.Text = $"キー '{entry.CleanKey}' を削除しました。"; } else { @@ -194,10 +194,10 @@ namespace GameLauncher var dlg = new AddKeyDialog { Owner = this }; if (dlg.ShowDialog() == true) { - if (_saveService.AddPlayerPref(Game.RegistryPath, dlg.KeyName, dlg.KeyType, dlg.KeyValue, out string rawKey)) + if (this._saveService.AddPlayerPref(this.Game.RegistryPath, dlg.KeyName, dlg.KeyType, dlg.KeyValue, out string rawKey)) { - ReloadPlayerPrefs(); - lblStatus.Text = $"新規キー '{dlg.KeyName}' ({rawKey}) を追加しました。"; + this.ReloadPlayerPrefs(); + this.lblStatus.Text = $"新規キー '{dlg.KeyName}' ({rawKey}) を追加しました。"; } else { @@ -208,12 +208,12 @@ namespace GameLauncher private void btnBackupPrefs_Click(object sender, RoutedEventArgs e) { - var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory); - var result = _saveService.BackupRegistry(Game.RegistryPath, backupDir); + var backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory); + var result = this._saveService.BackupRegistry(this.Game.RegistryPath, backupDir); if (result != null) { - ReloadBackups(); - lblStatus.Text = $"レジストリをバックアップしました: {Path.GetFileName(result)}"; + this.ReloadBackups(); + this.lblStatus.Text = $"レジストリをバックアップしました: {Path.GetFileName(result)}"; MessageBox.Show($"レジストリをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information); } else @@ -224,7 +224,7 @@ namespace GameLauncher private void btnRestorePrefs_Click(object sender, RoutedEventArgs e) { - var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory); + var backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory); var dlg = new OpenFileDialog { Title = "復元する .reg ファイルを選択", @@ -238,10 +238,10 @@ namespace GameLauncher "復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (res != MessageBoxResult.Yes) return; - if (_saveService.RestoreRegistry(dlg.FileName)) + if (this._saveService.RestoreRegistry(dlg.FileName)) { - ReloadPlayerPrefs(); - lblStatus.Text = "レジストリを正常に復元しました。"; + this.ReloadPlayerPrefs(); + this.lblStatus.Text = "レジストリを正常に復元しました。"; MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information); } else @@ -253,17 +253,17 @@ namespace GameLauncher private void btnReloadPrefs_Click(object sender, RoutedEventArgs e) { - ReloadPlayerPrefs(); + this.ReloadPlayerPrefs(); } private void ctxSavePref_Click(object sender, RoutedEventArgs e) { - SaveCurrentSelectedPref(); + this.SaveCurrentSelectedPref(); } private void ctxCopyKey_Click(object sender, RoutedEventArgs e) { - if (dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry) + if (this.dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry) { Clipboard.SetText(entry.CleanKey); } @@ -271,7 +271,7 @@ namespace GameLauncher private void ctxCopyValue_Click(object sender, RoutedEventArgs e) { - if (dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry) + if (this.dgPlayerPrefs.SelectedItem is PlayerPrefsEntry entry) { Clipboard.SetText(entry.EditValue); } @@ -279,7 +279,7 @@ namespace GameLauncher private void ctxDeletePref_Click(object sender, RoutedEventArgs e) { - btnDeleteCurrentPref_Click(sender, e); + this.btnDeleteCurrentPref_Click(sender, e); } // ==================================================================== @@ -288,98 +288,98 @@ namespace GameLauncher public void ReloadSaveFiles() { - _saveFiles.Clear(); - var files = _saveService.GetSaveFiles(Game); + this._saveFiles.Clear(); + var files = this._saveService.GetSaveFiles(this.Game); foreach (var f in files) { - _saveFiles.Add(f); + this._saveFiles.Add(f); } - if (_saveFiles.Count > 0) + if (this._saveFiles.Count > 0) { - lstSaveFiles.SelectedIndex = 0; + this.lstSaveFiles.SelectedIndex = 0; } else { - lblCurrentFileName.Text = "セーブファイルは見つかりませんでした"; - lblCurrentFilePath.Text = string.Empty; - txtFileContent.Text = string.Empty; - HideAllEditorPanels(); + this.lblCurrentFileName.Text = "セーブファイルは見つかりませんでした"; + this.lblCurrentFilePath.Text = string.Empty; + this.txtFileContent.Text = string.Empty; + this.HideAllEditorPanels(); } } private void HideAllEditorPanels() { - pnlGuiEditor.Visibility = Visibility.Collapsed; - pnlTextEditor.Visibility = Visibility.Collapsed; - pnlUnsupportedBinary.Visibility = Visibility.Collapsed; - btnFormatJson.Visibility = Visibility.Collapsed; - btnSaveFileContent.Visibility = Visibility.Collapsed; - btnSaveGuiProperties.Visibility = Visibility.Collapsed; - badgeCodec.Visibility = Visibility.Collapsed; + this.pnlGuiEditor.Visibility = Visibility.Collapsed; + this.pnlTextEditor.Visibility = Visibility.Collapsed; + this.pnlUnsupportedBinary.Visibility = Visibility.Collapsed; + this.btnFormatJson.Visibility = Visibility.Collapsed; + this.btnSaveFileContent.Visibility = Visibility.Collapsed; + this.btnSaveGuiProperties.Visibility = Visibility.Collapsed; + this.badgeCodec.Visibility = Visibility.Collapsed; } private void lstSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if (lstSaveFiles.SelectedItem is not SaveFileEntry entry) return; - _currentSelectedFile = entry; + if (this.lstSaveFiles.SelectedItem is not SaveFileEntry entry) return; + this._currentSelectedFile = entry; - lblCurrentFileName.Text = entry.FileName; - lblCurrentFilePath.Text = entry.FilePath; - HideAllEditorPanels(); + this.lblCurrentFileName.Text = entry.FileName; + this.lblCurrentFilePath.Text = entry.FilePath; + this.HideAllEditorPanels(); // 1. コーデック(対応形式)が存在するか判定 - var codec = SaveDataCodecManager.Instance.FindCodec(Game, entry); + var codec = SaveDataCodecManager.Instance.FindCodec(this.Game, entry); if (codec != null) { // GUI エディタモードをアクティブ化 - _currentCodec = codec; - badgeCodec.Visibility = Visibility.Visible; - lblCodecName.Text = codec.CodecName; + this._currentCodec = codec; + this.badgeCodec.Visibility = Visibility.Visible; + this.lblCodecName.Text = codec.CodecName; - LoadGuiPropertiesFromCodec(codec, entry.FilePath); - pnlGuiEditor.Visibility = Visibility.Visible; - btnSaveGuiProperties.Visibility = Visibility.Visible; - lblStatus.Text = $"{codec.CodecName} で読み込みました: {entry.FileName}"; + this.LoadGuiPropertiesFromCodec(codec, entry.FilePath); + this.pnlGuiEditor.Visibility = Visibility.Visible; + this.btnSaveGuiProperties.Visibility = Visibility.Visible; + this.lblStatus.Text = $"{codec.CodecName} で読み込みました: {entry.FileName}"; return; } // 2. プレーンテキスト/JSON形式の場合 if (entry.IsTextOrJson) { - pnlTextEditor.Visibility = Visibility.Visible; - txtFileContent.Text = _saveService.ReadSaveFileText(entry.FilePath); - btnFormatJson.Visibility = Visibility.Visible; - btnSaveFileContent.Visibility = Visibility.Visible; - lblStatus.Text = $"テキストとして開きました: {entry.FileName}"; + this.pnlTextEditor.Visibility = Visibility.Visible; + this.txtFileContent.Text = this._saveService.ReadSaveFileText(entry.FilePath); + this.btnFormatJson.Visibility = Visibility.Visible; + this.btnSaveFileContent.Visibility = Visibility.Visible; + this.lblStatus.Text = $"テキストとして開きました: {entry.FileName}"; return; } // 3. 未対応のバイナリセーブデータ形式の場合 - pnlUnsupportedBinary.Visibility = Visibility.Visible; - DisplayUnsupportedBinaryInfo(entry); - lblStatus.Text = $"未対応のバイナリセーブデータ: {entry.FileName}"; + this.pnlUnsupportedBinary.Visibility = Visibility.Visible; + this.DisplayUnsupportedBinaryInfo(entry); + this.lblStatus.Text = $"未対応のバイナリセーブデータ: {entry.FileName}"; } private void LoadGuiPropertiesFromCodec(ISaveDataCodec codec, string filePath) { - _guiProperties.Clear(); + this._guiProperties.Clear(); var props = codec.LoadProperties(filePath); foreach (var p in props) { - _guiProperties.Add(p); + this._guiProperties.Add(p); } - lblGuiPropCount.Text = $"{props.Count} 項目"; + this.lblGuiPropCount.Text = $"{props.Count} 項目"; if (props.Count > 0) { - dgGuiProperties.SelectedIndex = 0; + this.dgGuiProperties.SelectedIndex = 0; } } private bool FilterGuiProperties(object obj) { if (obj is not SaveDataPropertyEntry prop) return false; - var query = txtSearchGuiProps.Text.Trim(); + var query = this.txtSearchGuiProps.Text.Trim(); if (string.IsNullOrEmpty(query)) return true; return prop.Key.Contains(query, StringComparison.OrdinalIgnoreCase) || @@ -389,26 +389,26 @@ namespace GameLauncher private void txtSearchGuiProps_TextChanged(object sender, TextChangedEventArgs e) { - _guiPropsView.Refresh(); - int visibleCount = _guiPropsView.Cast().Count(); - lblGuiPropCount.Text = $"{visibleCount} / {_guiProperties.Count} 項目"; + this._guiPropsView.Refresh(); + int visibleCount = this._guiPropsView.Cast().Count(); + this.lblGuiPropCount.Text = $"{visibleCount} / {this._guiProperties.Count} 項目"; } private void dgGuiProperties_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if (dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop) + if (this.dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop) { - lblSelectedPropKey.Text = prop.Key; - txtEditPropValueBar.Text = prop.EditValue; - txtEditPropValueBar.IsEnabled = true; - btnApplyPropValue.IsEnabled = true; + this.lblSelectedPropKey.Text = prop.Key; + this.txtEditPropValueBar.Text = prop.EditValue; + this.txtEditPropValueBar.IsEnabled = true; + this.btnApplyPropValue.IsEnabled = true; } else { - lblSelectedPropKey.Text = "(未選択)"; - txtEditPropValueBar.Text = string.Empty; - txtEditPropValueBar.IsEnabled = false; - btnApplyPropValue.IsEnabled = false; + this.lblSelectedPropKey.Text = "(未選択)"; + this.txtEditPropValueBar.Text = string.Empty; + this.txtEditPropValueBar.IsEnabled = false; + this.btnApplyPropValue.IsEnabled = false; } } @@ -416,28 +416,28 @@ namespace GameLauncher { if (e.Key == Key.Enter) { - btnApplyPropValue_Click(sender, e); + this.btnApplyPropValue_Click(sender, e); } } private void btnApplyPropValue_Click(object sender, RoutedEventArgs e) { - if (dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop) + if (this.dgGuiProperties.SelectedItem is SaveDataPropertyEntry prop) { - prop.EditValue = txtEditPropValueBar.Text; - dgGuiProperties.Items.Refresh(); - lblStatus.Text = $"項目 '{prop.Key}' の値を変更しました。(「変更を保存」ボタンでファイルへ書き戻せます)"; + prop.EditValue = this.txtEditPropValueBar.Text; + this.dgGuiProperties.Items.Refresh(); + this.lblStatus.Text = $"項目 '{prop.Key}' の値を変更しました。(「変更を保存」ボタンでファイルへ書き戻せます)"; } } private void btnSaveGuiProperties_Click(object sender, RoutedEventArgs e) { - if (_currentSelectedFile == null || _currentCodec == null) return; + if (this._currentSelectedFile == null || this._currentCodec == null) return; - bool success = _currentCodec.SaveProperties(_currentSelectedFile.FilePath, _guiProperties.ToList()); + bool success = this._currentCodec.SaveProperties(this._currentSelectedFile.FilePath, [.. this._guiProperties]); if (success) { - lblStatus.Text = $"セーブファイルを正常に更新しました (自動バックアップ .bak 作成済み): {_currentSelectedFile.FileName}"; + this.lblStatus.Text = $"セーブファイルを正常に更新しました (自動バックアップ .bak 作成済み): {this._currentSelectedFile.FileName}"; MessageBox.Show("セーブファイルを正常に更新・保存しました。\n(元のファイルは同階層に .bak として自動バックアップされています)", "保存完了", MessageBoxButton.OK, MessageBoxImage.Information); } @@ -460,41 +460,41 @@ namespace GameLauncher { hexList.Add(bytes[i].ToString("X2")); } - lblHexPreview.Text = string.Join(" ", hexList) + (bytes.Length > 32 ? " ..." : ""); + this.lblHexPreview.Text = string.Join(" ", hexList) + (bytes.Length > 32 ? " ..." : ""); } } catch { - lblHexPreview.Text = "(読み込み失敗)"; + this.lblHexPreview.Text = "(読み込み失敗)"; } } private void btnCopyIdePrompt_Click(object sender, RoutedEventArgs e) { - if (_currentSelectedFile == null) return; + if (this._currentSelectedFile == null) return; - string prompt = SaveDataCodecManager.Instance.GenerateAntigravityPrompt(Game, _currentSelectedFile); + string prompt = SaveDataCodecManager.Instance.GenerateAntigravityPrompt(this.Game, this._currentSelectedFile); Clipboard.SetText(prompt); - lblStatus.Text = "📋 Antigravity IDE 用の解析依頼プロンプトをクリップボードにコピーしました!"; + this.lblStatus.Text = "📋 Antigravity IDE 用の解析依頼プロンプトをクリップボードにコピーしました!"; MessageBox.Show("Antigravity IDE 解析用プロンプトをコピーしました!\n\nAntigravity IDE のチャット欄に貼り付けて送信すると、AIがこのゲームのセーブデータ構造を解析し、GUI編集プラグインを自動で追加してくれます。", "プロンプトをコピーしました", MessageBoxButton.OK, MessageBoxImage.Information); } private void btnForceShowBinary_Click(object sender, RoutedEventArgs e) { - if (_currentSelectedFile == null) return; - pnlUnsupportedBinary.Visibility = Visibility.Collapsed; - pnlTextEditor.Visibility = Visibility.Visible; - btnSaveFileContent.Visibility = Visibility.Visible; - txtFileContent.Text = _saveService.ReadSaveFileText(_currentSelectedFile.FilePath); + if (this._currentSelectedFile == null) return; + this.pnlUnsupportedBinary.Visibility = Visibility.Collapsed; + this.pnlTextEditor.Visibility = Visibility.Visible; + this.btnSaveFileContent.Visibility = Visibility.Visible; + this.txtFileContent.Text = this._saveService.ReadSaveFileText(this._currentSelectedFile.FilePath); } private void btnFormatJson_Click(object sender, RoutedEventArgs e) { try { - var raw = txtFileContent.Text; + var raw = this.txtFileContent.Text; if (string.IsNullOrWhiteSpace(raw)) return; using var doc = JsonDocument.Parse(raw); @@ -503,8 +503,8 @@ namespace GameLauncher WriteIndented = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }); - txtFileContent.Text = formatted; - lblStatus.Text = "JSONを整形しました。"; + this.txtFileContent.Text = formatted; + this.lblStatus.Text = "JSONを整形しました。"; } catch (Exception ex) { @@ -514,12 +514,12 @@ namespace GameLauncher private void btnSaveFileContent_Click(object sender, RoutedEventArgs e) { - if (_currentSelectedFile == null) return; + if (this._currentSelectedFile == null) return; - bool success = _saveService.WriteSaveFileText(_currentSelectedFile.FilePath, txtFileContent.Text); + bool success = this._saveService.WriteSaveFileText(this._currentSelectedFile.FilePath, this.txtFileContent.Text); if (success) { - lblStatus.Text = $"ファイルを保存しました (自動バックアップ .bak 作成済み): {_currentSelectedFile.FileName}"; + this.lblStatus.Text = $"ファイルを保存しました (自動バックアップ .bak 作成済み): {this._currentSelectedFile.FileName}"; MessageBox.Show("ファイルを保存しました。\n(元のファイルは同階層に .bak としてバックアップされています)", "保存完了", MessageBoxButton.OK, MessageBoxImage.Information); } @@ -532,14 +532,14 @@ namespace GameLauncher private void btnBackupSingleFile_Click(object sender, RoutedEventArgs e) { - if (_currentSelectedFile == null) return; + if (this._currentSelectedFile == null) return; - var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory); - var result = _saveService.BackupSaveFile(_currentSelectedFile.FilePath, backupDir); + var backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory); + var result = this._saveService.BackupSaveFile(this._currentSelectedFile.FilePath, backupDir); if (result != null) { - ReloadBackups(); - lblStatus.Text = $"ファイルをバックアップしました: {Path.GetFileName(result)}"; + this.ReloadBackups(); + this.lblStatus.Text = $"ファイルをバックアップしました: {Path.GetFileName(result)}"; MessageBox.Show($"ファイルをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information); } else @@ -550,7 +550,7 @@ namespace GameLauncher private void btnReloadSaveFiles_Click(object sender, RoutedEventArgs e) { - ReloadSaveFiles(); + this.ReloadSaveFiles(); } // ==================================================================== @@ -559,22 +559,22 @@ namespace GameLauncher public void ReloadBackups() { - _backups.Clear(); - var list = _saveService.GetBackupList(Game); + this._backups.Clear(); + var list = this._saveService.GetBackupList(this.Game); foreach (var b in list) { - _backups.Add(b); + this._backups.Add(b); } } private void btnReloadBackups_Click(object sender, RoutedEventArgs e) { - ReloadBackups(); + this.ReloadBackups(); } private void btnOpenBackupDir_Click(object sender, RoutedEventArgs e) { - var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory); + var backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory); UnitySaveManagerService.OpenFolderInExplorer(backupDir); } @@ -588,9 +588,9 @@ namespace GameLauncher "復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (res == MessageBoxResult.Yes) { - if (_saveService.RestoreRegistry(backup.BackupPath)) + if (this._saveService.RestoreRegistry(backup.BackupPath)) { - ReloadPlayerPrefs(); + this.ReloadPlayerPrefs(); MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information); } else @@ -613,29 +613,29 @@ namespace GameLauncher private void btnOpenLocalLow_Click(object sender, RoutedEventArgs e) { - if (!string.IsNullOrEmpty(Game.LocalLowPath)) + if (!string.IsNullOrEmpty(this.Game.LocalLowPath)) { - if (!Directory.Exists(Game.LocalLowPath)) + if (!Directory.Exists(this.Game.LocalLowPath)) { - var parent = Path.GetDirectoryName(Game.LocalLowPath); + var parent = Path.GetDirectoryName(this.Game.LocalLowPath); if (parent != null && Directory.Exists(parent)) { UnitySaveManagerService.OpenFolderInExplorer(parent); return; } } - UnitySaveManagerService.OpenFolderInExplorer(Game.LocalLowPath); + UnitySaveManagerService.OpenFolderInExplorer(this.Game.LocalLowPath); } } private void btnOpenGameFolder_Click(object sender, RoutedEventArgs e) { - UnitySaveManagerService.OpenFolderInExplorer(Game.RootDirectory); + UnitySaveManagerService.OpenFolderInExplorer(this.Game.RootDirectory); } private void btnOpenRegedit_Click(object sender, RoutedEventArgs e) { - _saveService.OpenRegistryEditor(Game.RegistryPath); + this._saveService.OpenRegistryEditor(this.Game.RegistryPath); } } } diff --git a/Services/Codecs/EasySave3Codec.cs b/Services/Codecs/EasySave3Codec.cs index 7205c22..a689395 100644 --- a/Services/Codecs/EasySave3Codec.cs +++ b/Services/Codecs/EasySave3Codec.cs @@ -270,15 +270,17 @@ namespace GameLauncher.Services.Codecs /// バイナリ情報プロパティのリスト private List ExtractBinaryPropertiesFallback(byte[] bytes) { - var list = new List(); - list.Add(new SaveDataPropertyEntry + var list = new List { - Key = "FileSize", - Category = "ファイル情報", - Type = "Int", - EditValue = bytes.Length.ToString(), - Description = "ファイルサイズ (bytes)" - }); + new SaveDataPropertyEntry + { + Key = "FileSize", + Category = "ファイル情報", + Type = "Int", + EditValue = bytes.Length.ToString(), + Description = "ファイルサイズ (bytes)" + } + }; // 先頭 128 バイトから 4 バイト整数と ASCII 文字列を検出してプロパティ化 int limit = Math.Min(bytes.Length - 4, 128); @@ -388,7 +390,7 @@ namespace GameLauncher.Services.Codecs try { // ドットと角括弧でパスを分割 - var parts = path.Split(new[] { '.', '[', ']' }, StringSplitOptions.RemoveEmptyEntries); + var parts = path.Split(['.', '[', ']'], StringSplitOptions.RemoveEmptyEntries); JsonNode? current = root; for (int i = 0; i < parts.Length - 1; i++) diff --git a/Services/GameScannerService.cs b/Services/GameScannerService.cs index 3d999c1..fdae989 100644 --- a/Services/GameScannerService.cs +++ b/Services/GameScannerService.cs @@ -132,8 +132,8 @@ namespace GameLauncher.Services public GameScannerService() { var baseDir = AppPathHelper.GetExeDirectory(); - _cacheFilePath = Path.Combine(baseDir, "games_cache.json"); - _bookmarksFilePath = Path.Combine(baseDir, "bookmarks.json"); + this._cacheFilePath = Path.Combine(baseDir, "games_cache.json"); + this._bookmarksFilePath = Path.Combine(baseDir, "bookmarks.json"); } /// @@ -145,11 +145,11 @@ namespace GameLauncher.Services var list = new List(); // 1. 本アプリのキャッシュが存在すればロード - if (File.Exists(_cacheFilePath)) + if (File.Exists(this._cacheFilePath)) { try { - string json = File.ReadAllText(_cacheFilePath); + string json = File.ReadAllText(this._cacheFilePath); var entries = JsonSerializer.Deserialize>(json); if (entries != null) { @@ -451,7 +451,7 @@ namespace GameLauncher.Services if (imported) { - SaveCache(list); + this.SaveCache(list); } } catch { } @@ -460,7 +460,7 @@ namespace GameLauncher.Services // キャッシュが破棄・再スキャンされても、ブックマークは bookmarks.json から維持されます。 try { - var bookmarkKeys = LoadBookmarks(); + var bookmarkKeys = this.LoadBookmarks(); if (bookmarkKeys.Count > 0) { foreach (var item in list) @@ -473,7 +473,7 @@ namespace GameLauncher.Services } // フォルダが消えたブックマークを除去し、既存キャッシュからの移行も兼ねて保存し直します。 - SaveBookmarks(list); + this.SaveBookmarks(list); } catch { } @@ -569,7 +569,7 @@ namespace GameLauncher.Services }; string json = JsonSerializer.Serialize(entries, options); - File.WriteAllText(_cacheFilePath, json); + File.WriteAllText(this._cacheFilePath, json); } catch { } } @@ -606,12 +606,12 @@ namespace GameLauncher.Services try { - if (!File.Exists(_bookmarksFilePath)) + if (!File.Exists(this._bookmarksFilePath)) { return set; } - string json = File.ReadAllText(_bookmarksFilePath); + string json = File.ReadAllText(this._bookmarksFilePath); var keys = JsonSerializer.Deserialize>(json); if (keys != null) { @@ -651,7 +651,7 @@ namespace GameLauncher.Services }; string json = JsonSerializer.Serialize(keys, options); - File.WriteAllText(_bookmarksFilePath, json); + File.WriteAllText(this._bookmarksFilePath, json); } catch { } } @@ -712,7 +712,7 @@ namespace GameLauncher.Services } // セーブデータ有無確認 - bool hasSave = CheckHasSaveData(ug); + bool hasSave = this.CheckHasSaveData(ug); if (ug.HasSaveData != hasSave) { ug.HasSaveData = hasSave; @@ -987,7 +987,7 @@ namespace GameLauncher.Services if (cacheNeedsSave) { - SaveCache(copyList.Where(g => Directory.Exists(g.RootDirectory))); + this.SaveCache(copyList.Where(g => Directory.Exists(g.RootDirectory))); } }, ct); } @@ -1017,7 +1017,7 @@ namespace GameLauncher.Services List subDirs; try { - subDirs = Directory.EnumerateDirectories(targetPath).ToList(); + subDirs = [.. Directory.EnumerateDirectories(targetPath)]; } catch { @@ -1042,7 +1042,7 @@ namespace GameLauncher.Services if (isExisting) return; // ディレクトリ直下のゲームを検出 - var game = DetectGameInDirectory(dir); + var game = this.DetectGameInDirectory(dir); if (game != null) { lock (existingPaths) @@ -1068,7 +1068,7 @@ namespace GameLauncher.Services } if (isChildExisting) continue; - var childGame = DetectGameInDirectory(childDir); + var childGame = this.DetectGameInDirectory(childDir); if (childGame != null) { lock (existingPaths) @@ -1105,21 +1105,21 @@ namespace GameLauncher.Services // 後段のティラノ判定が誤反応してUnityがティラノ扱いになるため、 // 信頼性の高いUnity証拠(UnityPlayer.dll / *_Data\globalgamemanagers 等)を // 最優先で評価し、他エンジン判定より先に確定させる。 - var unityGame = DetectUnityGameInDirectory(dirPath); + var unityGame = this.DetectUnityGameInDirectory(dirPath); if (unityGame != null) { return unityGame; } // 2. 次にツクール/ティラノ判定 - var tkoolGame = DetectTkoolGameInDirectory(dirPath); + var tkoolGame = this.DetectTkoolGameInDirectory(dirPath); if (tkoolGame != null) { return tkoolGame; } // 3. どの特定エンジンにも該当しない場合は「その他」ゲーム判定 - var otherGame = DetectOtherGameInDirectory(dirPath); + var otherGame = this.DetectOtherGameInDirectory(dirPath); if (otherGame != null) { return otherGame; @@ -1240,7 +1240,7 @@ namespace GameLauncher.Services var canApplyMod = false; if (isExtracted && evbOutDir != null) { - var pluginsJs = FindPluginsJs(evbOutDir, maxDepth: 2); + var pluginsJs = this.FindPluginsJs(evbOutDir, maxDepth: 2); if (!string.IsNullOrEmpty(pluginsJs) && File.Exists(pluginsJs)) { pluginsJsPath = pluginsJs; @@ -1315,22 +1315,22 @@ namespace GameLauncher.Services // 0. Enigma Virtual Box (EVB) パック済みゲームの検出(最優先・前段)。 // EVB は汎用パッカーで、内部にどのエンジンのゲームでも包めるため、 // 他エンジン判定より前に評価し、Evb 用の情報(本来エンジン等)を付与する。 - var evbGame = DetectEvbGameInDirectory(dirPath, folderName, folderModified); + var evbGame = this.DetectEvbGameInDirectory(dirPath, folderName, folderModified); if (evbGame != null) { return evbGame; } // 1. 通常の plugins.js 探索 - var pluginsJs = FindPluginsJs(dirPath, maxDepth: 2); + var pluginsJs = this.FindPluginsJs(dirPath, maxDepth: 2); if (pluginsJs != null) { var pluginsDir = Path.Combine(Path.GetDirectoryName(pluginsJs)!, "plugins"); var jsDir = Path.GetDirectoryName(pluginsJs)!; - var engineType = DetectEngineType(jsDir); - var title = ExtractTkoolTitle(dirPath, jsDir); - var exePath = FindTkoolExecutable(dirPath, jsDir); + var engineType = this.DetectEngineType(jsDir); + var title = this.ExtractTkoolTitle(dirPath, jsDir); + var exePath = this.FindTkoolExecutable(dirPath, jsDir); var icon = LoadIcon(exePath, dirPath); var isModded = TkoolModService.CheckIsModded(pluginsJs); @@ -1357,24 +1357,24 @@ namespace GameLauncher.Services } // 2. boxed(nw.js埋め込み: *boxed*.exe + 埋め込みpackage.nw または on-disk www\)のツクール探索 - var boxedGame = DetectBoxedNwGameInDirectory(dirPath, folderName, folderModified); + var boxedGame = this.DetectBoxedNwGameInDirectory(dirPath, folderName, folderModified); if (boxedGame != null) { return boxedGame; } // 3. FOSSIL単体exe同梱のツクールMZ探索 (js/plugins.jsがexe内に埋め込まれている形態) - var fossilMzGame = DetectFossilMZGameInDirectory(dirPath, folderName, folderModified); + var fossilMzGame = this.DetectFossilMZGameInDirectory(dirPath, folderName, folderModified); if (fossilMzGame != null) { return fossilMzGame; } // 3. 通常のティラノスクリプト探索 - var tyranoIndex = FindTyranoIndexHtml(dirPath); + var tyranoIndex = this.FindTyranoIndexHtml(dirPath); if (tyranoIndex != null) { - var exePath = FindTkoolExecutable(dirPath, Path.GetDirectoryName(tyranoIndex)!); + var exePath = this.FindTkoolExecutable(dirPath, Path.GetDirectoryName(tyranoIndex)!); var icon = LoadIcon(exePath, dirPath); var isModded = TyranoModService.CheckIsModded(tyranoIndex); bool isAsarPkg = AsarArchiveService.FindAsarPackage(dirPath, out var aPath, out bool isExt, out var extDir); @@ -1403,14 +1403,14 @@ namespace GameLauncher.Services // 4. app.asar パッケージであるか判定 if (AsarArchiveService.FindAsarPackage(dirPath, out var asarPath, out bool isExtracted, out var extractedDirPath)) { - var inspect = _asarService.InspectAsar(asarPath!); + var inspect = this._asarService.InspectAsar(asarPath!); if (inspect.IsValid && (inspect.IsTkoolGame || inspect.IsTyranoGame)) { var relJs = inspect.RelativePluginsJsPath ?? (inspect.IsTyranoGame ? "index.html" : "project/js/plugins.js"); var plannedJsPath = Path.Combine(extractedDirPath!, relJs.Replace('/', Path.DirectorySeparatorChar)); var plannedPluginsDir = Path.Combine(Path.GetDirectoryName(plannedJsPath)!, "plugins"); - var exePath = FindTkoolExecutable(dirPath, extractedDirPath ?? dirPath); + var exePath = this.FindTkoolExecutable(dirPath, extractedDirPath ?? dirPath); var icon = LoadIcon(exePath, dirPath); bool isModded = false; @@ -1446,21 +1446,21 @@ namespace GameLauncher.Services } // 5. WOLF RPGエディター(ウディタ)ゲームの検出 - var wolfGame = DetectWolfGameInDirectory(dirPath, folderName, folderModified); + var wolfGame = this.DetectWolfGameInDirectory(dirPath, folderName, folderModified); if (wolfGame != null) { return wolfGame; } // 6. SRPG Studio ゲームの検出 - var srpgGame = DetectSrpgGameInDirectory(dirPath, folderName, folderModified); + var srpgGame = this.DetectSrpgGameInDirectory(dirPath, folderName, folderModified); if (srpgGame != null) { return srpgGame; } // 7. ツクールVX / VX Ace (RGSS2 / RGSS3) ゲームの検出 - var rgssGame = DetectRgssGameInDirectory(dirPath, folderName, folderModified); + var rgssGame = this.DetectRgssGameInDirectory(dirPath, folderName, folderModified); if (rgssGame != null) { return rgssGame; @@ -1634,12 +1634,12 @@ namespace GameLauncher.Services long size = fs.Length; // package.nw マーカーは exe の中間域に置かれることが多いため、中央付近から数点だけ走査する - long[] probes = new[] - { + long[] probes = + [ Math.Max(0, size / 2 - windowSize / 2), Math.Max(0, size / 4), Math.Max(0, size * 3 / 4), - }; + ]; foreach (var start in probes) { @@ -1699,7 +1699,7 @@ namespace GameLauncher.Services var dataDir = Path.Combine(dirPath, "data"); var engine = DetectEngineTypeByDataJson(dirPath); - var title = ExtractTkoolTitle(dirPath, dataDir); + var title = this.ExtractTkoolTitle(dirPath, dataDir); var icon = LoadIcon(boxedExe, dirPath); return new TkoolGameItem @@ -1769,7 +1769,7 @@ namespace GameLauncher.Services return false; } - double[] fractions = { 0.25, 0.5, 0.75, 0.9 }; + double[] fractions = [0.25, 0.5, 0.75, 0.9]; foreach (var frac in fractions) { long start = (long)(size * frac); @@ -1888,7 +1888,7 @@ namespace GameLauncher.Services var trim = line.Trim(); if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase)) { - var val = trim.Substring(6).Trim(); + var val = trim[6..].Trim(); if (!string.IsNullOrWhiteSpace(val)) { title = val; @@ -2082,7 +2082,7 @@ namespace GameLauncher.Services var trim = line.Trim(); if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase)) { - var val = trim.Substring(6).Trim(); + var val = trim[6..].Trim(); if (!string.IsNullOrWhiteSpace(val)) { title = val; @@ -2284,12 +2284,12 @@ namespace GameLauncher.Services } else if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase)) { - var val = trim.Substring(6).Trim(); + var val = trim[6..].Trim(); if (!string.IsNullOrEmpty(val)) title = val; } else if (trim.StartsWith("RTP=", StringComparison.OrdinalIgnoreCase)) { - var val = trim.Substring(4).Trim(); + var val = trim[4..].Trim(); if (val.Contains("RPGVXAce", StringComparison.OrdinalIgnoreCase)) { engineType = TkoolEngineType.VXAce; @@ -2303,7 +2303,7 @@ namespace GameLauncher.Services } else if (trim.StartsWith("Library=", StringComparison.OrdinalIgnoreCase)) { - var val = trim.Substring(8).Trim(); + var val = trim[8..].Trim(); if (val.Contains("RGSS3", StringComparison.OrdinalIgnoreCase)) { engineType = TkoolEngineType.VXAce; @@ -2321,7 +2321,7 @@ namespace GameLauncher.Services } else if (trim.StartsWith("Scripts=", StringComparison.OrdinalIgnoreCase)) { - var val = trim.Substring(8).Trim(); + var val = trim[8..].Trim(); if (val.EndsWith(".rvdata2", StringComparison.OrdinalIgnoreCase)) { engineType = TkoolEngineType.VXAce; @@ -2346,8 +2346,8 @@ namespace GameLauncher.Services } // アーカイブファイルの探索 - var rgss3aFiles = Directory.Exists(searchDir) ? Directory.GetFiles(searchDir, "*.rgss3a", SearchOption.TopDirectoryOnly) : Array.Empty(); - var rgss2aFiles = Directory.Exists(searchDir) ? Directory.GetFiles(searchDir, "*.rgss2a", SearchOption.TopDirectoryOnly) : Array.Empty(); + var rgss3aFiles = Directory.Exists(searchDir) ? Directory.GetFiles(searchDir, "*.rgss3a", SearchOption.TopDirectoryOnly) : []; + var rgss2aFiles = Directory.Exists(searchDir) ? Directory.GetFiles(searchDir, "*.rgss2a", SearchOption.TopDirectoryOnly) : []; if (rgss3aFiles.Length > 0) { @@ -2475,7 +2475,7 @@ namespace GameLauncher.Services continue; } - var result = FindPluginsJs(dir, maxDepth, currentDepth + 1); + var result = this.FindPluginsJs(dir, maxDepth, currentDepth + 1); if (result != null) return result; } } @@ -2489,14 +2489,14 @@ namespace GameLauncher.Services try { var directIndex = Path.Combine(dirPath, "index.html"); - if (File.Exists(directIndex) && CheckIsTyranoDirectory(dirPath)) + if (File.Exists(directIndex) && this.CheckIsTyranoDirectory(dirPath)) { return directIndex; } // FOSSILで梱包されたティラノスクリプトは index.html が FOSSILindex.html にリネームされる var directFossilIndex = Path.Combine(dirPath, "FOSSILindex.html"); - if (File.Exists(directFossilIndex) && CheckIsTyranoDirectory(dirPath)) + if (File.Exists(directFossilIndex) && this.CheckIsTyranoDirectory(dirPath)) { return directFossilIndex; } @@ -2511,13 +2511,13 @@ namespace GameLauncher.Services continue; var subIndex = Path.Combine(sub, "index.html"); - if (File.Exists(subIndex) && CheckIsTyranoDirectory(sub)) + if (File.Exists(subIndex) && this.CheckIsTyranoDirectory(sub)) { return subIndex; } var subFossilIndex = Path.Combine(sub, "FOSSILindex.html"); - if (File.Exists(subFossilIndex) && CheckIsTyranoDirectory(sub)) + if (File.Exists(subFossilIndex) && this.CheckIsTyranoDirectory(sub)) { return subFossilIndex; } @@ -2732,7 +2732,7 @@ namespace GameLauncher.Services } // 3. 実行可能ファイル(.exe)の探索 - var exePath = FindUnityExecutable(dirPath, dataDir); + var exePath = this.FindUnityExecutable(dirPath, dataDir); if (exePath == null) { return null; @@ -2753,14 +2753,14 @@ namespace GameLauncher.Services } // 5. バックエンド(IL2CPP / Mono)の判定 - var backend = DetectUnityBackendType(dirPath, dataDir); + var backend = this.DetectUnityBackendType(dirPath, dataDir); // 6. Unityバージョンの取得 - var unityVersion = DetectUnityVersion(dirPath, dataDir, unityPlayerDll); + var unityVersion = this.DetectUnityVersion(dirPath, dataDir, unityPlayerDll); // 7. タイトルの決定 var folderName = Path.GetFileName(dirPath.TrimEnd('\\', '/')); - var title = DetermineUnityTitle(dirPath, exePath, productName, folderName); + var title = this.DetermineUnityTitle(dirPath, exePath, productName, folderName); // 8. アイコン読み込み var icon = LoadIcon(exePath, dirPath); @@ -2784,7 +2784,7 @@ namespace GameLauncher.Services FolderLastModified = folderModified }; - game.HasSaveData = CheckHasSaveData(game); + game.HasSaveData = this.CheckHasSaveData(game); return game; } diff --git a/Services/WindowResizeService.cs b/Services/WindowResizeService.cs index df2ea4b..c5a8489 100644 --- a/Services/WindowResizeService.cs +++ b/Services/WindowResizeService.cs @@ -67,12 +67,12 @@ namespace GameLauncher.Services catch (Exception ex) { // 外部ツール起動失敗時は内蔵方式にフォールバック - var (ok, msg) = await ApplyBuiltInResizeAsync(process); + var (ok, msg) = await this.ApplyBuiltInResizeAsync(process); return (ok, $"外部ツール起動に失敗したため内蔵方式を使用: {ex.Message} / {msg}"); } } - return await ApplyBuiltInResizeAsync(process); + return await this.ApplyBuiltInResizeAsync(process); } /// diff --git a/WolfSaveEditorDialog.xaml.cs b/WolfSaveEditorDialog.xaml.cs index 71fca44..90d2889 100644 --- a/WolfSaveEditorDialog.xaml.cs +++ b/WolfSaveEditorDialog.xaml.cs @@ -27,15 +27,15 @@ namespace GameLauncher public WolfSaveEditorDialog(TkoolGameItem game, WolfSaveService saveService) { - InitializeComponent(); - _game = game; - _saveService = saveService; + this.InitializeComponent(); + this._game = game; + this._saveService = saveService; - lblGameTitle.Text = _game.Title; - lblGamePath.Text = _game.RootDirectory; - txtInfoBackupDir.Text = AppPathHelper.GetGameBackupDirectory(_game.FolderName, _game.RootDirectory); + this.lblGameTitle.Text = this._game.Title; + this.lblGamePath.Text = this._game.RootDirectory; + this.txtInfoBackupDir.Text = AppPathHelper.GetGameBackupDirectory(this._game.FolderName, this._game.RootDirectory); - LoadSaveFileList(); + this.LoadSaveFileList(); } /// @@ -45,36 +45,36 @@ namespace GameLauncher { try { - var files = _saveService.GetSaveFiles(_game.RootDirectory); - cboSaveFiles.Items.Clear(); + var files = this._saveService.GetSaveFiles(this._game.RootDirectory); + this.cboSaveFiles.Items.Clear(); foreach (var f in files) { - cboSaveFiles.Items.Add(Path.GetFileName(f)); + this.cboSaveFiles.Items.Add(Path.GetFileName(f)); } - if (cboSaveFiles.Items.Count > 0) + if (this.cboSaveFiles.Items.Count > 0) { - cboSaveFiles.SelectedIndex = 0; + this.cboSaveFiles.SelectedIndex = 0; } else { - lblStatus.Text = "セーブデータ(*.sav)が見つかりませんでした。"; + this.lblStatus.Text = "セーブデータ(*.sav)が見つかりませんでした。"; } } catch (Exception ex) { - lblStatus.Text = $"セーブファイル列挙エラー: {ex.Message}"; + this.lblStatus.Text = $"セーブファイル列挙エラー: {ex.Message}"; } } private void cboSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if (cboSaveFiles.SelectedItem == null) return; - var fileName = cboSaveFiles.SelectedItem.ToString(); + if (this.cboSaveFiles.SelectedItem == null) return; + var fileName = this.cboSaveFiles.SelectedItem.ToString(); if (string.IsNullOrEmpty(fileName)) return; - LoadSaveFile(fileName); + this.LoadSaveFile(fileName); } /// @@ -84,46 +84,46 @@ namespace GameLauncher { try { - var files = _saveService.GetSaveFiles(_game.RootDirectory); + var files = this._saveService.GetSaveFiles(this._game.RootDirectory); var fullPath = files.FirstOrDefault(f => string.Equals(Path.GetFileName(f), fileName, StringComparison.OrdinalIgnoreCase)); if (string.IsNullOrEmpty(fullPath) || !File.Exists(fullPath)) { - lblStatus.Text = $"ファイルが存在しません: {fileName}"; + this.lblStatus.Text = $"ファイルが存在しません: {fileName}"; return; } - _currentSaveData = _saveService.LoadSave(fullPath); - _allVariables = [.. _currentSaveData.Variables]; - _allStrings = [.. _currentSaveData.Strings]; + this._currentSaveData = this._saveService.LoadSave(fullPath); + this._allVariables = [.. this._currentSaveData.Variables]; + this._allStrings = [.. this._currentSaveData.Strings]; // メタ情報表示 - txtInfoTitle.Text = string.IsNullOrEmpty(_currentSaveData.GameTitle) ? "(不明)" : _currentSaveData.GameTitle; - txtInfoVersion.Text = $"0x{_currentSaveData.FileVersion:X4}"; - txtInfoEncoding.Text = _currentSaveData.IsUtf8 ? "UTF-8" : "Shift-JIS (CP932)"; - txtInfoSize.Text = $"{_currentSaveData.RawDecryptedBytes.Length:N0} バイト"; + this.txtInfoTitle.Text = string.IsNullOrEmpty(this._currentSaveData.GameTitle) ? "(不明)" : this._currentSaveData.GameTitle; + this.txtInfoVersion.Text = $"0x{this._currentSaveData.FileVersion:X4}"; + this.txtInfoEncoding.Text = this._currentSaveData.IsUtf8 ? "UTF-8" : "Shift-JIS (CP932)"; + this.txtInfoSize.Text = $"{this._currentSaveData.RawDecryptedBytes.Length:N0} バイト"; - ApplyFilter(); + this.ApplyFilter(); - lblStatus.Text = $"'{fileName}' を正常に読み込みました。"; - lblSaveCount.Text = $"変数項目: {_allVariables.Count}件, 文字列項目: {_allStrings.Count}件"; + this.lblStatus.Text = $"'{fileName}' を正常に読み込みました。"; + this.lblSaveCount.Text = $"変数項目: {this._allVariables.Count}件, 文字列項目: {this._allStrings.Count}件"; } catch (Exception ex) { MessageBox.Show($"セーブデータの読み込みに失敗しました:\n{ex.Message}", "読み込みエラー", MessageBoxButton.OK, MessageBoxImage.Error); - lblStatus.Text = $"読み込みエラー: {ex.Message}"; + this.lblStatus.Text = $"読み込みエラー: {ex.Message}"; } } private void btnReload_Click(object sender, RoutedEventArgs e) { - if (cboSaveFiles.SelectedItem != null) + if (this.cboSaveFiles.SelectedItem != null) { - LoadSaveFile(cboSaveFiles.SelectedItem.ToString()!); + this.LoadSaveFile(this.cboSaveFiles.SelectedItem.ToString()!); } else { - LoadSaveFileList(); + this.LoadSaveFileList(); } } @@ -132,23 +132,23 @@ namespace GameLauncher /// private void ApplyFilter() { - var filter = txtFilter.Text?.Trim() ?? string.Empty; + var filter = this.txtFilter.Text?.Trim() ?? string.Empty; if (string.IsNullOrEmpty(filter)) { - dgVariables.ItemsSource = _allVariables; - dgStrings.ItemsSource = _allStrings; + this.dgVariables.ItemsSource = this._allVariables; + this.dgStrings.ItemsSource = this._allStrings; } else { - dgVariables.ItemsSource = _allVariables + this.dgVariables.ItemsSource = this._allVariables .Where(v => v.DisplayName.Contains(filter, StringComparison.OrdinalIgnoreCase) || v.Category.Contains(filter, StringComparison.OrdinalIgnoreCase) || v.Value.ToString().Contains(filter, StringComparison.OrdinalIgnoreCase) || v.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase)) .ToList(); - dgStrings.ItemsSource = _allStrings + this.dgStrings.ItemsSource = this._allStrings .Where(s => s.Value.Contains(filter, StringComparison.OrdinalIgnoreCase) || s.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase)) .ToList(); @@ -157,7 +157,7 @@ namespace GameLauncher private void txtFilter_TextChanged(object sender, TextChangedEventArgs e) { - ApplyFilter(); + this.ApplyFilter(); } /// @@ -165,21 +165,21 @@ namespace GameLauncher /// private void btnSearchValue_Click(object sender, RoutedEventArgs e) { - if (!int.TryParse(txtTargetValue.Text.Trim(), out int target)) + if (!int.TryParse(this.txtTargetValue.Text.Trim(), out int target)) { MessageBox.Show("検索する数値を半角数字で入力してください。(例: 現在の所持金やステータス)", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Information); return; } - var matches = _allVariables.Where(v => v.Value == target).ToList(); + var matches = this._allVariables.Where(v => v.Value == target).ToList(); if (matches.Count == 0) { MessageBox.Show($"値が {target:N0} と一致する変数が見つかりませんでした。", "検索結果", MessageBoxButton.OK, MessageBoxImage.Information); return; } - dgVariables.ItemsSource = matches; - lblStatus.Text = $"値 {target:N0} に一致する候補が {matches.Count} 件見つかりました。"; + this.dgVariables.ItemsSource = matches; + this.lblStatus.Text = $"値 {target:N0} に一致する候補が {matches.Count} 件見つかりました。"; } /// @@ -187,7 +187,7 @@ namespace GameLauncher /// private void btnSetMaxTarget_Click(object sender, RoutedEventArgs e) { - if (dgVariables.ItemsSource is not IEnumerable currentList) return; + if (this.dgVariables.ItemsSource is not IEnumerable currentList) return; var list = currentList.ToList(); if (list.Count == 0) return; @@ -201,8 +201,8 @@ namespace GameLauncher { item.Value = 9999999; } - dgVariables.Items.Refresh(); - lblStatus.Text = $"{list.Count} 件の値を 9,999,999 に変更しました。保存ボタンを押すと反映されます。"; + this.dgVariables.Items.Refresh(); + this.lblStatus.Text = $"{list.Count} 件の値を 9,999,999 に変更しました。保存ボタンを押すと反映されます。"; } } @@ -214,14 +214,14 @@ namespace GameLauncher if (sender is Button btn && btn.Tag is WolfVariableItem item) { item.Value = 9999999; - dgVariables.Items.Refresh(); - lblStatus.Text = $"{item.DisplayName} の値を 9,999,999 に設定しました。"; + this.dgVariables.Items.Refresh(); + this.lblStatus.Text = $"{item.DisplayName} の値を 9,999,999 に設定しました。"; } } private void dgVariables_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { - lblStatus.Text = "値を編集しました。「上書き保存」を押すとバックアップを作成して保存されます。"; + this.lblStatus.Text = "値を編集しました。「上書き保存」を押すとバックアップを作成して保存されます。"; } /// @@ -229,7 +229,7 @@ namespace GameLauncher /// private void btnSave_Click(object sender, RoutedEventArgs e) { - if (_currentSaveData == null) + if (this._currentSaveData == null) { MessageBox.Show("保存対象のセーブデータがありません。", "エラー", MessageBoxButton.OK, MessageBoxImage.Warning); return; @@ -238,19 +238,19 @@ namespace GameLauncher try { // 変数リストの最新値をモデルへ反映 - _currentSaveData.Variables = _allVariables; + this._currentSaveData.Variables = this._allVariables; // 保存実行 (自動バックアップ) - string backupPath = _saveService.SaveToFile(_currentSaveData, _game.FolderName, _game.RootDirectory); + string backupPath = this._saveService.SaveToFile(this._currentSaveData, this._game.FolderName, this._game.RootDirectory); - var msg = $"セーブデータ '{_currentSaveData.FileName}' を安全に上書き保存しました!\n\n【バックアップ保存先】\n{backupPath}"; + var msg = $"セーブデータ '{this._currentSaveData.FileName}' を安全に上書き保存しました!\n\n【バックアップ保存先】\n{backupPath}"; MessageBox.Show(msg, "保存完了", MessageBoxButton.OK, MessageBoxImage.Information); - lblStatus.Text = $"保存完了 (バックアップ: {Path.GetFileName(backupPath)})"; + this.lblStatus.Text = $"保存完了 (バックアップ: {Path.GetFileName(backupPath)})"; } catch (Exception ex) { MessageBox.Show($"保存中にエラーが発生しました:\n{ex.Message}", "保存エラー", MessageBoxButton.OK, MessageBoxImage.Error); - lblStatus.Text = $"保存エラー: {ex.Message}"; + this.lblStatus.Text = $"保存エラー: {ex.Message}"; } } @@ -259,20 +259,20 @@ namespace GameLauncher /// private void btnExportJson_Click(object sender, RoutedEventArgs e) { - if (_currentSaveData == null) return; + if (this._currentSaveData == null) return; var sfd = new SaveFileDialog { Title = "セーブデータを JSON としてエクスポート", Filter = "JSON ファイル (*.json)|*.json", - FileName = $"{Path.GetFileNameWithoutExtension(_currentSaveData.FileName)}_export.json" + FileName = $"{Path.GetFileNameWithoutExtension(this._currentSaveData.FileName)}_export.json" }; if (sfd.ShowDialog() == true) { try { - _saveService.ExportToJson(_currentSaveData, sfd.FileName); + this._saveService.ExportToJson(this._currentSaveData, sfd.FileName); MessageBox.Show($"JSON ファイルをエクスポートしました:\n{sfd.FileName}", "エクスポート完了", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) @@ -287,7 +287,7 @@ namespace GameLauncher /// private void btnImportJson_Click(object sender, RoutedEventArgs e) { - if (_currentSaveData == null) return; + if (this._currentSaveData == null) return; var ofd = new OpenFileDialog { @@ -299,9 +299,9 @@ namespace GameLauncher { try { - _saveService.ImportFromJson(_currentSaveData, ofd.FileName); - _allVariables = [.. _currentSaveData.Variables]; - ApplyFilter(); + this._saveService.ImportFromJson(this._currentSaveData, ofd.FileName); + this._allVariables = [.. this._currentSaveData.Variables]; + this.ApplyFilter(); MessageBox.Show("JSON データを正常に取り込みました。「上書き保存」を押すとファイルへ反映されます。", "インポート完了", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) @@ -318,7 +318,7 @@ namespace GameLauncher { try { - var dir = AppPathHelper.GetGameBackupDirectory(_game.FolderName, _game.RootDirectory); + var dir = AppPathHelper.GetGameBackupDirectory(this._game.FolderName, this._game.RootDirectory); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir);