スタイル: コーディング規約に準拠したコードフォーマットの適用(this.の明示、空白スタイルの統一)

- 自インスタンスメンバーアクセスへの this. 付与(28ファイル)
- .editorconfig に準拠したインデント・波括弧・空白スタイルの適用
- UTF-8 (BOMあり)、CRLF改行コード、行末空白除去の整合性検証
This commit is contained in:
armonica committed 2026-10-20 10:14:26 +09:00
1 parent 2fa40c950f
commit ae86b53147
28 files changed
+1349 -1367

No files matched your search

+11 -11
View File
@@ -16,37 +16,37 @@ namespace GameLauncher
public AddKeyDialog() public AddKeyDialog()
{ {
InitializeComponent(); this.InitializeComponent();
txtKeyName.Focus(); this.txtKeyName.Focus();
} }
private void btnOk_Click(object sender, RoutedEventArgs e) private void btnOk_Click(object sender, RoutedEventArgs e)
{ {
var keyName = txtKeyName.Text.Trim(); var keyName = this.txtKeyName.Text.Trim();
if (string.IsNullOrWhiteSpace(keyName)) if (string.IsNullOrWhiteSpace(keyName))
{ {
MessageBox.Show("キー名を入力してください。", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Warning); MessageBox.Show("キー名を入力してください。", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
return; return;
} }
KeyName = keyName; this.KeyName = keyName;
var selectedTag = (cmbKeyType.SelectedItem as ComboBoxItem)?.Tag?.ToString(); var selectedTag = (this.cmbKeyType.SelectedItem as ComboBoxItem)?.Tag?.ToString();
KeyType = selectedTag switch this.KeyType = selectedTag switch
{ {
"Float" => PlayerPrefsType.Float, "Float" => PlayerPrefsType.Float,
"String" => PlayerPrefsType.String, "String" => PlayerPrefsType.String,
_ => PlayerPrefsType.Int _ => PlayerPrefsType.Int
}; };
KeyValue = txtKeyValue.Text; this.KeyValue = this.txtKeyValue.Text;
DialogResult = true; this.DialogResult = true;
Close(); this.Close();
} }
private void btnCancel_Click(object sender, RoutedEventArgs e) private void btnCancel_Click(object sender, RoutedEventArgs e)
{ {
DialogResult = false; this.DialogResult = false;
Close(); this.Close();
} }
} }
} }
+22 -22
View File
@@ -19,14 +19,14 @@ namespace GameLauncher
public ConfigDialog(LauncherConfig config) public ConfigDialog(LauncherConfig config)
{ {
InitializeComponent(); this.InitializeComponent();
_config = config; this._config = config;
txtRgssExtractorPath.Text = _config.RgssExtractorPath ?? @"C:\Soft\RGSS-Extractor-v1.0\RGSS Extractor.exe"; this.txtRgssExtractorPath.Text = this._config.RgssExtractorPath ?? @"C:\Soft\RGSS-Extractor-v1.0\RGSS Extractor.exe";
txtWolfExtractorPath.Text = _config.WolfExtractorPath ?? string.Empty; this.txtWolfExtractorPath.Text = this._config.WolfExtractorPath ?? string.Empty;
txtWindowResizeToolPath.Text = _config.WindowResizeToolPath ?? string.Empty; this.txtWindowResizeToolPath.Text = this._config.WindowResizeToolPath ?? string.Empty;
txtBackupsPath.Text = AppPathHelper.GetBackupsDirectory(); this.txtBackupsPath.Text = AppPathHelper.GetBackupsDirectory();
chkDefaultApplyMod.IsChecked = _config.DefaultApplyMod; this.chkDefaultApplyMod.IsChecked = this._config.DefaultApplyMod;
} }
private void btnBrowseExtractor_Click(object sender, RoutedEventArgs e) private void btnBrowseExtractor_Click(object sender, RoutedEventArgs e)
@@ -38,7 +38,7 @@ namespace GameLauncher
FileName = "RGSS Extractor.exe" FileName = "RGSS Extractor.exe"
}; };
var currentDir = Path.GetDirectoryName(txtRgssExtractorPath.Text); var currentDir = Path.GetDirectoryName(this.txtRgssExtractorPath.Text);
if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir)) if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir))
{ {
ofd.InitialDirectory = currentDir; ofd.InitialDirectory = currentDir;
@@ -46,7 +46,7 @@ namespace GameLauncher
if (ofd.ShowDialog() == true) if (ofd.ShowDialog() == true)
{ {
txtRgssExtractorPath.Text = ofd.FileName; this.txtRgssExtractorPath.Text = ofd.FileName;
} }
} }
@@ -59,7 +59,7 @@ namespace GameLauncher
FileName = "UberWolfCli.exe" FileName = "UberWolfCli.exe"
}; };
var currentDir = Path.GetDirectoryName(txtWolfExtractorPath.Text); var currentDir = Path.GetDirectoryName(this.txtWolfExtractorPath.Text);
if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir)) if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir))
{ {
ofd.InitialDirectory = currentDir; ofd.InitialDirectory = currentDir;
@@ -67,7 +67,7 @@ namespace GameLauncher
if (ofd.ShowDialog() == true) if (ofd.ShowDialog() == true)
{ {
txtWolfExtractorPath.Text = ofd.FileName; this.txtWolfExtractorPath.Text = ofd.FileName;
} }
} }
@@ -80,7 +80,7 @@ namespace GameLauncher
FileName = "Sizer.exe" FileName = "Sizer.exe"
}; };
var currentDir = Path.GetDirectoryName(txtWindowResizeToolPath.Text); var currentDir = Path.GetDirectoryName(this.txtWindowResizeToolPath.Text);
if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir)) if (!string.IsNullOrEmpty(currentDir) && Directory.Exists(currentDir))
{ {
ofd.InitialDirectory = currentDir; ofd.InitialDirectory = currentDir;
@@ -88,7 +88,7 @@ namespace GameLauncher
if (ofd.ShowDialog() == true) 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) private void btnSave_Click(object sender, RoutedEventArgs e)
{ {
_config.RgssExtractorPath = txtRgssExtractorPath.Text.Trim(); this._config.RgssExtractorPath = this.txtRgssExtractorPath.Text.Trim();
_config.WolfExtractorPath = txtWolfExtractorPath.Text.Trim(); this._config.WolfExtractorPath = this.txtWolfExtractorPath.Text.Trim();
_config.WindowResizeToolPath = txtWindowResizeToolPath.Text.Trim(); this._config.WindowResizeToolPath = this.txtWindowResizeToolPath.Text.Trim();
_config.DefaultApplyMod = chkDefaultApplyMod.IsChecked == true; this._config.DefaultApplyMod = this.chkDefaultApplyMod.IsChecked == true;
IsSaved = true; this.IsSaved = true;
DialogResult = true; this.DialogResult = true;
Close(); this.Close();
} }
private void btnCancel_Click(object sender, RoutedEventArgs e) private void btnCancel_Click(object sender, RoutedEventArgs e)
{ {
DialogResult = false; this.DialogResult = false;
Close(); this.Close();
} }
} }
} }
+1 -1
View File
@@ -29,7 +29,7 @@ namespace GameLauncher.Engines.Evb
private const string EnigmaSecondarySection = ".enigma2"; private const string EnigmaSecondarySection = ".enigma2";
/// <summary>EVB virtual filesystem header magic ("EVB\0").</summary> /// <summary>EVB virtual filesystem header magic ("EVB\0").</summary>
private static readonly byte[] EvbMagic = { 0x45, 0x56, 0x42, 0x00 }; private static readonly byte[] EvbMagic = [0x45, 0x56, 0x42, 0x00];
/// <summary>Returns true when the given executable is packed with EVB and can be unpacked.</summary> /// <summary>Returns true when the given executable is packed with EVB and can be unpacked.</summary>
/// <remarks> /// <remarks>
+1 -1
View File
@@ -34,7 +34,7 @@ namespace GameLauncher.Engines.Evb
/// <inheritdoc /> /// <inheritdoc />
public string ResolveToolPath(string toolFileName) public string ResolveToolPath(string toolFileName)
=> AppPathHelperBridge.Resolve(EngineName, toolFileName); => AppPathHelperBridge.Resolve(this.EngineName, toolFileName);
} }
/// <summary> /// <summary>
+2 -2
View File
@@ -79,7 +79,7 @@ namespace GameLauncher.Engines.Evb
try try
{ {
// Preferred names commonly used by NW.js / RPG Maker / Tyrano bundles. // 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) foreach (var name in preferred)
{ {
var direct = Path.Combine(outputDirectory, name); var direct = Path.Combine(outputDirectory, name);
@@ -302,7 +302,7 @@ namespace GameLauncher.Engines.Evb
{ {
foreach (var backup in Directory.GetFiles(gameRootDir, "*" + ExeBackupSuffix)) 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)) if (!File.Exists(original))
{ {
File.Move(backup, original); File.Move(backup, original);
+7 -9
View File
@@ -170,7 +170,7 @@ namespace GameLauncher.Engines.Nwjs
long packageJsonOffset = -1; long packageJsonOffset = -1;
long packageJsonSize = -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 systemJsonRelative, ref systemJsonOffset, ref systemJsonSize,
ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize); ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize);
@@ -274,7 +274,7 @@ namespace GameLauncher.Engines.Nwjs
if (val.TryGetProperty("files", out var subFiles)) 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 systemJsonRelative, ref systemJsonOffset, ref systemJsonSize,
ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize); ref packageJsonRelative, ref packageJsonOffset, ref packageJsonSize);
} }
@@ -395,7 +395,7 @@ namespace GameLauncher.Engines.Nwjs
// UNC パス (例: \\server\share\...) の場合 // UNC パス (例: \\server\share\...) の場合
if (normalized.StartsWith(@"\\", StringComparison.Ordinal)) 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)) if (full.StartsWith(@"\\", StringComparison.Ordinal))
{ {
return @"\\?\UNC\" + full.Substring(2); return @"\\?\UNC\" + full[2..];
} }
return @"\\?\" + full; 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) if (!inspect.IsValid || inspect.FileEntries.Count == 0)
{ {
return (false, "asar ファイルのヘッダ解析に失敗したか、ファイルが含まれていません。"); return (false, "asar ファイルのヘッダ解析に失敗したか、ファイルが含まれていません。");
@@ -503,8 +503,7 @@ namespace GameLauncher.Engines.Nwjs
fs.Seek(dataOffset + entry.Offset, SeekOrigin.Begin); fs.Seek(dataOffset + entry.Offset, SeekOrigin.Begin);
long remaining = entry.Size; 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 toRead = (int)Math.Min(remaining, buffer.Length);
@@ -518,7 +517,6 @@ namespace GameLauncher.Engines.Nwjs
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) catch (Exception fileEx)
{ {
// 予約文字や排他ロック等の例外が発生した場合、解凍全体を止めずに警告として記録 // 予約文字や排他ロック等の例外が発生した場合、解凍全体を止めずに警告として記録
@@ -573,7 +571,7 @@ namespace GameLauncher.Engines.Nwjs
: asarPath + AsarBackupSuffix; : asarPath + AsarBackupSuffix;
var originalAsar = asarPath.EndsWith(AsarBackupSuffix, StringComparison.OrdinalIgnoreCase) var originalAsar = asarPath.EndsWith(AsarBackupSuffix, StringComparison.OrdinalIgnoreCase)
? asarPath.Substring(0, asarPath.Length - AsarBackupSuffix.Length) ? asarPath[..^AsarBackupSuffix.Length]
: asarPath; : asarPath;
string extExtractedDir = ToExtendedPath(extractedDir); string extExtractedDir = ToExtendedPath(extractedDir);
@@ -52,7 +52,7 @@ namespace GameLauncher.Engines.Rgss.Games.IiniTitleRepair
var trim = line.Trim(); var trim = line.Trim();
if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase)) if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase))
{ {
var val = trim.Substring(6).Trim(); var val = trim[6..].Trim();
if (!string.IsNullOrWhiteSpace(val) && !val.Contains('\uFFFD')) if (!string.IsNullOrWhiteSpace(val) && !val.Contains('\uFFFD'))
{ {
tg.Title = val; tg.Title = val;
@@ -73,23 +73,23 @@ namespace GameLauncher.Engines.Rgss.Games.IiniTitleRepair
{ {
try try
{ {
if (!File.Exists(filePath)) return Array.Empty<string>(); if (!File.Exists(filePath)) return [];
byte[] bytes = File.ReadAllBytes(filePath); byte[] bytes = File.ReadAllBytes(filePath);
if (bytes.Length == 0) return Array.Empty<string>(); if (bytes.Length == 0) return [];
// 1. UTF-8 BOM (EF BB BF) // 1. UTF-8 BOM (EF BB BF)
if (bytes.Length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) 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); 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) // 2. UTF-16 LE BOM (FF FE)
if (bytes.Length >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE) if (bytes.Length >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE)
{ {
var text = System.Text.Encoding.Unicode.GetString(bytes, 2, bytes.Length - 2); 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) // 3. Shift_JIS (CP932)
@@ -104,11 +104,11 @@ namespace GameLauncher.Engines.Rgss.Games.IiniTitleRepair
} }
var decoded = encoding.GetString(bytes); 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 catch
{ {
return Array.Empty<string>(); return [];
} }
} }
} }
+7 -12
View File
@@ -415,11 +415,11 @@ namespace GameLauncher.Engines.Rgss
{ {
if (game.ApplyMod) if (game.ApplyMod)
{ {
return await ApplyModAsync(game, pluginSettings, rgssExtractorPath); return await this.ApplyModAsync(game, pluginSettings, rgssExtractorPath);
} }
else else
{ {
return RestoreOriginal(game); return this.RestoreOriginal(game);
} }
} }
@@ -439,7 +439,7 @@ namespace GameLauncher.Engines.Rgss
// 1. スクリプトファイルが存在しない場合(RGSS暗号化アーカイブ内の場合)、自動抽出 // 1. スクリプトファイルが存在しない場合(RGSS暗号化アーカイブ内の場合)、自動抽出
if (string.IsNullOrEmpty(scriptsPath) || !File.Exists(scriptsPath)) if (string.IsNullOrEmpty(scriptsPath) || !File.Exists(scriptsPath))
{ {
var (extractSuccess, extractMsg) = await ExtractScriptsAsync(game, rgssExtractorPath); var (extractSuccess, extractMsg) = await this.ExtractScriptsAsync(game, rgssExtractorPath);
if (!extractSuccess) if (!extractSuccess)
{ {
return (false, $"スクリプトの抽出に失敗したため改造を適用できませんでした: {extractMsg}"); return (false, $"スクリプトの抽出に失敗したため改造を適用できませんでした: {extractMsg}");
@@ -819,14 +819,13 @@ namespace GameLauncher.Engines.Rgss
if (parserType != null) if (parserType != null)
{ {
var parser = Activator.CreateInstance(parserType); 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 getFileDataMethod = parserType.GetMethod("get_filedata");
var closeFileMethod = parserType.GetMethod("close_file"); var closeFileMethod = parserType.GetMethod("close_file");
if (parseFileMethod != null && getFileDataMethod != null && parser != null) if (parseFileMethod != null && getFileDataMethod != null && parser != null)
{ {
var entries = parseFileMethod.Invoke(parser, new object[] { archivePath }) as System.Collections.IEnumerable; if (parseFileMethod.Invoke(parser, [archivePath]) is System.Collections.IEnumerable entries)
if (entries != null)
{ {
foreach (var entry in entries) foreach (var entry in entries)
{ {
@@ -839,8 +838,7 @@ namespace GameLauncher.Engines.Rgss
(entryName.EndsWith(targetFileName, StringComparison.OrdinalIgnoreCase) || (entryName.EndsWith(targetFileName, StringComparison.OrdinalIgnoreCase) ||
Path.GetFileName(entryName).Equals(targetFileName, StringComparison.OrdinalIgnoreCase))) Path.GetFileName(entryName).Equals(targetFileName, StringComparison.OrdinalIgnoreCase)))
{ {
var fileBytes = getFileDataMethod.Invoke(parser, new object[] { entry }) as byte[]; if (getFileDataMethod.Invoke(parser, [entry]) is byte[] fileBytes && fileBytes.Length > 0)
if (fileBytes != null && fileBytes.Length > 0)
{ {
closeFileMethod?.Invoke(parser, null); closeFileMethod?.Invoke(parser, null);
@@ -873,10 +871,7 @@ namespace GameLauncher.Engines.Rgss
}; };
using var proc = Process.Start(psi); using var proc = Process.Start(psi);
if (proc != null) proc?.WaitForExit(30000); // 最大30秒待機
{
proc.WaitForExit(30000); // 最大30秒待機
}
// RGSS Extractor はツール自身のフォルダ配下に Data\Scripts.rvdata2 等を出力 // RGSS Extractor はツール自身のフォルダ配下に Data\Scripts.rvdata2 等を出力
var possibleOutput = Path.Combine(toolDir, "Data", targetFileName); var possibleOutput = Path.Combine(toolDir, "Data", targetFileName);
+12 -12
View File
@@ -513,7 +513,7 @@ namespace GameLauncher.Engines.Rgss
int endIdx = content.IndexOf(ModEndTag, StringComparison.Ordinal); int endIdx = content.IndexOf(ModEndTag, StringComparison.Ordinal);
if (endIdx > startIdx) 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); File.WriteAllText(scriptPath, content, Encoding.UTF8);
return; return;
} }
@@ -562,7 +562,7 @@ namespace GameLauncher.Engines.Rgss
if (!SrpgArchiveService.IsExtracted(gameDir)) if (!SrpgArchiveService.IsExtracted(gameDir))
{ {
progress?.Report("アーカイブ(data.dts)を初回展開中..."); progress?.Report("アーカイブ(data.dts)を初回展開中...");
var unpackRes = await _archiveService.UnpackDataDtsAsync(gameDir, progress); var unpackRes = await this._archiveService.UnpackDataDtsAsync(gameDir, progress);
if (!unpackRes.Success) if (!unpackRes.Success)
{ {
return unpackRes; return unpackRes;
@@ -571,7 +571,7 @@ namespace GameLauncher.Engines.Rgss
var extractedDir = SrpgArchiveService.GetExtractedDirectory(gameDir); var extractedDir = SrpgArchiveService.GetExtractedDirectory(gameDir);
progress?.Report("Modスクリプトを生成中..."); progress?.Report("Modスクリプトを生成中...");
var modBody = GenerateModScript(item); var modBody = this.GenerateModScript(item);
var jsContent = $"{ModStartTag}\n{modBody}\n{ModEndTag}"; var jsContent = $"{ModStartTag}\n{modBody}\n{ModEndTag}";
// 2. 既存のスクリプトへ注入 // 2. 既存のスクリプトへ注入
@@ -604,7 +604,7 @@ namespace GameLauncher.Engines.Rgss
// 3. data.dts を再パック // 3. data.dts を再パック
progress?.Report("Modを適用した 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) if (repackRes.Success)
{ {
item.IsModded = true; item.IsModded = true;
@@ -658,8 +658,8 @@ namespace GameLauncher.Engines.Rgss
// 2. バックアップが存在すればバックアップ復元を試行 // 2. バックアップが存在すればバックアップ復元を試行
progress?.Report("オリジナルバックアップから data.dts を復元中..."); progress?.Report("オリジナルバックアップから data.dts を復元中...");
var revertRes = await _archiveService.RevertBackupAsync(gameDir); var (Success, Message) = await this._archiveService.RevertBackupAsync(gameDir);
if (revertRes.Success) if (Success)
{ {
item.IsModded = false; item.IsModded = false;
return (true, "改造プラグインを解除し、元のアーカイブへ復元しました。"); return (true, "改造プラグインを解除し、元のアーカイブへ復元しました。");
@@ -667,7 +667,7 @@ namespace GameLauncher.Engines.Rgss
// バックアップが無い場合は Mod解除状態で再パック // バックアップが無い場合は Mod解除状態で再パック
progress?.Report("Mod解除状態でアーカイブを再構築中..."); progress?.Report("Mod解除状態でアーカイブを再構築中...");
var repackRes = await _archiveService.RepackDataDtsAsync(gameDir, progress); var repackRes = await this._archiveService.RepackDataDtsAsync(gameDir, progress);
if (repackRes.Success) if (repackRes.Success)
{ {
item.IsModded = false; item.IsModded = false;
@@ -689,7 +689,7 @@ namespace GameLauncher.Engines.Rgss
// 1. プロキシDLL解除 // 1. プロキシDLL解除
if (IsProxyDllEnabled(gameDir)) if (IsProxyDllEnabled(gameDir))
{ {
DisableProxyDll(gameDir); this.DisableProxyDll(gameDir);
logs.Add("・プロキシDLL (version.dll) を解除しました"); logs.Add("・プロキシDLL (version.dll) を解除しました");
} }
@@ -726,10 +726,10 @@ namespace GameLauncher.Engines.Rgss
// 3. バックアップからの data.dts 復元 // 3. バックアップからの data.dts 復元
progress?.Report("バックアップから元の data.dts を復元中..."); progress?.Report("バックアップから元の data.dts を復元中...");
var revertRes = await _archiveService.RevertBackupAsync(gameDir); var (Success, Message) = await this._archiveService.RevertBackupAsync(gameDir);
if (revertRes.Success) if (Success)
{ {
logs.Add($"・{revertRes.Message}"); logs.Add($"・{Message}");
} }
else else
{ {
@@ -737,7 +737,7 @@ namespace GameLauncher.Engines.Rgss
} }
// 4. 解凍フォルダの退避 // 4. 解凍フォルダの退避
var restoreExtractedRes = _archiveService.RestoreExtractedState(gameDir); var restoreExtractedRes = this._archiveService.RestoreExtractedState(gameDir);
if (restoreExtractedRes.Success && !restoreExtractedRes.Message.Contains("存在しません")) if (restoreExtractedRes.Success && !restoreExtractedRes.Message.Contains("存在しません"))
{ {
logs.Add($"・{restoreExtractedRes.Message}"); logs.Add($"・{restoreExtractedRes.Message}");
+251 -251
View File
@@ -28,62 +28,62 @@ namespace GameLauncher.Engines.Tkool
public bool SpeedUp public bool SpeedUp
{ {
get => _speedUp; get => this._speedUp;
set { if (_speedUp != value) { _speedUp = value; OnPropertyChanged(); } } set { if (this._speedUp != value) { this._speedUp = value; this.OnPropertyChanged(); } }
} }
public bool AntigravityGameTweaks public bool AntigravityGameTweaks
{ {
get => _antigravityGameTweaks; get => this._antigravityGameTweaks;
set { if (_antigravityGameTweaks != value) { _antigravityGameTweaks = value; OnPropertyChanged(); } } set { if (this._antigravityGameTweaks != value) { this._antigravityGameTweaks = value; this.OnPropertyChanged(); } }
} }
public bool DropItem99 public bool DropItem99
{ {
get => _dropItem99; get => this._dropItem99;
set { if (_dropItem99 != value) { _dropItem99 = value; OnPropertyChanged(); } } set { if (this._dropItem99 != value) { this._dropItem99 = value; this.OnPropertyChanged(); } }
} }
public bool TurnStartFullRecover public bool TurnStartFullRecover
{ {
get => _turnStartFullRecover; get => this._turnStartFullRecover;
set { if (_turnStartFullRecover != value) { _turnStartFullRecover = value; OnPropertyChanged(); } } set { if (this._turnStartFullRecover != value) { this._turnStartFullRecover = value; this.OnPropertyChanged(); } }
} }
public bool TurnStartFullRecoverHp public bool TurnStartFullRecoverHp
{ {
get => _turnStartFullRecoverHp; get => this._turnStartFullRecoverHp;
set { if (_turnStartFullRecoverHp != value) { _turnStartFullRecoverHp = value; OnPropertyChanged(); } } set { if (this._turnStartFullRecoverHp != value) { this._turnStartFullRecoverHp = value; this.OnPropertyChanged(); } }
} }
public bool TurnStartFullRecoverMp public bool TurnStartFullRecoverMp
{ {
get => _turnStartFullRecoverMp; get => this._turnStartFullRecoverMp;
set { if (_turnStartFullRecoverMp != value) { _turnStartFullRecoverMp = value; OnPropertyChanged(); } } set { if (this._turnStartFullRecoverMp != value) { this._turnStartFullRecoverMp = value; this.OnPropertyChanged(); } }
} }
public bool TurnStartFullRecoverTp public bool TurnStartFullRecoverTp
{ {
get => _turnStartFullRecoverTp; get => this._turnStartFullRecoverTp;
set { if (_turnStartFullRecoverTp != value) { _turnStartFullRecoverTp = value; OnPropertyChanged(); } } set { if (this._turnStartFullRecoverTp != value) { this._turnStartFullRecoverTp = value; this.OnPropertyChanged(); } }
} }
public bool MaxGainGold public bool MaxGainGold
{ {
get => _maxGainGold; get => this._maxGainGold;
set { if (_maxGainGold != value) { _maxGainGold = value; OnPropertyChanged(); } } set { if (this._maxGainGold != value) { this._maxGainGold = value; this.OnPropertyChanged(); } }
} }
public bool MaxGainExp public bool MaxGainExp
{ {
get => _maxGainExp; get => this._maxGainExp;
set { if (_maxGainExp != value) { _maxGainExp = value; OnPropertyChanged(); } } set { if (this._maxGainExp != value) { this._maxGainExp = value; this.OnPropertyChanged(); } }
} }
public bool InstantMessage public bool InstantMessage
{ {
get => _instantMessage; get => this._instantMessage;
set { if (_instantMessage != value) { _instantMessage = value; OnPropertyChanged(); } } set { if (this._instantMessage != value) { this._instantMessage = value; this.OnPropertyChanged(); } }
} }
public event System.ComponentModel.PropertyChangedEventHandler? PropertyChanged; public event System.ComponentModel.PropertyChangedEventHandler? PropertyChanged;
@@ -133,22 +133,22 @@ namespace GameLauncher.Engines.Tkool
/// <summary>Enigma Virtual Box でパックされた exe を持つゲームかどうか</summary> /// <summary>Enigma Virtual Box でパックされた exe を持つゲームかどうか</summary>
public override bool IsEvbPacked public override bool IsEvbPacked
{ {
get => _isEvbPacked; get => this._isEvbPacked;
set set
{ {
if (_isEvbPacked != value) if (this._isEvbPacked != value)
{ {
_isEvbPacked = value; this._isEvbPacked = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(IsEvb)); this.OnPropertyChanged(nameof(this.IsEvb));
OnPropertyChanged(nameof(EvbBadgeVisibility)); this.OnPropertyChanged(nameof(this.EvbBadgeVisibility));
OnPropertyChanged(nameof(EvbBadgeText)); this.OnPropertyChanged(nameof(this.EvbBadgeText));
OnPropertyChanged(nameof(EvbNeedsUnpackVisibility)); this.OnPropertyChanged(nameof(this.EvbNeedsUnpackVisibility));
OnPropertyChanged(nameof(EvbNeedsUnpackBadgeText)); this.OnPropertyChanged(nameof(this.EvbNeedsUnpackBadgeText));
OnPropertyChanged(nameof(EvbExtractedVisibility)); this.OnPropertyChanged(nameof(this.EvbExtractedVisibility));
OnPropertyChanged(nameof(EvbExtractedBadgeText)); this.OnPropertyChanged(nameof(this.EvbExtractedBadgeText));
OnPropertyChanged(nameof(EvbDetailStatusText)); this.OnPropertyChanged(nameof(this.EvbDetailStatusText));
OnPropertyChanged(nameof(IsEvbToolMissing)); this.OnPropertyChanged(nameof(this.IsEvbToolMissing));
} }
} }
} }
@@ -156,20 +156,20 @@ namespace GameLauncher.Engines.Tkool
/// <summary>EVB 解凍済み(_evb_extracted に出力済み)かどうか</summary> /// <summary>EVB 解凍済み(_evb_extracted に出力済み)かどうか</summary>
public override bool IsEvbExtracted public override bool IsEvbExtracted
{ {
get => _isEvbExtracted; get => this._isEvbExtracted;
set set
{ {
if (_isEvbExtracted != value) if (this._isEvbExtracted != value)
{ {
_isEvbExtracted = value; this._isEvbExtracted = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(EvbBadgeVisibility)); this.OnPropertyChanged(nameof(this.EvbBadgeVisibility));
OnPropertyChanged(nameof(EvbBadgeText)); this.OnPropertyChanged(nameof(this.EvbBadgeText));
OnPropertyChanged(nameof(EvbNeedsUnpackVisibility)); this.OnPropertyChanged(nameof(this.EvbNeedsUnpackVisibility));
OnPropertyChanged(nameof(EvbNeedsUnpackBadgeText)); this.OnPropertyChanged(nameof(this.EvbNeedsUnpackBadgeText));
OnPropertyChanged(nameof(EvbExtractedVisibility)); this.OnPropertyChanged(nameof(this.EvbExtractedVisibility));
OnPropertyChanged(nameof(EvbExtractedBadgeText)); this.OnPropertyChanged(nameof(this.EvbExtractedBadgeText));
OnPropertyChanged(nameof(EvbDetailStatusText)); this.OnPropertyChanged(nameof(this.EvbDetailStatusText));
} }
} }
} }
@@ -177,76 +177,76 @@ namespace GameLauncher.Engines.Tkool
/// <summary>EVB 解凍先ディレクトリ(ゲームフォルダ内 _evb_extracted)</summary> /// <summary>EVB 解凍先ディレクトリ(ゲームフォルダ内 _evb_extracted)</summary>
public string? EvbExtractedDirPath public string? EvbExtractedDirPath
{ {
get => _evbExtractedDirPath; get => this._evbExtractedDirPath;
set { if (_evbExtractedDirPath != value) { _evbExtractedDirPath = value; OnPropertyChanged(); } } set { if (this._evbExtractedDirPath != value) { this._evbExtractedDirPath = value; this.OnPropertyChanged(); } }
} }
/// <summary>EVB 解凍時に作成した元 exe のバックアップパス(*.glbak)</summary> /// <summary>EVB 解凍時に作成した元 exe のバックアップパス(*.glbak)</summary>
public string? EvbBackupPath public string? EvbBackupPath
{ {
get => _evbBackupPath; get => this._evbBackupPath;
set { if (_evbBackupPath != value) { _evbBackupPath = value; OnPropertyChanged(); } } set { if (this._evbBackupPath != value) { this._evbBackupPath = value; this.OnPropertyChanged(); } }
} }
/// <summary>EVB 解凍後に再判定された本来のエンジン名</summary> /// <summary>EVB 解凍後に再判定された本来のエンジン名</summary>
public string EvbUnderlyingEngine public string EvbUnderlyingEngine
{ {
get => _evbUnderlyingEngine; get => this._evbUnderlyingEngine;
set { if (_evbUnderlyingEngine != value) { _evbUnderlyingEngine = value; OnPropertyChanged(); OnPropertyChanged(nameof(EvbDetailStatusText)); } } set { if (this._evbUnderlyingEngine != value) { this._evbUnderlyingEngine = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.EvbDetailStatusText)); } }
} }
/// <summary>EVB として扱うか(UI バッジ判定用)</summary> /// <summary>EVB として扱うか(UI バッジ判定用)</summary>
public override bool IsEvb => IsEvbPacked; public override bool IsEvb => this.IsEvbPacked;
/// <summary>EVB バッジの可視性(実際にEVBで圧縮され解凍・管理対象のもののみ Visible)</summary> /// <summary>EVB バッジの可視性(実際にEVBで圧縮され解凍・管理対象のもののみ Visible)</summary>
public override Visibility EvbBadgeVisibility => IsEvbPacked ? Visibility.Visible : Visibility.Collapsed; public override Visibility EvbBadgeVisibility => this.IsEvbPacked ? Visibility.Visible : Visibility.Collapsed;
/// <summary> /// <summary>
/// EVB バッジのテキスト。実際に Enigma Virtual Box でパックされているゲームのみ "EVB" を返し、 /// EVB バッジのテキスト。実際に Enigma Virtual Box でパックされているゲームのみ "EVB" を返し、
/// それ以外は空文字を返してバッジを非表示にする。 /// それ以外は空文字を返してバッジを非表示にする。
/// </summary> /// </summary>
public override string EvbBadgeText => IsEvbPacked ? "EVB" : string.Empty; public override string EvbBadgeText => this.IsEvbPacked ? "EVB" : string.Empty;
/// <summary> /// <summary>
/// EVB「要解凍」バッジのテキスト。未解凍のときだけ "要解凍" を返し、それ以外は空文字を返す。 /// EVB「要解凍」バッジのテキスト。未解凍のときだけ "要解凍" を返し、それ以外は空文字を返す。
/// バッジはテキスト駆動(StringNotEmptyToVisibilityConverter)で表示制御されるため、 /// バッジはテキスト駆動(StringNotEmptyToVisibilityConverter)で表示制御されるため、
/// 無関係なゲームで空のバッジが描画されることはない。 /// 無関係なゲームで空のバッジが描画されることはない。
/// </summary> /// </summary>
public override string EvbNeedsUnpackBadgeText => (IsEvbPacked && !IsEvbExtracted) ? "要解凍" : string.Empty; public override string EvbNeedsUnpackBadgeText => (this.IsEvbPacked && !this.IsEvbExtracted) ? "要解凍" : string.Empty;
/// <summary>EVB 未解凍のときだけ「要解凍」を強調表示するための可視性(一目で分かる導線)</summary> /// <summary>EVB 未解凍のときだけ「要解凍」を強調表示するための可視性(一目で分かる導線)</summary>
public override Visibility EvbNeedsUnpackVisibility => (IsEvbPacked && !IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed; public override Visibility EvbNeedsUnpackVisibility => (this.IsEvbPacked && !this.IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed;
/// <summary>EVB 解凍済みのときだけ「解凍済み」ラベルを表示するための可視性(一目で分かる導線)</summary> /// <summary>EVB 解凍済みのときだけ「解凍済み」ラベルを表示するための可視性(一目で分かる導線)</summary>
public override Visibility EvbExtractedVisibility => (IsEvbPacked && IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed; public override Visibility EvbExtractedVisibility => (this.IsEvbPacked && this.IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed;
/// <summary> /// <summary>
/// EVB「解凍済み」ラベルのテキスト。EVB パック済みかつ解凍済みのときだけ "解凍済み" を返し、 /// EVB「解凍済み」ラベルのテキスト。EVB パック済みかつ解凍済みのときだけ "解凍済み" を返し、
/// それ以外は空文字を返して非表示にする。 /// それ以外は空文字を返して非表示にする。
/// </summary> /// </summary>
public override string EvbExtractedBadgeText => (IsEvbPacked && IsEvbExtracted) ? "解凍済み" : string.Empty; public override string EvbExtractedBadgeText => (this.IsEvbPacked && this.IsEvbExtracted) ? "解凍済み" : string.Empty;
/// <summary> /// <summary>
/// Evb 解凍ツール(evbunpack.exe)が未配置かどうか。 /// Evb 解凍ツール(evbunpack.exe)が未配置かどうか。
/// 選択時のガイドで「README.md を参照してください」と案内するために使用します。 /// 選択時のガイドで「README.md を参照してください」と案内するために使用します。
/// </summary> /// </summary>
public bool IsEvbToolMissing => IsEvbPacked && !Engines.Evb.EvbUnpackerToolProvider.IsAvailable(); public bool IsEvbToolMissing => this.IsEvbPacked && !Engines.Evb.EvbUnpackerToolProvider.IsAvailable();
/// <summary>EVB 詳細状態テキスト</summary> /// <summary>EVB 詳細状態テキスト</summary>
public override string EvbDetailStatusText public override string EvbDetailStatusText
{ {
get get
{ {
if (!IsEvbPacked) if (!this.IsEvbPacked)
{ {
return string.Empty; return string.Empty;
} }
var engine = string.IsNullOrWhiteSpace(EvbUnderlyingEngine) ? "未判定" : EvbUnderlyingEngine; var engine = string.IsNullOrWhiteSpace(this.EvbUnderlyingEngine) ? "未判定" : this.EvbUnderlyingEngine;
if (IsEvbToolMissing) if (this.IsEvbToolMissing)
{ {
return "evbunpack.exe が未配置です。Engines/Evb/Tools/evbunpack/README.md を参照してください。"; return "evbunpack.exe が未配置です。Engines/Evb/Tools/evbunpack/README.md を参照してください。";
} }
return IsEvbExtracted return this.IsEvbExtracted
? $"Enigma Virtual Box パック済み(解凍済み / 本来: {engine})" ? $"Enigma Virtual Box パック済み(解凍済み / 本来: {engine})"
: $"Enigma Virtual Box パック済み(未解凍 / 本来: {engine})"; : $"Enigma Virtual Box パック済み(未解凍 / 本来: {engine})";
} }
@@ -259,15 +259,15 @@ namespace GameLauncher.Engines.Tkool
/// </summary> /// </summary>
public string ResolveLaunchExecutable() public string ResolveLaunchExecutable()
{ {
if (!IsEvbPacked || !IsEvbExtracted) if (!this.IsEvbPacked || !this.IsEvbExtracted)
{ {
return ExecutablePath; return this.ExecutablePath;
} }
// 解凍先フォルダを決定する(保存済みパスが無ければゲームフォルダ配下から解決)。 // 解凍先フォルダを決定する(保存済みパスが無ければゲームフォルダ配下から解決)。
var outputDir = !string.IsNullOrEmpty(EvbExtractedDirPath) var outputDir = !string.IsNullOrEmpty(this.EvbExtractedDirPath)
? EvbExtractedDirPath! ? this.EvbExtractedDirPath!
: GameLauncher.Engines.Evb.EvbUnpackService.GetExtractedDir(RootDirectory); : GameLauncher.Engines.Evb.EvbUnpackService.GetExtractedDir(this.RootDirectory);
// ExecutablePath が空の場合でも、解凍完了マーカーを確認したうえで // ExecutablePath が空の場合でも、解凍完了マーカーを確認したうえで
// 解凍後の exe を起動対象として復元する(再スキャン直後の起動失敗対策)。 // 解凍後の exe を起動対象として復元する(再スキャン直後の起動失敗対策)。
@@ -277,27 +277,27 @@ namespace GameLauncher.Engines.Tkool
return exe!; return exe!;
} }
return ExecutablePath; return this.ExecutablePath;
} }
/// <summary>FOSSIL形態(FOSSILindex.html + 単体Game.exe、data/System.json はディスク上)かどうか</summary> /// <summary>FOSSIL形態(FOSSILindex.html + 単体Game.exe、data/System.json はディスク上)かどうか</summary>
public bool IsFossilSingleExe public bool IsFossilSingleExe
{ {
get => _isFossilSingleExe; get => this._isFossilSingleExe;
set { if (_isFossilSingleExe != value) { _isFossilSingleExe = value; OnPropertyChanged(); } } set { if (this._isFossilSingleExe != value) { this._isFossilSingleExe = value; this.OnPropertyChanged(); } }
} }
/// <summary>boxed形態(ゲーム本体をexeへ内包、例: Game_boxed.exe)かどうか</summary> /// <summary>boxed形態(ゲーム本体をexeへ内包、例: Game_boxed.exe)かどうか</summary>
public bool IsBoxedExe public bool IsBoxedExe
{ {
get => _isBoxedExe; get => this._isBoxedExe;
set { if (_isBoxedExe != value) { _isBoxedExe = value; OnPropertyChanged(); } } set { if (this._isBoxedExe != value) { this._isBoxedExe = value; this.OnPropertyChanged(); } }
} }
/// <summary>いずれかの単体exe梱包形態(FOSSIL / boxed)かどうか</summary> /// <summary>いずれかの単体exe梱包形態(FOSSIL / boxed)かどうか</summary>
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.Tyrano => GameEngineKind.Tyrano,
TkoolEngineType.Wolf => GameEngineKind.Wolf, TkoolEngineType.Wolf => GameEngineKind.Wolf,
@@ -309,31 +309,31 @@ namespace GameLauncher.Engines.Tkool
public string PluginsJsPath public string PluginsJsPath
{ {
get => _pluginsJsPath; get => this._pluginsJsPath;
set { if (_pluginsJsPath != value) { _pluginsJsPath = value; OnPropertyChanged(); } } set { if (this._pluginsJsPath != value) { this._pluginsJsPath = value; this.OnPropertyChanged(); } }
} }
public string PluginsDirPath public string PluginsDirPath
{ {
get => _pluginsDirPath; get => this._pluginsDirPath;
set { if (_pluginsDirPath != value) { _pluginsDirPath = value; OnPropertyChanged(); } } set { if (this._pluginsDirPath != value) { this._pluginsDirPath = value; this.OnPropertyChanged(); } }
} }
public override bool IsMV => EngineType == TkoolEngineType.MV; public override bool IsMV => this.EngineType == TkoolEngineType.MV;
public override bool IsMZ => EngineType == TkoolEngineType.MZ; public override bool IsMZ => this.EngineType == TkoolEngineType.MZ;
public override bool IsTyrano => EngineType == TkoolEngineType.Tyrano; public override bool IsTyrano => this.EngineType == TkoolEngineType.Tyrano;
public override bool IsVX => EngineType == TkoolEngineType.VX; public override bool IsVX => this.EngineType == TkoolEngineType.VX;
public override bool IsVXAce => EngineType == TkoolEngineType.VXAce; public override bool IsVXAce => this.EngineType == TkoolEngineType.VXAce;
public override bool IsWolf => EngineType == TkoolEngineType.Wolf; public override bool IsWolf => this.EngineType == TkoolEngineType.Wolf;
public override bool IsSrpgStudio => EngineType == TkoolEngineType.SrpgStudio; public override bool IsSrpgStudio => this.EngineType == TkoolEngineType.SrpgStudio;
public override bool IsRgss => EngineType is TkoolEngineType.VX or TkoolEngineType.VXAce; public override bool IsRgss => this.EngineType is TkoolEngineType.VX or TkoolEngineType.VXAce;
public override bool IsNwjs => EngineType == TkoolEngineType.Nwjs; public override bool IsNwjs => this.EngineType == TkoolEngineType.Nwjs;
public override bool IsOther => EngineType == TkoolEngineType.Other; public override bool IsOther => this.EngineType == TkoolEngineType.Other;
/// <summary> /// <summary>
/// エンジン種別ラベルの表示文字列。該当エンジンが無い場合は空文字を返し、ラベル自体を非表示にします。 /// エンジン種別ラベルの表示文字列。該当エンジンが無い場合は空文字を返し、ラベル自体を非表示にします。
/// </summary> /// </summary>
public override string EngineLabelText => EngineType switch public override string EngineLabelText => this.EngineType switch
{ {
TkoolEngineType.MV => "MV", TkoolEngineType.MV => "MV",
TkoolEngineType.MZ => "MZ", TkoolEngineType.MZ => "MZ",
@@ -346,7 +346,7 @@ namespace GameLauncher.Engines.Tkool
}; };
/// <summary>エンジン種別ラベルの背景色</summary> /// <summary>エンジン種別ラベルの背景色</summary>
public override Brush EngineLabelBackground => EngineType switch public override Brush EngineLabelBackground => this.EngineType switch
{ {
TkoolEngineType.MV => new SolidColorBrush(Color.FromRgb(0x8B, 0x1E, 0x3F)), TkoolEngineType.MV => new SolidColorBrush(Color.FromRgb(0x8B, 0x1E, 0x3F)),
TkoolEngineType.MZ => new SolidColorBrush(Color.FromRgb(0x1E, 0x5F, 0x8B)), TkoolEngineType.MZ => new SolidColorBrush(Color.FromRgb(0x1E, 0x5F, 0x8B)),
@@ -360,15 +360,15 @@ namespace GameLauncher.Engines.Tkool
/// <summary>NW.jsバッジのテキスト</summary> /// <summary>NW.jsバッジのテキスト</summary>
public override string NwjsBadgeText => public override string NwjsBadgeText =>
EngineType == TkoolEngineType.Nwjs ? "NW.js" : string.Empty; this.EngineType == TkoolEngineType.Nwjs ? "NW.js" : string.Empty;
/// <summary>NW.jsバッジの可視性</summary> /// <summary>NW.jsバッジの可視性</summary>
public override Visibility NwjsBadgeVisibility => public override Visibility NwjsBadgeVisibility =>
EngineType == TkoolEngineType.Nwjs ? Visibility.Visible : Visibility.Collapsed; this.EngineType == TkoolEngineType.Nwjs ? Visibility.Visible : Visibility.Collapsed;
/// <summary>その他バッジの可視性</summary> /// <summary>その他バッジの可視性</summary>
public override Visibility OtherBadgeVisibility => public override Visibility OtherBadgeVisibility =>
EngineType == TkoolEngineType.Other ? Visibility.Visible : Visibility.Collapsed; this.EngineType == TkoolEngineType.Other ? Visibility.Visible : Visibility.Collapsed;
/// <summary> /// <summary>
/// 「プリンセスシナジー」(ツクールMZ製・専用改造対象ゲーム)かどうか。 /// 「プリンセスシナジー」(ツクールMZ製・専用改造対象ゲーム)かどうか。
@@ -376,7 +376,7 @@ namespace GameLauncher.Engines.Tkool
/// これにより当該機能が他ゲームに表示・適用されるのを防ぎます。 /// これにより当該機能が他ゲームに表示・適用されるのを防ぎます。
/// </summary> /// </summary>
public override bool IsPrincessSynergy => public override bool IsPrincessSynergy =>
!string.IsNullOrEmpty(Title) && Title.Contains("プリンセスシナジー"); !string.IsNullOrEmpty(this.Title) && this.Title.Contains("プリンセスシナジー");
// SRPG Studio アーカイブ関連プロパティ // SRPG Studio アーカイブ関連プロパティ
private bool _hasSrpgArchive; private bool _hasSrpgArchive;
@@ -385,56 +385,56 @@ namespace GameLauncher.Engines.Tkool
public override bool HasSrpgArchive public override bool HasSrpgArchive
{ {
get => _hasSrpgArchive; get => this._hasSrpgArchive;
set set
{ {
if (_hasSrpgArchive != value) if (this._hasSrpgArchive != value)
{ {
_hasSrpgArchive = value; this._hasSrpgArchive = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(SrpgBadgeVisibility)); this.OnPropertyChanged(nameof(this.SrpgBadgeVisibility));
OnPropertyChanged(nameof(SrpgBadgeText)); this.OnPropertyChanged(nameof(this.SrpgBadgeText));
OnPropertyChanged(nameof(SrpgBadgeBackground)); this.OnPropertyChanged(nameof(this.SrpgBadgeBackground));
OnPropertyChanged(nameof(SrpgDetailStatusText)); this.OnPropertyChanged(nameof(this.SrpgDetailStatusText));
} }
} }
} }
public override bool IsSrpgExtracted public override bool IsSrpgExtracted
{ {
get => _isSrpgExtracted; get => this._isSrpgExtracted;
set set
{ {
if (_isSrpgExtracted != value) if (this._isSrpgExtracted != value)
{ {
_isSrpgExtracted = value; this._isSrpgExtracted = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(SrpgBadgeText)); this.OnPropertyChanged(nameof(this.SrpgBadgeText));
OnPropertyChanged(nameof(SrpgBadgeBackground)); this.OnPropertyChanged(nameof(this.SrpgBadgeBackground));
OnPropertyChanged(nameof(SrpgDetailStatusText)); this.OnPropertyChanged(nameof(this.SrpgDetailStatusText));
} }
} }
} }
public string? SrpgArchivePath public string? SrpgArchivePath
{ {
get => _srpgArchivePath; get => this._srpgArchivePath;
set { if (_srpgArchivePath != value) { _srpgArchivePath = value; OnPropertyChanged(); } } 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 ? Brushes.Transparent
: (IsSrpgExtracted : (this.IsSrpgExtracted
? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B)) ? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B))
: new SolidColorBrush(Color.FromRgb(0x09, 0x84, 0xE3))); : new SolidColorBrush(Color.FromRgb(0x09, 0x84, 0xE3)));
public override string SrpgDetailStatusText => !(IsSrpgStudio && HasSrpgArchive) public override string SrpgDetailStatusText => !(this.IsSrpgStudio && this.HasSrpgArchive)
? string.Empty ? string.Empty
: (IsSrpgExtracted ? "📦 SRPGアーカイブ(スクリプト/リソース抽出済み・改造可能)" : "🔒 SRPG暗号化アーカイブ(ボタンで抽出・改造・再構築可能)"); : (this.IsSrpgExtracted ? "📦 SRPGアーカイブ(スクリプト/リソース抽出済み・改造可能)" : "🔒 SRPG暗号化アーカイブ(ボタンで抽出・改造・再構築可能)");
// RGSS (VX / VX Ace) アーカイブ関連プロパティ // RGSS (VX / VX Ace) アーカイブ関連プロパティ
private bool _hasRgssArchive; private bool _hasRgssArchive;
@@ -443,95 +443,95 @@ namespace GameLauncher.Engines.Tkool
public override bool HasRgssArchive public override bool HasRgssArchive
{ {
get => _hasRgssArchive; get => this._hasRgssArchive;
set set
{ {
if (_hasRgssArchive != value) if (this._hasRgssArchive != value)
{ {
_hasRgssArchive = value; this._hasRgssArchive = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(RgssBadgeVisibility)); this.OnPropertyChanged(nameof(this.RgssBadgeVisibility));
OnPropertyChanged(nameof(RgssBadgeText)); this.OnPropertyChanged(nameof(this.RgssBadgeText));
OnPropertyChanged(nameof(RgssBadgeBackground)); this.OnPropertyChanged(nameof(this.RgssBadgeBackground));
OnPropertyChanged(nameof(RgssDetailStatusText)); this.OnPropertyChanged(nameof(this.RgssDetailStatusText));
} }
} }
} }
public override bool IsRgssExtracted public override bool IsRgssExtracted
{ {
get => _isRgssExtracted; get => this._isRgssExtracted;
set set
{ {
if (_isRgssExtracted != value) if (this._isRgssExtracted != value)
{ {
_isRgssExtracted = value; this._isRgssExtracted = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(RgssBadgeText)); this.OnPropertyChanged(nameof(this.RgssBadgeText));
OnPropertyChanged(nameof(RgssBadgeBackground)); this.OnPropertyChanged(nameof(this.RgssBadgeBackground));
OnPropertyChanged(nameof(RgssDetailStatusText)); this.OnPropertyChanged(nameof(this.RgssDetailStatusText));
} }
} }
} }
public string? RgssArchivePath public string? RgssArchivePath
{ {
get => _rgssArchivePath; get => this._rgssArchivePath;
set { if (_rgssArchivePath != value) { _rgssArchivePath = value; OnPropertyChanged(); } } 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 ? Brushes.Transparent
: (IsRgssExtracted : (this.IsRgssExtracted
? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B)) ? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B))
: new SolidColorBrush(Color.FromRgb(0xD3, 0x54, 0x00))); : new SolidColorBrush(Color.FromRgb(0xD3, 0x54, 0x00)));
public override string RgssDetailStatusText => !(IsRgss && HasRgssArchive) public override string RgssDetailStatusText => !(this.IsRgss && this.HasRgssArchive)
? string.Empty ? string.Empty
: (IsRgssExtracted ? "📦 RGSSアーカイブ(スクリプト抽出済み・改造可能)" : "🔒 RGSS暗号化アーカイブ(起動時またはボタンでスクリプト抽出可能)"); : (this.IsRgssExtracted ? "📦 RGSSアーカイブ(スクリプト抽出済み・改造可能)" : "🔒 RGSS暗号化アーカイブ(起動時またはボタンでスクリプト抽出可能)");
public TkoolEngineType EngineType public TkoolEngineType EngineType
{ {
get => _engineType; get => this._engineType;
set set
{ {
if (_engineType != value) if (this._engineType != value)
{ {
_engineType = value; this._engineType = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(EngineKind)); this.OnPropertyChanged(nameof(this.EngineKind));
OnPropertyChanged(nameof(EngineDisplayName)); this.OnPropertyChanged(nameof(this.EngineDisplayName));
OnPropertyChanged(nameof(EngineLabelText)); this.OnPropertyChanged(nameof(this.EngineLabelText));
OnPropertyChanged(nameof(EngineLabelBackground)); this.OnPropertyChanged(nameof(this.EngineLabelBackground));
OnPropertyChanged(nameof(IsMV)); this.OnPropertyChanged(nameof(this.IsMV));
OnPropertyChanged(nameof(IsMZ)); this.OnPropertyChanged(nameof(this.IsMZ));
OnPropertyChanged(nameof(IsTyrano)); this.OnPropertyChanged(nameof(this.IsTyrano));
OnPropertyChanged(nameof(IsVX)); this.OnPropertyChanged(nameof(this.IsVX));
OnPropertyChanged(nameof(IsVXAce)); this.OnPropertyChanged(nameof(this.IsVXAce));
OnPropertyChanged(nameof(IsWolf)); this.OnPropertyChanged(nameof(this.IsWolf));
OnPropertyChanged(nameof(IsSrpgStudio)); this.OnPropertyChanged(nameof(this.IsSrpgStudio));
OnPropertyChanged(nameof(IsRgss)); this.OnPropertyChanged(nameof(this.IsRgss));
OnPropertyChanged(nameof(IsNwjs)); this.OnPropertyChanged(nameof(this.IsNwjs));
OnPropertyChanged(nameof(IsOther)); this.OnPropertyChanged(nameof(this.IsOther));
OnPropertyChanged(nameof(NwjsBadgeText)); this.OnPropertyChanged(nameof(this.NwjsBadgeText));
OnPropertyChanged(nameof(NwjsBadgeVisibility)); this.OnPropertyChanged(nameof(this.NwjsBadgeVisibility));
OnPropertyChanged(nameof(OtherBadgeVisibility)); this.OnPropertyChanged(nameof(this.OtherBadgeVisibility));
OnPropertyChanged(nameof(WolfArchiveBadgeVisibility)); this.OnPropertyChanged(nameof(this.WolfArchiveBadgeVisibility));
OnPropertyChanged(nameof(WolfArchiveBadgeText)); this.OnPropertyChanged(nameof(this.WolfArchiveBadgeText));
OnPropertyChanged(nameof(WolfArchiveBadgeBackground)); this.OnPropertyChanged(nameof(this.WolfArchiveBadgeBackground));
OnPropertyChanged(nameof(WolfArchiveDetailStatusText)); this.OnPropertyChanged(nameof(this.WolfArchiveDetailStatusText));
OnPropertyChanged(nameof(SrpgBadgeVisibility)); this.OnPropertyChanged(nameof(this.SrpgBadgeVisibility));
OnPropertyChanged(nameof(SrpgBadgeText)); this.OnPropertyChanged(nameof(this.SrpgBadgeText));
OnPropertyChanged(nameof(SrpgBadgeBackground)); this.OnPropertyChanged(nameof(this.SrpgBadgeBackground));
OnPropertyChanged(nameof(SrpgDetailStatusText)); this.OnPropertyChanged(nameof(this.SrpgDetailStatusText));
OnPropertyChanged(nameof(RgssBadgeVisibility)); this.OnPropertyChanged(nameof(this.RgssBadgeVisibility));
OnPropertyChanged(nameof(RgssBadgeText)); this.OnPropertyChanged(nameof(this.RgssBadgeText));
OnPropertyChanged(nameof(RgssBadgeBackground)); this.OnPropertyChanged(nameof(this.RgssBadgeBackground));
OnPropertyChanged(nameof(RgssDetailStatusText)); this.OnPropertyChanged(nameof(this.RgssDetailStatusText));
} }
} }
} }
@@ -545,31 +545,31 @@ namespace GameLauncher.Engines.Tkool
/// <summary>プロキシDLL(version.dll 倍速/メモリフック)を適用するか</summary> /// <summary>プロキシDLL(version.dll 倍速/メモリフック)を適用するか</summary>
public override bool WolfProxyDll public override bool WolfProxyDll
{ {
get => _wolfProxyDll; get => this._wolfProxyDll;
set { if (_wolfProxyDll != value) { _wolfProxyDll = value; OnPropertyChanged(); } } set { if (this._wolfProxyDll != value) { this._wolfProxyDll = value; this.OnPropertyChanged(); } }
} }
/// <summary>プロキシDLLのスピード倍率</summary> /// <summary>プロキシDLLのスピード倍率</summary>
public double WolfSpeedMultiplier public double WolfSpeedMultiplier
{ {
get => _wolfSpeedMultiplier; get => this._wolfSpeedMultiplier;
set { if (_wolfSpeedMultiplier != value) { _wolfSpeedMultiplier = value; OnPropertyChanged(); } } set { if (this._wolfSpeedMultiplier != value) { this._wolfSpeedMultiplier = value; this.OnPropertyChanged(); } }
} }
/// <summary>Data.wolf アーカイブが存在するか</summary> /// <summary>Data.wolf アーカイブが存在するか</summary>
public override bool HasWolfArchive public override bool HasWolfArchive
{ {
get => _hasWolfArchive; get => this._hasWolfArchive;
set set
{ {
if (_hasWolfArchive != value) if (this._hasWolfArchive != value)
{ {
_hasWolfArchive = value; this._hasWolfArchive = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(WolfArchiveBadgeVisibility)); this.OnPropertyChanged(nameof(this.WolfArchiveBadgeVisibility));
OnPropertyChanged(nameof(WolfArchiveBadgeText)); this.OnPropertyChanged(nameof(this.WolfArchiveBadgeText));
OnPropertyChanged(nameof(WolfArchiveBadgeBackground)); this.OnPropertyChanged(nameof(this.WolfArchiveBadgeBackground));
OnPropertyChanged(nameof(WolfArchiveDetailStatusText)); this.OnPropertyChanged(nameof(this.WolfArchiveDetailStatusText));
} }
} }
} }
@@ -577,31 +577,31 @@ namespace GameLauncher.Engines.Tkool
/// <summary>Data.wolf が解凍済み(Dataフォルダが存在)か</summary> /// <summary>Data.wolf が解凍済み(Dataフォルダが存在)か</summary>
public override bool IsWolfExtracted public override bool IsWolfExtracted
{ {
get => _isWolfExtracted; get => this._isWolfExtracted;
set set
{ {
if (_isWolfExtracted != value) if (this._isWolfExtracted != value)
{ {
_isWolfExtracted = value; this._isWolfExtracted = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(WolfArchiveBadgeVisibility)); this.OnPropertyChanged(nameof(this.WolfArchiveBadgeVisibility));
OnPropertyChanged(nameof(WolfArchiveBadgeText)); this.OnPropertyChanged(nameof(this.WolfArchiveBadgeText));
OnPropertyChanged(nameof(WolfArchiveBadgeBackground)); this.OnPropertyChanged(nameof(this.WolfArchiveBadgeBackground));
OnPropertyChanged(nameof(WolfArchiveDetailStatusText)); this.OnPropertyChanged(nameof(this.WolfArchiveDetailStatusText));
} }
} }
} }
public override Visibility WolfArchiveBadgeVisibility => (IsWolf && HasWolfArchive) ? Visibility.Visible : Visibility.Collapsed; public override Visibility WolfArchiveBadgeVisibility => (this.IsWolf && this.HasWolfArchive) ? Visibility.Visible : Visibility.Collapsed;
public override string WolfArchiveBadgeText => !(IsWolf && HasWolfArchive) ? string.Empty : (IsWolfExtracted ? "Data解凍済" : "Data.wolf保護"); public override string WolfArchiveBadgeText => !(this.IsWolf && this.HasWolfArchive) ? string.Empty : (this.IsWolfExtracted ? "Data解凍済" : "Data.wolf保護");
public override Brush WolfArchiveBadgeBackground => !(IsWolf && HasWolfArchive) public override Brush WolfArchiveBadgeBackground => !(this.IsWolf && this.HasWolfArchive)
? Brushes.Transparent ? Brushes.Transparent
: (IsWolfExtracted : (this.IsWolfExtracted
? new SolidColorBrush(Color.FromRgb(0x00, 0xB8, 0x94)) ? new SolidColorBrush(Color.FromRgb(0x00, 0xB8, 0x94))
: new SolidColorBrush(Color.FromRgb(0x63, 0x6E, 0x72))); : new SolidColorBrush(Color.FromRgb(0x63, 0x6E, 0x72)));
public override string WolfArchiveDetailStatusText => !(IsWolf && HasWolfArchive) public override string WolfArchiveDetailStatusText => !(this.IsWolf && this.HasWolfArchive)
? string.Empty ? string.Empty
: (IsWolfExtracted : (this.IsWolfExtracted
? "Data フォルダに解凍・抽出済みです。ウディタは Data フォルダのマップ・イベント・データベース等を優先して読み込みます。直接ファイルを改造できます。" ? "Data フォルダに解凍・抽出済みです。ウディタは Data フォルダのマップ・イベント・データベース等を優先して読み込みます。直接ファイルを改造できます。"
: "Data.wolf アーカイブで暗号化・保護されています。下の「Data.wolf を解凍」を実行すると、全データを展開して直接編集・改造可能になります。"); : "Data.wolf アーカイブで暗号化・保護されています。下の「Data.wolf を解凍」を実行すると、全データを展開して直接編集・改造可能になります。");
@@ -612,124 +612,124 @@ namespace GameLauncher.Engines.Tkool
/// <summary>SRPG Studio プロキシDLL(version.dll 倍速機能)を適用するか</summary> /// <summary>SRPG Studio プロキシDLL(version.dll 倍速機能)を適用するか</summary>
public override bool SrpgProxyDll public override bool SrpgProxyDll
{ {
get => _srpgProxyDll; get => this._srpgProxyDll;
set { if (_srpgProxyDll != value) { _srpgProxyDll = value; OnPropertyChanged(); } } set { if (this._srpgProxyDll != value) { this._srpgProxyDll = value; this.OnPropertyChanged(); } }
} }
/// <summary>SRPG Studio プロキシDLLのスピード倍率</summary> /// <summary>SRPG Studio プロキシDLLのスピード倍率</summary>
public double SrpgSpeedMultiplier public double SrpgSpeedMultiplier
{ {
get => _srpgSpeedMultiplier; get => this._srpgSpeedMultiplier;
set { if (_srpgSpeedMultiplier != value) { _srpgSpeedMultiplier = value; OnPropertyChanged(); } } set { if (this._srpgSpeedMultiplier != value) { this._srpgSpeedMultiplier = value; this.OnPropertyChanged(); } }
} }
/// <summary>SRPG Studio プラグイン改造オプション(PluginOptionsのエイリアス)</summary> /// <summary>SRPG Studio プラグイン改造オプション(PluginOptionsのエイリアス)</summary>
public ObservableCollection<ModPluginOptionItem> SrpgModOptions => PluginOptions; public ObservableCollection<ModPluginOptionItem> SrpgModOptions => this.PluginOptions;
public override bool IsModded public override bool IsModded
{ {
get => _isModded; get => this._isModded;
set { if (_isModded != value) { _isModded = value; OnPropertyChanged(); } } set { if (this._isModded != value) { this._isModded = value; this.OnPropertyChanged(); } }
} }
public bool HasCustomApplyMod public bool HasCustomApplyMod
{ {
get => _hasCustomApplyMod; get => this._hasCustomApplyMod;
set { if (_hasCustomApplyMod != value) { _hasCustomApplyMod = value; OnPropertyChanged(); } } set { if (this._hasCustomApplyMod != value) { this._hasCustomApplyMod = value; this.OnPropertyChanged(); } }
} }
public override bool ApplyMod public override bool ApplyMod
{ {
get => _applyMod; get => this._applyMod;
set set
{ {
if (_applyMod != value) if (this._applyMod != value)
{ {
_applyMod = value; this._applyMod = value;
if (!_isInitializingApplyMod) if (!this._isInitializingApplyMod)
{ {
HasCustomApplyMod = true; this.HasCustomApplyMod = true;
} }
OnPropertyChanged(); this.OnPropertyChanged();
} }
} }
} }
public void SetDefaultApplyMod(bool defaultVal) public void SetDefaultApplyMod(bool defaultVal)
{ {
if (!_hasCustomApplyMod) if (!this._hasCustomApplyMod)
{ {
_isInitializingApplyMod = true; this._isInitializingApplyMod = true;
_applyMod = defaultVal; this._applyMod = defaultVal;
_isInitializingApplyMod = false; this._isInitializingApplyMod = false;
OnPropertyChanged(nameof(ApplyMod)); this.OnPropertyChanged(nameof(this.ApplyMod));
} }
} }
public override bool IsAsar public override bool IsAsar
{ {
get => _isAsar; get => this._isAsar;
set set
{ {
if (_isAsar != value) if (this._isAsar != value)
{ {
_isAsar = value; this._isAsar = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(AsarBadgeVisibility)); this.OnPropertyChanged(nameof(this.AsarBadgeVisibility));
OnPropertyChanged(nameof(AsarBadgeText)); this.OnPropertyChanged(nameof(this.AsarBadgeText));
OnPropertyChanged(nameof(AsarBadgeBackground)); this.OnPropertyChanged(nameof(this.AsarBadgeBackground));
OnPropertyChanged(nameof(AsarDetailStatusText)); this.OnPropertyChanged(nameof(this.AsarDetailStatusText));
} }
} }
} }
public override bool IsAsarExtracted public override bool IsAsarExtracted
{ {
get => _isAsarExtracted; get => this._isAsarExtracted;
set set
{ {
if (_isAsarExtracted != value) if (this._isAsarExtracted != value)
{ {
_isAsarExtracted = value; this._isAsarExtracted = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(AsarBadgeText)); this.OnPropertyChanged(nameof(this.AsarBadgeText));
OnPropertyChanged(nameof(AsarBadgeBackground)); this.OnPropertyChanged(nameof(this.AsarBadgeBackground));
OnPropertyChanged(nameof(AsarDetailStatusText)); this.OnPropertyChanged(nameof(this.AsarDetailStatusText));
} }
} }
} }
public string? AsarPath public string? AsarPath
{ {
get => _asarPath; get => this._asarPath;
set { if (_asarPath != value) { _asarPath = value; OnPropertyChanged(); } } set { if (this._asarPath != value) { this._asarPath = value; this.OnPropertyChanged(); } }
} }
public string? AsarExtractedDirPath public string? AsarExtractedDirPath
{ {
get => _asarExtractedDirPath; get => this._asarExtractedDirPath;
set { if (_asarExtractedDirPath != value) { _asarExtractedDirPath = value; OnPropertyChanged(); } } set { if (this._asarExtractedDirPath != value) { this._asarExtractedDirPath = value; this.OnPropertyChanged(); } }
} }
public string? RelativePluginsJsInAsar public string? RelativePluginsJsInAsar
{ {
get => _relativePluginsJsInAsar; get => this._relativePluginsJsInAsar;
set { if (_relativePluginsJsInAsar != value) { _relativePluginsJsInAsar = value; OnPropertyChanged(); } } 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 ? Brushes.Transparent
: (IsAsarExtracted : (this.IsAsarExtracted
? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B)) ? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B))
: new SolidColorBrush(Color.FromRgb(0x5E, 0x35, 0xB1))); : new SolidColorBrush(Color.FromRgb(0x5E, 0x35, 0xB1)));
public override string AsarDetailStatusText => !IsAsar public override string AsarDetailStatusText => !this.IsAsar
? string.Empty ? string.Empty
: (IsAsarExtracted ? "📦 app.asar 形式(解凍済み・改造可能)" : "📦 app.asar 形式(圧縮中・起動時またはボタンで解凍可能)"); : (this.IsAsarExtracted ? "📦 app.asar 形式(解凍済み・改造可能)" : "📦 app.asar 形式(圧縮中・起動時またはボタンで解凍可能)");
private Dictionary<string, bool> _pluginSettings = new(StringComparer.OrdinalIgnoreCase); private Dictionary<string, bool> _pluginSettings = new(StringComparer.OrdinalIgnoreCase);
private ObservableCollection<ModPluginOptionItem> _pluginOptions = []; private ObservableCollection<ModPluginOptionItem> _pluginOptions = [];
@@ -810,14 +810,14 @@ namespace GameLauncher.Engines.Tkool
public bool IsPluginEnabled(string pluginId, Dictionary<string, bool>? defaultSettings = null, bool fallbackVal = true) public bool IsPluginEnabled(string pluginId, Dictionary<string, bool>? defaultSettings = null, bool fallbackVal = true)
{ {
if (_pluginSettings.TryGetValue(pluginId, out var val)) if (this._pluginSettings.TryGetValue(pluginId, out var val))
{ {
return val; return val;
} }
if (pluginId is "BattleTurnRecoverHp" or "BattleTurnRecoverMp" or "BattleTurnRecoverTp") 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; return legacyVal;
} }
@@ -969,11 +969,11 @@ namespace GameLauncher.Engines.Tkool
public ModPluginOptions ModOptions public ModPluginOptions ModOptions
{ {
get => _modOptions; get => this._modOptions;
set { if (_modOptions != value) { _modOptions = value; OnPropertyChanged(); } } 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.MV => "RPGツクールMV",
TkoolEngineType.MZ => "RPGツクールMZ", TkoolEngineType.MZ => "RPGツクールMZ",
+3 -3
View File
@@ -159,9 +159,9 @@ namespace GameLauncher.Engines.Tkool
var entry = $"{BeginMarker}{{\"name\":\"{ModPluginId}\",\"status\":true,\"description\":\"GameLauncher mod\",\"parameters\":{{}}}}{EndMarker}"; 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 inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1);
var suffix = content.Substring(arrayEnd); var suffix = content[arrayEnd..];
var trimmedInner = inner.Trim(); var trimmedInner = inner.Trim();
var newInner = string.IsNullOrEmpty(trimmedInner) var newInner = string.IsNullOrEmpty(trimmedInner)
@@ -198,7 +198,7 @@ namespace GameLauncher.Engines.Tkool
while (scan >= 0 && char.IsWhiteSpace(content[scan])) scan--; while (scan >= 0 && char.IsWhiteSpace(content[scan])) scan--;
if (scan >= 0 && content[scan] == ',') cutStart = scan; if (scan >= 0 && content[scan] == ',') cutStart = scan;
content = content.Substring(0, cutStart) + content.Substring(end); content = content[..cutStart] + content[end..];
} }
while (content != prev); while (content != prev);
+16 -18
View File
@@ -41,11 +41,11 @@ namespace GameLauncher.Engines.Tkool
private List<ModPluginDefinition> _availablePlugins = []; private List<ModPluginDefinition> _availablePlugins = [];
/// <summary>現在認識されている利用可能なプラグイン一覧</summary> /// <summary>現在認識されている利用可能なプラグイン一覧</summary>
public IReadOnlyList<ModPluginDefinition> AvailablePlugins => _availablePlugins; public IReadOnlyList<ModPluginDefinition> AvailablePlugins => this._availablePlugins;
public TkoolModService() public TkoolModService()
{ {
LoadAvailablePlugins(); this.LoadAvailablePlugins();
} }
/// <summary> /// <summary>
@@ -105,7 +105,7 @@ namespace GameLauncher.Engines.Tkool
} }
} }
_availablePlugins = list; this._availablePlugins = list;
return list; return list;
} }
@@ -159,11 +159,11 @@ namespace GameLauncher.Engines.Tkool
{ {
if (game.ApplyMod) if (game.ApplyMod)
{ {
return ApplyMod(game, defaultSettings); return this.ApplyMod(game, defaultSettings);
} }
else else
{ {
return RestoreOriginal(game); return this.RestoreOriginal(game);
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -216,18 +216,16 @@ namespace GameLauncher.Engines.Tkool
string baseContent = File.ReadAllText(backupPath, Encoding.UTF8); string baseContent = File.ReadAllText(backupPath, Encoding.UTF8);
// 最新の動的プラグイン一覧を取得 // 最新の動的プラグイン一覧を取得
if (_availablePlugins.Count == 0) if (this._availablePlugins.Count == 0)
{ {
LoadAvailablePlugins(); this.LoadAvailablePlugins();
} }
// 有効化対象のプラグインを取得 // 有効化対象のプラグインを取得
// ※ResourceLoaderFix はリソース読み込み不具合の必須救済プラグインのため、常に有効化・先頭配置 // ※ResourceLoaderFix はリソース読み込み不具合の必須救済プラグインのため、常に有効化・先頭配置
var fixPlugin = _availablePlugins.FirstOrDefault(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase)); var fixPlugin = this._availablePlugins.FirstOrDefault(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase));
var pluginsToEnable = _availablePlugins var pluginsToEnable = this._availablePlugins
.Where(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase) .Where(p => string.Equals(p.Id, "ResourceLoaderFix", StringComparison.OrdinalIgnoreCase) || game.IsPluginEnabled(p.Id, defaultSettings, fallbackVal: true))
? true
: game.IsPluginEnabled(p.Id, defaultSettings, fallbackVal: true))
.ToList(); .ToList();
// ResourceLoaderFix を最優先(先頭)に配置して、他プラグイン実行前のリソース要求も確実に救済 // ResourceLoaderFix を最優先(先頭)に配置して、他プラグイン実行前のリソース要求も確実に救済
@@ -238,7 +236,7 @@ namespace GameLauncher.Engines.Tkool
} }
// 3. ゲーム側の plugins ディレクトリから不要な旧プラグインや無効プラグインを安全に掃除 // 3. ゲーム側の plugins ディレクトリから不要な旧プラグインや無効プラグインを安全に掃除
var allManaged = GetAllManagedPluginNames(_availablePlugins); var allManaged = GetAllManagedPluginNames(this._availablePlugins);
var enabledIds = new HashSet<string>(pluginsToEnable.Select(p => p.Id), StringComparer.OrdinalIgnoreCase); var enabledIds = new HashSet<string>(pluginsToEnable.Select(p => p.Id), StringComparer.OrdinalIgnoreCase);
foreach (var pluginId in allManaged) foreach (var pluginId in allManaged)
@@ -257,7 +255,7 @@ namespace GameLauncher.Engines.Tkool
// 4. 有効対象のプラグインファイルをゲーム側へ配置 // 4. 有効対象のプラグインファイルをゲーム側へ配置
foreach (var plugin in pluginsToEnable) foreach (var plugin in pluginsToEnable)
{ {
CopyPluginToGame(plugin, pluginsDir); this.CopyPluginToGame(plugin, pluginsDir);
} }
// 5. plugins.js をパース・再構築して有効プラグインを追加 // 5. plugins.js をパース・再構築して有効プラグインを追加
@@ -309,7 +307,7 @@ namespace GameLauncher.Engines.Tkool
// 2. ゲーム側の plugins フォルダから新旧すべてのプラグインファイルを安全に削除(ゴミを残さない) // 2. ゲーム側の plugins フォルダから新旧すべてのプラグインファイルを安全に削除(ゴミを残さない)
if (!string.IsNullOrEmpty(pluginsDir) && Directory.Exists(pluginsDir)) if (!string.IsNullOrEmpty(pluginsDir) && Directory.Exists(pluginsDir))
{ {
var allManaged = GetAllManagedPluginNames(_availablePlugins); var allManaged = GetAllManagedPluginNames(this._availablePlugins);
foreach (var pluginName in allManaged) foreach (var pluginName in allManaged)
{ {
var targetFile = Path.Combine(pluginsDir, $"{pluginName}.js"); var targetFile = Path.Combine(pluginsDir, $"{pluginName}.js");
@@ -356,9 +354,9 @@ namespace GameLauncher.Engines.Tkool
return content; return content;
} }
string prefix = content.Substring(0, arrayStart + 1); string prefix = content[..(arrayStart + 1)];
string inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1); string inner = content.Substring(arrayStart + 1, arrayEnd - arrayStart - 1);
string suffix = content.Substring(arrayEnd); string suffix = content[arrayEnd..];
// 新旧すべてのプラグイン名を除去対象とする // 新旧すべてのプラグイン名を除去対象とする
var managedSet = GetAllManagedPluginNames(); var managedSet = GetAllManagedPluginNames();
@@ -412,7 +410,7 @@ namespace GameLauncher.Engines.Tkool
if (depth == 0) 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*""([^""]+)"""); var match = Regex.Match(objText, @"""name""\s*:\s*""([^""]+)""");
if (match.Success && managedSet.Contains(match.Groups[1].Value)) if (match.Success && managedSet.Contains(match.Groups[1].Value))
+2 -2
View File
@@ -297,7 +297,7 @@ namespace GameLauncher.Engines.Tkool
// 拡張子がある場合とない場合(.png を補完)を検討 // 拡張子がある場合とない場合(.png を補完)を検討
var extensionsToCheck = string.IsNullOrEmpty(reqExt) var extensionsToCheck = string.IsNullOrEmpty(reqExt)
? new[] { ".png", ".ogg", ".m4a" } ? new[] { ".png", ".ogg", ".m4a" }
: new[] { reqExt }; : [reqExt];
foreach (var ext in extensionsToCheck) foreach (var ext in extensionsToCheck)
{ {
@@ -513,7 +513,7 @@ namespace GameLauncher.Engines.Tkool
bytes.Add(Convert.ToByte(hexPart.Substring(i + 1, 2), 16)); bytes.Add(Convert.ToByte(hexPart.Substring(i + 1, 2), 16));
} }
} }
return Encoding.UTF8.GetString(bytes.ToArray()); return Encoding.UTF8.GetString([.. bytes]);
} }
catch catch
{ {
+32 -32
View File
@@ -21,22 +21,22 @@ namespace GameLauncher.Engines.Unity
/// <summary>[Game]_Data ディレクトリ絶対パス</summary> /// <summary>[Game]_Data ディレクトリ絶対パス</summary>
public string DataDirectoryPath public string DataDirectoryPath
{ {
get => _dataDirectoryPath; get => this._dataDirectoryPath;
set { if (_dataDirectoryPath != value) { _dataDirectoryPath = value; OnPropertyChanged(); } } set { if (this._dataDirectoryPath != value) { this._dataDirectoryPath = value; this.OnPropertyChanged(); } }
} }
/// <summary>app.info 由来の会社名/開発者名</summary> /// <summary>app.info 由来の会社名/開発者名</summary>
public string CompanyName public string CompanyName
{ {
get => _companyName; get => this._companyName;
set set
{ {
if (_companyName != value) if (this._companyName != value)
{ {
_companyName = value; this._companyName = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(RegistryPath)); this.OnPropertyChanged(nameof(this.RegistryPath));
OnPropertyChanged(nameof(LocalLowPath)); this.OnPropertyChanged(nameof(this.LocalLowPath));
} }
} }
} }
@@ -44,35 +44,35 @@ namespace GameLauncher.Engines.Unity
/// <summary>app.info 由来の製品名</summary> /// <summary>app.info 由来の製品名</summary>
public string ProductName public string ProductName
{ {
get => _productName; get => this._productName;
set set
{ {
if (_productName != value) if (this._productName != value)
{ {
_productName = value; this._productName = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(RegistryPath)); this.OnPropertyChanged(nameof(this.RegistryPath));
OnPropertyChanged(nameof(LocalLowPath)); this.OnPropertyChanged(nameof(this.LocalLowPath));
} }
} }
} }
public override bool IsIL2CPP => BackendType == UnityBackendType.IL2CPP; public override bool IsIL2CPP => this.BackendType == UnityBackendType.IL2CPP;
public override bool IsMono => BackendType == UnityBackendType.Mono; public override bool IsMono => this.BackendType == UnityBackendType.Mono;
/// <summary>バックエンド形式 (IL2CPP / Mono)</summary> /// <summary>バックエンド形式 (IL2CPP / Mono)</summary>
public UnityBackendType BackendType public UnityBackendType BackendType
{ {
get => _backendType; get => this._backendType;
set set
{ {
if (_backendType != value) if (this._backendType != value)
{ {
_backendType = value; this._backendType = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(BackendBadgeText)); this.OnPropertyChanged(nameof(this.BackendBadgeText));
OnPropertyChanged(nameof(IsIL2CPP)); this.OnPropertyChanged(nameof(this.IsIL2CPP));
OnPropertyChanged(nameof(IsMono)); this.OnPropertyChanged(nameof(this.IsMono));
} }
} }
} }
@@ -80,15 +80,15 @@ namespace GameLauncher.Engines.Unity
/// <summary>Unityバージョン文字列</summary> /// <summary>Unityバージョン文字列</summary>
public override string UnityVersion public override string UnityVersion
{ {
get => _unityVersion; get => this._unityVersion;
set { if (_unityVersion != value) { _unityVersion = value; OnPropertyChanged(); } } set { if (this._unityVersion != value) { this._unityVersion = value; this.OnPropertyChanged(); } }
} }
/// <summary>セーブデータ(レジストリまたはファイル)が検出されたかどうか</summary> /// <summary>セーブデータ(レジストリまたはファイル)が検出されたかどうか</summary>
public override bool HasSaveData public override bool HasSaveData
{ {
get => _hasSaveData; get => this._hasSaveData;
set { if (_hasSaveData != value) { _hasSaveData = value; OnPropertyChanged(); } } set { if (this._hasSaveData != value) { this._hasSaveData = value; this.OnPropertyChanged(); } }
} }
/// <summary> /// <summary>
@@ -99,9 +99,9 @@ namespace GameLauncher.Engines.Unity
{ {
get get
{ {
if (string.IsNullOrEmpty(CompanyName) || string.IsNullOrEmpty(ProductName)) if (string.IsNullOrEmpty(this.CompanyName) || string.IsNullOrEmpty(this.ProductName))
return string.Empty; return string.Empty;
return $@"Software\{CompanyName}\{ProductName}"; return $@"Software\{this.CompanyName}\{this.ProductName}";
} }
} }
@@ -113,18 +113,18 @@ namespace GameLauncher.Engines.Unity
{ {
get get
{ {
if (string.IsNullOrEmpty(CompanyName) || string.IsNullOrEmpty(ProductName)) if (string.IsNullOrEmpty(this.CompanyName) || string.IsNullOrEmpty(this.ProductName))
return string.Empty; return string.Empty;
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var appData = Path.GetDirectoryName(localAppData); var appData = Path.GetDirectoryName(localAppData);
if (string.IsNullOrEmpty(appData)) return string.Empty; 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.IL2CPP => "IL2CPP",
UnityBackendType.Mono => "Mono", UnityBackendType.Mono => "Mono",
+37 -37
View File
@@ -28,35 +28,35 @@ namespace GameLauncher.Engines.Unity
/// <summary>レジストリの生キー名(例: ClearedLevel_h1378399435)</summary> /// <summary>レジストリの生キー名(例: ClearedLevel_h1378399435)</summary>
public string RawKey public string RawKey
{ {
get => _rawKey; get => this._rawKey;
set { if (_rawKey != value) { _rawKey = value; OnPropertyChanged(); } } set { if (this._rawKey != value) { this._rawKey = value; this.OnPropertyChanged(); } }
} }
/// <summary>Unityのハッシュを除去した整形式キー名(例: ClearedLevel)</summary> /// <summary>Unityのハッシュを除去した整形式キー名(例: ClearedLevel)</summary>
public string CleanKey public string CleanKey
{ {
get => _cleanKey; get => this._cleanKey;
set { if (_cleanKey != value) { _cleanKey = value; OnPropertyChanged(); } } set { if (this._cleanKey != value) { this._cleanKey = value; this.OnPropertyChanged(); } }
} }
/// <summary>値のデータ型</summary> /// <summary>値のデータ型</summary>
public PlayerPrefsType Type public PlayerPrefsType Type
{ {
get => _type; get => this._type;
set { if (_type != value) { _type = value; OnPropertyChanged(); OnPropertyChanged(nameof(TypeDisplay)); } } set { if (this._type != value) { this._type = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.TypeDisplay)); } }
} }
/// <summary>実際の値(int, float, string, byte[])</summary> /// <summary>実際の値(int, float, string, byte[])</summary>
public object? Value public object? Value
{ {
get => _value; get => this._value;
set set
{ {
if (!Equals(_value, value)) if (!Equals(this._value, value))
{ {
_value = value; this._value = value;
OnPropertyChanged(); this.OnPropertyChanged();
UpdateEditValue(); this.UpdateEditValue();
} }
} }
} }
@@ -64,15 +64,15 @@ namespace GameLauncher.Engines.Unity
/// <summary>UI表示・編集用の文字列値</summary> /// <summary>UI表示・編集用の文字列値</summary>
public string EditValue public string EditValue
{ {
get => _editValue; get => this._editValue;
set set
{ {
if (_editValue != value) if (this._editValue != value)
{ {
_editValue = value; this._editValue = value;
_isModified = true; this._isModified = true;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(IsModified)); this.OnPropertyChanged(nameof(this.IsModified));
} }
} }
} }
@@ -80,11 +80,11 @@ namespace GameLauncher.Engines.Unity
/// <summary>値が変更されたかどうか</summary> /// <summary>値が変更されたかどうか</summary>
public bool IsModified public bool IsModified
{ {
get => _isModified; get => this._isModified;
set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } } 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.Int => "Int (数値)",
PlayerPrefsType.Float => "Float (小数)", PlayerPrefsType.Float => "Float (小数)",
@@ -95,19 +95,19 @@ namespace GameLauncher.Engines.Unity
private void UpdateEditValue() 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 try
{ {
var text = System.Text.Encoding.UTF8.GetString(bytes).TrimEnd('\0'); var text = System.Text.Encoding.UTF8.GetString(bytes).TrimEnd('\0');
if (text.All(c => !char.IsControl(c) || c == '\r' || c == '\n' || c == '\t')) if (text.All(c => !char.IsControl(c) || c == '\r' || c == '\n' || c == '\t'))
{ {
_editValue = text; this._editValue = text;
_type = PlayerPrefsType.String; this._type = PlayerPrefsType.String;
return; return;
} }
} }
@@ -118,21 +118,21 @@ namespace GameLauncher.Engines.Unity
float f = BitConverter.ToSingle(bytes, 0); float f = BitConverter.ToSingle(bytes, 0);
if (!float.IsNaN(f) && !float.IsInfinity(f)) if (!float.IsNaN(f) && !float.IsInfinity(f))
{ {
_editValue = f.ToString("G"); this._editValue = f.ToString("G");
_type = PlayerPrefsType.Float; this._type = PlayerPrefsType.Float;
return; return;
} }
} }
_editValue = BitConverter.ToString(bytes).Replace("-", " "); this._editValue = BitConverter.ToString(bytes).Replace("-", " ");
} }
else else
{ {
_editValue = _value.ToString() ?? string.Empty; this._editValue = this._value.ToString() ?? string.Empty;
} }
_isModified = false; this._isModified = false;
OnPropertyChanged(nameof(EditValue)); this.OnPropertyChanged(nameof(this.EditValue));
OnPropertyChanged(nameof(IsModified)); this.OnPropertyChanged(nameof(this.IsModified));
} }
} }
@@ -152,13 +152,13 @@ namespace GameLauncher.Engines.Unity
{ {
get get
{ {
if (FileSize < 1024) return $"{FileSize} B"; if (this.FileSize < 1024) return $"{this.FileSize} B";
if (FileSize < 1024 * 1024) return $"{FileSize / 1024.0:F1} KB"; if (this.FileSize < 1024 * 1024) return $"{this.FileSize / 1024.0:F1} KB";
return $"{FileSize / (1024.0 * 1024.0):F2} MB"; 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");
} }
/// <summary> /// <summary>
@@ -172,6 +172,6 @@ namespace GameLauncher.Engines.Unity
public string BackupType { get; set; } = string.Empty; // "Registry (.reg)" または "ファイル" public string BackupType { get; set; } = string.Empty; // "Registry (.reg)" または "ファイル"
public string Note { get; set; } = string.Empty; 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");
} }
} }
+9 -9
View File
@@ -81,7 +81,7 @@ namespace GameLauncher.Engines.Unity
catch { } catch { }
// キー名昇順でソート // キー名昇順でソート
return list.OrderBy(e => e.CleanKey, StringComparer.OrdinalIgnoreCase).ToList(); return [.. list.OrderBy(e => e.CleanKey, StringComparer.OrdinalIgnoreCase)];
} }
/// <summary> /// <summary>
@@ -319,7 +319,7 @@ namespace GameLauncher.Engines.Unity
proc?.WaitForExit(3000); proc?.WaitForExit(3000);
// JSONバックアップも併せて出力 // JSONバックアップも併せて出力
var entries = GetPlayerPrefs(registryPath); var entries = this.GetPlayerPrefs(registryPath);
var jsonBackupFile = Path.Combine(backupDir, $"PlayerPrefs_{timestamp}.json"); var jsonBackupFile = Path.Combine(backupDir, $"PlayerPrefs_{timestamp}.json");
var serializableList = entries.Select(e => new var serializableList = entries.Select(e => new
{ {
@@ -416,7 +416,7 @@ namespace GameLauncher.Engines.Unity
FileSize = fi.Length, FileSize = fi.Length,
LastModified = fi.LastWriteTime, LastModified = fi.LastWriteTime,
LocationType = "LocalLow", LocationType = "LocalLow",
IsTextOrJson = CheckIsTextOrJson(f) IsTextOrJson = this.CheckIsTextOrJson(f)
}); });
} }
} }
@@ -429,7 +429,7 @@ namespace GameLauncher.Engines.Unity
try try
{ {
// ルート直下 // ルート直下
CollectCandidateFiles(game.RootDirectory, "ゲームフォルダ", list); this.CollectCandidateFiles(game.RootDirectory, "ゲームフォルダ", list);
// Save / SaveData / saves / savedata サブフォルダ // Save / SaveData / saves / savedata サブフォルダ
var subNames = new[] { "Save", "SaveData", "saves", "savedata", "Save_Data" }; var subNames = new[] { "Save", "SaveData", "saves", "savedata", "Save_Data" };
@@ -438,21 +438,21 @@ namespace GameLauncher.Engines.Unity
var subPath = Path.Combine(game.RootDirectory, sub); var subPath = Path.Combine(game.RootDirectory, sub);
if (Directory.Exists(subPath)) if (Directory.Exists(subPath))
{ {
CollectCandidateFiles(subPath, "ゲームフォルダ/" + sub, list, isStrict: false); this.CollectCandidateFiles(subPath, "ゲームフォルダ/" + sub, list, isStrict: false);
} }
} }
// Dataフォルダ直下のセーブファイル候補 // Dataフォルダ直下のセーブファイル候補
if (!string.IsNullOrEmpty(game.DataDirectoryPath) && Directory.Exists(game.DataDirectoryPath)) if (!string.IsNullOrEmpty(game.DataDirectoryPath) && Directory.Exists(game.DataDirectoryPath))
{ {
CollectCandidateFiles(game.DataDirectoryPath, "Dataフォルダ", list); this.CollectCandidateFiles(game.DataDirectoryPath, "Dataフォルダ", list);
} }
} }
catch { } catch { }
} }
// 更新日時降順でソート // 更新日時降順でソート
return list.OrderByDescending(f => f.LastModified).ToList(); return [.. list.OrderByDescending(f => f.LastModified)];
} }
private void CollectCandidateFiles(string dir, string locationLabel, List<SaveFileEntry> list, bool isStrict = true) private void CollectCandidateFiles(string dir, string locationLabel, List<SaveFileEntry> list, bool isStrict = true)
@@ -494,7 +494,7 @@ namespace GameLauncher.Engines.Unity
FileSize = fi.Length, FileSize = fi.Length,
LastModified = fi.LastWriteTime, LastModified = fi.LastWriteTime,
LocationType = locationLabel, LocationType = locationLabel,
IsTextOrJson = CheckIsTextOrJson(f) IsTextOrJson = this.CheckIsTextOrJson(f)
}); });
} }
} }
@@ -649,7 +649,7 @@ namespace GameLauncher.Engines.Unity
} }
catch { } catch { }
return list.OrderByDescending(b => b.Timestamp).ToList(); return [.. list.OrderByDescending(b => b.Timestamp)];
} }
/// <summary> /// <summary>
+1 -1
View File
@@ -85,7 +85,7 @@ namespace GameLauncher.Engines.Wolf
return (false, "ゲームのルートディレクトリが見つかりません。"); return (false, "ゲームのルートディレクトリが見つかりません。");
} }
var extractorPath = ResolveExtractorPath(customExtractorPath); var extractorPath = this.ResolveExtractorPath(customExtractorPath);
if (string.IsNullOrEmpty(extractorPath) || !File.Exists(extractorPath)) if (string.IsNullOrEmpty(extractorPath) || !File.Exists(extractorPath))
{ {
return (false, "Wolf RPG アーカイブ解凍ツール(UberWolfCli.exe / WolfDec.exe)が見つかりません。設定ダイアログからツールのパスを指定してください。"); return (false, "Wolf RPG アーカイブ解凍ツール(UberWolfCli.exe / WolfDec.exe)が見つかりません。設定ダイアログからツールのパスを指定してください。");
+3 -3
View File
@@ -51,7 +51,7 @@ namespace GameLauncher.Engines.Wolf
try try
{ {
// 1. プロキシDLL本体の探索 (Tools\speedhack-i686\version.dll) // 1. プロキシDLL本体の探索 (Tools\speedhack-i686\version.dll)
var sourceDllPath = ResolveProxyDllPath(); var sourceDllPath = this.ResolveProxyDllPath();
if (string.IsNullOrEmpty(sourceDllPath) || !File.Exists(sourceDllPath)) if (string.IsNullOrEmpty(sourceDllPath) || !File.Exists(sourceDllPath))
{ {
return (false, "プロキシDLL(Engines\\Wolf\\Tools\\speedhack-i686\\version.dll)が見つかりません。"); return (false, "プロキシDLL(Engines\\Wolf\\Tools\\speedhack-i686\\version.dll)が見つかりません。");
@@ -73,7 +73,7 @@ namespace GameLauncher.Engines.Wolf
File.Copy(sourceDllPath, targetDllPath, overwrite: true); File.Copy(sourceDllPath, targetDllPath, overwrite: true);
// 4. speedhack_config.json の生成・書き込み // 4. speedhack_config.json の生成・書き込み
var configContent = GenerateSpeedhackConfig(baseSpeed, toggleSpeed, holdSpeed); var configContent = this.GenerateSpeedhackConfig(baseSpeed, toggleSpeed, holdSpeed);
File.WriteAllText(targetConfigPath, configContent, new UTF8Encoding(false)); File.WriteAllText(targetConfigPath, configContent, new UTF8Encoding(false));
game.WolfProxyDll = true; game.WolfProxyDll = true;
@@ -138,7 +138,7 @@ namespace GameLauncher.Engines.Wolf
var sb = new StringBuilder(); var sb = new StringBuilder();
// 1. プロキシDLLの解除 // 1. プロキシDLLの解除
var (dllSuccess, dllMsg) = RemoveProxyDll(game); var (dllSuccess, dllMsg) = this.RemoveProxyDll(game);
sb.AppendLine(dllMsg); sb.AppendLine(dllMsg);
// 2. Game.exe バックアップからの復元(存在する場合) // 2. Game.exe バックアップからの復元(存在する場合)
+6 -6
View File
@@ -108,7 +108,7 @@ namespace GameLauncher.Engines.Wolf
catch { } catch { }
} }
return result.Distinct(StringComparer.OrdinalIgnoreCase).ToList(); return [.. result.Distinct(StringComparer.OrdinalIgnoreCase)];
} }
/// <summary> /// <summary>
@@ -186,7 +186,7 @@ namespace GameLauncher.Engines.Wolf
throw new FileNotFoundException($"セーブデータファイルが見つかりません: {filePath}"); throw new FileNotFoundException($"セーブデータファイルが見つかりません: {filePath}");
byte[] rawBytes = File.ReadAllBytes(filePath); byte[] rawBytes = File.ReadAllBytes(filePath);
byte[] decrypted = Decrypt(rawBytes); byte[] decrypted = this.Decrypt(rawBytes);
var result = new WolfSaveData 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; return result;
} }
@@ -293,7 +293,7 @@ namespace GameLauncher.Engines.Wolf
throw new InvalidOperationException("保存対象のデータが空です。"); throw new InvalidOperationException("保存対象のデータが空です。");
// 1. バックアップ作成 (Backups フォルダへ) // 1. バックアップ作成 (Backups フォルダへ)
string? backupPath = BackupSaveFile(model.FilePath, folderName, rootDirectory); string? backupPath = this.BackupSaveFile(model.FilePath, folderName, rootDirectory);
// 2. 変数・項目の変更を RawDecryptedBytes に書き戻し // 2. 変数・項目の変更を RawDecryptedBytes に書き戻し
foreach (var item in model.Variables) foreach (var item in model.Variables)
@@ -306,7 +306,7 @@ namespace GameLauncher.Engines.Wolf
} }
// 3. 暗号化 & チェックサム再計算 // 3. 暗号化 & チェックサム再計算
byte[] encrypted = Encrypt(model.RawDecryptedBytes); byte[] encrypted = this.Encrypt(model.RawDecryptedBytes);
// 4. アトミック書き込み // 4. アトミック書き込み
string tempFile = model.FilePath + ".tmp_" + Guid.NewGuid().ToString("N"); string tempFile = model.FilePath + ".tmp_" + Guid.NewGuid().ToString("N");
+572 -583
View File
File diff suppressed because it is too large. Load diff
+38 -38
View File
@@ -34,51 +34,51 @@ namespace GameLauncher.Models
/// <summary>ゲームの表示タイトル</summary> /// <summary>ゲームの表示タイトル</summary>
public string Title public string Title
{ {
get => _title; get => this._title;
set { if (_title != value) { _title = value; OnPropertyChanged(); } } set { if (this._title != value) { this._title = value; this.OnPropertyChanged(); } }
} }
/// <summary>フォルダ名</summary> /// <summary>フォルダ名</summary>
public string FolderName public string FolderName
{ {
get => _folderName; get => this._folderName;
set { if (_folderName != value) { _folderName = value; OnPropertyChanged(); } } set { if (this._folderName != value) { this._folderName = value; this.OnPropertyChanged(); } }
} }
/// <summary>ゲームのルートディレクトリ絶対パス</summary> /// <summary>ゲームのルートディレクトリ絶対パス</summary>
public string RootDirectory public string RootDirectory
{ {
get => _rootDirectory; get => this._rootDirectory;
set { if (_rootDirectory != value) { _rootDirectory = value; OnPropertyChanged(); } } set { if (this._rootDirectory != value) { this._rootDirectory = value; this.OnPropertyChanged(); } }
} }
/// <summary>ゲームの実行ファイル(.exe等)絶対パス</summary> /// <summary>ゲームの実行ファイル(.exe等)絶対パス</summary>
public string ExecutablePath public string ExecutablePath
{ {
get => _executablePath; get => this._executablePath;
set { if (_executablePath != value) { _executablePath = value; OnPropertyChanged(); } } set { if (this._executablePath != value) { this._executablePath = value; this.OnPropertyChanged(); } }
} }
/// <summary>アプリアイコン画像</summary> /// <summary>アプリアイコン画像</summary>
public ImageSource? IconImage public ImageSource? IconImage
{ {
get => _iconImage; get => this._iconImage;
set { if (_iconImage != value) { _iconImage = value; OnPropertyChanged(); } } set { if (this._iconImage != value) { this._iconImage = value; this.OnPropertyChanged(); } }
} }
/// <summary>ランチャーからの最終起動日時</summary> /// <summary>ランチャーからの最終起動日時</summary>
public DateTime? LastLaunched public DateTime? LastLaunched
{ {
get => _lastLaunched; get => this._lastLaunched;
set set
{ {
if (_lastLaunched != value) if (this._lastLaunched != value)
{ {
_lastLaunched = value; this._lastLaunched = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(LastLaunchedDisplay)); this.OnPropertyChanged(nameof(this.LastLaunchedDisplay));
OnPropertyChanged(nameof(LastLaunchedCardDisplay)); this.OnPropertyChanged(nameof(this.LastLaunchedCardDisplay));
OnPropertyChanged(nameof(LastLaunchedDetailDisplay)); this.OnPropertyChanged(nameof(this.LastLaunchedDetailDisplay));
} }
} }
} }
@@ -86,16 +86,16 @@ namespace GameLauncher.Models
/// <summary>フォルダ更新日時</summary> /// <summary>フォルダ更新日時</summary>
public DateTime? FolderLastModified public DateTime? FolderLastModified
{ {
get => _folderLastModified; get => this._folderLastModified;
set set
{ {
if (_folderLastModified != value) if (this._folderLastModified != value)
{ {
_folderLastModified = value; this._folderLastModified = value;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(FolderLastModifiedDisplay)); this.OnPropertyChanged(nameof(this.FolderLastModifiedDisplay));
OnPropertyChanged(nameof(FolderLastModifiedCardDisplay)); this.OnPropertyChanged(nameof(this.FolderLastModifiedCardDisplay));
OnPropertyChanged(nameof(FolderLastModifiedDetailDisplay)); this.OnPropertyChanged(nameof(this.FolderLastModifiedDetailDisplay));
} }
} }
} }
@@ -128,8 +128,8 @@ namespace GameLauncher.Models
/// <summary>ゲームエンジンの種別</summary> /// <summary>ゲームエンジンの種別</summary>
public abstract GameEngineKind EngineKind { get; } public abstract GameEngineKind EngineKind { get; }
public bool IsTkoolOrTyrano => EngineKind is GameEngineKind.Tkool or GameEngineKind.Tyrano; public bool IsTkoolOrTyrano => this.EngineKind is GameEngineKind.Tkool or GameEngineKind.Tyrano;
public bool IsUnity => EngineKind == GameEngineKind.Unity; public bool IsUnity => this.EngineKind == GameEngineKind.Unity;
/// <summary>Enigma Virtual Box でパックされたゲームか</summary> /// <summary>Enigma Virtual Box でパックされたゲームか</summary>
public virtual bool IsEvb => false; public virtual bool IsEvb => false;
@@ -169,28 +169,28 @@ namespace GameLauncher.Models
/// <summary>EVB 詳細状態テキスト</summary> /// <summary>EVB 詳細状態テキスト</summary>
public virtual string EvbDetailStatusText => string.Empty; public virtual string EvbDetailStatusText => string.Empty;
public string LastLaunchedDisplay => LastLaunched.HasValue public string LastLaunchedDisplay => this.LastLaunched.HasValue
? LastLaunched.Value.ToString("yyyy/MM/dd HH:mm") ? this.LastLaunched.Value.ToString("yyyy/MM/dd HH:mm")
: "未起動"; : "未起動";
public string LastLaunchedCardDisplay => LastLaunched.HasValue public string LastLaunchedCardDisplay => this.LastLaunched.HasValue
? $"▶ {LastLaunched.Value:yy/MM/dd HH:mm}" ? $"▶ {this.LastLaunched.Value:yy/MM/dd HH:mm}"
: "▶ 未起動"; : "▶ 未起動";
public string LastLaunchedDetailDisplay => LastLaunched.HasValue public string LastLaunchedDetailDisplay => this.LastLaunched.HasValue
? LastLaunched.Value.ToString("yyyy/MM/dd HH:mm:ss") ? this.LastLaunched.Value.ToString("yyyy/MM/dd HH:mm:ss")
: "まだ起動されていません"; : "まだ起動されていません";
public string FolderLastModifiedDisplay => FolderLastModified.HasValue public string FolderLastModifiedDisplay => this.FolderLastModified.HasValue
? FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm") ? this.FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm")
: "-"; : "-";
public string FolderLastModifiedCardDisplay => FolderLastModified.HasValue public string FolderLastModifiedCardDisplay => this.FolderLastModified.HasValue
? $"📁 {FolderLastModified.Value:yy/MM/dd HH:mm}" ? $"📁 {this.FolderLastModified.Value:yy/MM/dd HH:mm}"
: "📁 -"; : "📁 -";
public string FolderLastModifiedDetailDisplay => FolderLastModified.HasValue public string FolderLastModifiedDetailDisplay => this.FolderLastModified.HasValue
? FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm:ss") ? this.FolderLastModified.Value.ToString("yyyy/MM/dd HH:mm:ss")
: "不明"; : "不明";
// ================= バッジ・UIバインディング共通仮想プロパティ ================= // ================= バッジ・UIバインディング共通仮想プロパティ =================
+4 -4
View File
@@ -114,13 +114,13 @@ namespace GameLauncher.Models
public bool IsEnabled public bool IsEnabled
{ {
get => _isEnabled; get => this._isEnabled;
set set
{ {
if (_isEnabled != value) if (this._isEnabled != value)
{ {
_isEnabled = value; this._isEnabled = value;
OnPropertyChanged(); this.OnPropertyChanged();
} }
} }
} }
+16 -16
View File
@@ -26,36 +26,36 @@ namespace GameLauncher.Models
/// <summary>項目名(キー名、変数名)</summary> /// <summary>項目名(キー名、変数名)</summary>
public string Key public string Key
{ {
get => _key; get => this._key;
set { if (_key != value) { _key = value; OnPropertyChanged(); } } set { if (this._key != value) { this._key = value; this.OnPropertyChanged(); } }
} }
/// <summary>分類・カテゴリ(セクション、オブジェクト名など)</summary> /// <summary>分類・カテゴリ(セクション、オブジェクト名など)</summary>
public string Category public string Category
{ {
get => _category; get => this._category;
set { if (_category != value) { _category = value; OnPropertyChanged(); } } set { if (this._category != value) { this._category = value; this.OnPropertyChanged(); } }
} }
/// <summary>データ型(Int, Float, Bool, String など)</summary> /// <summary>データ型(Int, Float, Bool, String など)</summary>
public string Type public string Type
{ {
get => _type; get => this._type;
set { if (_type != value) { _type = value; OnPropertyChanged(); } } set { if (this._type != value) { this._type = value; this.OnPropertyChanged(); } }
} }
/// <summary>GUI編集用の値文字列</summary> /// <summary>GUI編集用の値文字列</summary>
public string EditValue public string EditValue
{ {
get => _editValue; get => this._editValue;
set set
{ {
if (_editValue != value) if (this._editValue != value)
{ {
_editValue = value; this._editValue = value;
_isModified = true; this._isModified = true;
OnPropertyChanged(); this.OnPropertyChanged();
OnPropertyChanged(nameof(IsModified)); this.OnPropertyChanged(nameof(this.IsModified));
} }
} }
} }
@@ -63,15 +63,15 @@ namespace GameLauncher.Models
/// <summary>値がユーザーによって変更されたかどうか</summary> /// <summary>値がユーザーによって変更されたかどうか</summary>
public bool IsModified public bool IsModified
{ {
get => _isModified; get => this._isModified;
set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } } set { if (this._isModified != value) { this._isModified = value; this.OnPropertyChanged(); } }
} }
/// <summary>備考・説明・オフセット位置など</summary> /// <summary>備考・説明・オフセット位置など</summary>
public string Description public string Description
{ {
get => _description; get => this._description;
set { if (_description != value) { _description = value; OnPropertyChanged(); } } set { if (this._description != value) { this._description = value; this.OnPropertyChanged(); } }
} }
/// <summary>内部保持用の生データや元データ(再エンコード用)</summary> /// <summary>内部保持用の生データや元データ(再エンコード用)</summary>
+161 -161
View File
@@ -33,7 +33,7 @@ namespace GameLauncher
// PlayerPrefs データ // PlayerPrefs データ
private readonly ObservableCollection<PlayerPrefsEntry> _allPrefs = []; private readonly ObservableCollection<PlayerPrefsEntry> _allPrefs = [];
private ListCollectionView _prefsView = null!; private readonly ListCollectionView _prefsView = null!;
// ファイル一覧データ // ファイル一覧データ
private readonly ObservableCollection<SaveFileEntry> _saveFiles = []; private readonly ObservableCollection<SaveFileEntry> _saveFiles = [];
@@ -41,7 +41,7 @@ namespace GameLauncher
// GUIセーブプロパティデータ // GUIセーブプロパティデータ
private readonly ObservableCollection<SaveDataPropertyEntry> _guiProperties = []; private readonly ObservableCollection<SaveDataPropertyEntry> _guiProperties = [];
private ListCollectionView _guiPropsView = null!; private readonly ListCollectionView _guiPropsView = null!;
private ISaveDataCodec? _currentCodec; private ISaveDataCodec? _currentCodec;
// バックアップ一覧データ // バックアップ一覧データ
@@ -49,36 +49,36 @@ namespace GameLauncher
public SaveEditorWindow(UnityGameItem game) public SaveEditorWindow(UnityGameItem game)
{ {
InitializeComponent(); this.InitializeComponent();
Game = game; this.Game = game;
lblGameTitle.Text = game.Title; this.lblGameTitle.Text = game.Title;
lblGameInfo.Text = $"{game.CompanyName} / {game.ProductName} ({game.BackendBadgeText})"; this.lblGameInfo.Text = $"{game.CompanyName} / {game.ProductName} ({game.BackendBadgeText})";
// PlayerPrefs ビュー // PlayerPrefs ビュー
_prefsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_allPrefs); this._prefsView = (ListCollectionView)CollectionViewSource.GetDefaultView(this._allPrefs);
_prefsView.Filter = FilterPrefs; this._prefsView.Filter = this.FilterPrefs;
dgPlayerPrefs.ItemsSource = _prefsView; this.dgPlayerPrefs.ItemsSource = this._prefsView;
// ファイル一覧 // ファイル一覧
lstSaveFiles.ItemsSource = _saveFiles; this.lstSaveFiles.ItemsSource = this._saveFiles;
// GUI プロパティビュー // GUI プロパティビュー
_guiPropsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_guiProperties); this._guiPropsView = (ListCollectionView)CollectionViewSource.GetDefaultView(this._guiProperties);
_guiPropsView.Filter = FilterGuiProperties; this._guiPropsView.Filter = this.FilterGuiProperties;
dgGuiProperties.ItemsSource = _guiPropsView; 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) private void SaveEditorWindow_Loaded(object sender, RoutedEventArgs e)
{ {
ReloadPlayerPrefs(); this.ReloadPlayerPrefs();
ReloadSaveFiles(); this.ReloadSaveFiles();
ReloadBackups(); this.ReloadBackups();
} }
// ==================================================================== // ====================================================================
@@ -87,26 +87,26 @@ namespace GameLauncher
public void ReloadPlayerPrefs() public void ReloadPlayerPrefs()
{ {
_allPrefs.Clear(); this._allPrefs.Clear();
if (string.IsNullOrEmpty(Game.RegistryPath)) if (string.IsNullOrEmpty(this.Game.RegistryPath))
{ {
lblStatus.Text = "レジストリ情報が設定されていません (app.info が見つかりませんでした)"; this.lblStatus.Text = "レジストリ情報が設定されていません (app.info が見つかりませんでした)";
return; return;
} }
var entries = _saveService.GetPlayerPrefs(Game.RegistryPath); var entries = this._saveService.GetPlayerPrefs(this.Game.RegistryPath);
foreach (var entry in entries) 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) private bool FilterPrefs(object obj)
{ {
if (obj is not PlayerPrefsEntry entry) return false; 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; if (string.IsNullOrEmpty(query)) return true;
return entry.CleanKey.Contains(query, StringComparison.OrdinalIgnoreCase) || return entry.CleanKey.Contains(query, StringComparison.OrdinalIgnoreCase) ||
@@ -116,26 +116,26 @@ namespace GameLauncher
private void txtSearchPrefs_TextChanged(object sender, TextChangedEventArgs e) private void txtSearchPrefs_TextChanged(object sender, TextChangedEventArgs e)
{ {
_prefsView.Refresh(); this._prefsView.Refresh();
} }
private void dgPlayerPrefs_SelectionChanged(object sender, SelectionChangedEventArgs e) 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; this.lblSelectedKeyName.Text = entry.CleanKey;
txtEditValueBar.Text = entry.EditValue; this.txtEditValueBar.Text = entry.EditValue;
txtEditValueBar.IsEnabled = true; this.txtEditValueBar.IsEnabled = true;
btnSaveCurrentPref.IsEnabled = true; this.btnSaveCurrentPref.IsEnabled = true;
btnDeleteCurrentPref.IsEnabled = true; this.btnDeleteCurrentPref.IsEnabled = true;
} }
else else
{ {
lblSelectedKeyName.Text = "(なし)"; this.lblSelectedKeyName.Text = "(なし)";
txtEditValueBar.Text = string.Empty; this.txtEditValueBar.Text = string.Empty;
txtEditValueBar.IsEnabled = false; this.txtEditValueBar.IsEnabled = false;
btnSaveCurrentPref.IsEnabled = false; this.btnSaveCurrentPref.IsEnabled = false;
btnDeleteCurrentPref.IsEnabled = false; this.btnDeleteCurrentPref.IsEnabled = false;
} }
} }
@@ -143,25 +143,25 @@ namespace GameLauncher
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {
SaveCurrentSelectedPref(); this.SaveCurrentSelectedPref();
} }
} }
private void btnSaveCurrentPref_Click(object sender, RoutedEventArgs e) private void btnSaveCurrentPref_Click(object sender, RoutedEventArgs e)
{ {
SaveCurrentSelectedPref(); this.SaveCurrentSelectedPref();
} }
private void 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; entry.EditValue = this.txtEditValueBar.Text;
bool success = _saveService.SavePlayerPref(Game.RegistryPath, entry); bool success = this._saveService.SavePlayerPref(this.Game.RegistryPath, entry);
if (success) if (success)
{ {
lblStatus.Text = $"キー '{entry.CleanKey}' の値を正常に更新しました。"; this.lblStatus.Text = $"キー '{entry.CleanKey}' の値を正常に更新しました。";
dgPlayerPrefs.Items.Refresh(); this.dgPlayerPrefs.Items.Refresh();
} }
else else
{ {
@@ -172,16 +172,16 @@ namespace GameLauncher
private void btnDeleteCurrentPref_Click(object sender, RoutedEventArgs e) 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}) をレジストリから削除しますか?", var res = MessageBox.Show($"キー '{entry.CleanKey}' ({entry.RawKey}) をレジストリから削除しますか?",
"キー削除の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning); "キー削除の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (res != MessageBoxResult.Yes) return; if (res != MessageBoxResult.Yes) return;
if (_saveService.DeletePlayerPref(Game.RegistryPath, entry.RawKey)) if (this._saveService.DeletePlayerPref(this.Game.RegistryPath, entry.RawKey))
{ {
_allPrefs.Remove(entry); this._allPrefs.Remove(entry);
lblStatus.Text = $"キー '{entry.CleanKey}' を削除しました。"; this.lblStatus.Text = $"キー '{entry.CleanKey}' を削除しました。";
} }
else else
{ {
@@ -194,10 +194,10 @@ namespace GameLauncher
var dlg = new AddKeyDialog { Owner = this }; var dlg = new AddKeyDialog { Owner = this };
if (dlg.ShowDialog() == true) 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(); this.ReloadPlayerPrefs();
lblStatus.Text = $"新規キー '{dlg.KeyName}' ({rawKey}) を追加しました。"; this.lblStatus.Text = $"新規キー '{dlg.KeyName}' ({rawKey}) を追加しました。";
} }
else else
{ {
@@ -208,12 +208,12 @@ namespace GameLauncher
private void btnBackupPrefs_Click(object sender, RoutedEventArgs e) private void btnBackupPrefs_Click(object sender, RoutedEventArgs e)
{ {
var backupDir = AppPathHelper.GetGameBackupDirectory(Game.FolderName, Game.RootDirectory); var backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory);
var result = _saveService.BackupRegistry(Game.RegistryPath, backupDir); var result = this._saveService.BackupRegistry(this.Game.RegistryPath, backupDir);
if (result != null) if (result != null)
{ {
ReloadBackups(); this.ReloadBackups();
lblStatus.Text = $"レジストリをバックアップしました: {Path.GetFileName(result)}"; this.lblStatus.Text = $"レジストリをバックアップしました: {Path.GetFileName(result)}";
MessageBox.Show($"レジストリをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show($"レジストリをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information);
} }
else else
@@ -224,7 +224,7 @@ namespace GameLauncher
private void btnRestorePrefs_Click(object sender, RoutedEventArgs e) 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 var dlg = new OpenFileDialog
{ {
Title = "復元する .reg ファイルを選択", Title = "復元する .reg ファイルを選択",
@@ -238,10 +238,10 @@ namespace GameLauncher
"復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning); "復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (res != MessageBoxResult.Yes) return; if (res != MessageBoxResult.Yes) return;
if (_saveService.RestoreRegistry(dlg.FileName)) if (this._saveService.RestoreRegistry(dlg.FileName))
{ {
ReloadPlayerPrefs(); this.ReloadPlayerPrefs();
lblStatus.Text = "レジストリを正常に復元しました。"; this.lblStatus.Text = "レジストリを正常に復元しました。";
MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
} }
else else
@@ -253,17 +253,17 @@ namespace GameLauncher
private void btnReloadPrefs_Click(object sender, RoutedEventArgs e) private void btnReloadPrefs_Click(object sender, RoutedEventArgs e)
{ {
ReloadPlayerPrefs(); this.ReloadPlayerPrefs();
} }
private void ctxSavePref_Click(object sender, RoutedEventArgs e) private void ctxSavePref_Click(object sender, RoutedEventArgs e)
{ {
SaveCurrentSelectedPref(); this.SaveCurrentSelectedPref();
} }
private void ctxCopyKey_Click(object sender, RoutedEventArgs e) 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); Clipboard.SetText(entry.CleanKey);
} }
@@ -271,7 +271,7 @@ namespace GameLauncher
private void ctxCopyValue_Click(object sender, RoutedEventArgs e) 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); Clipboard.SetText(entry.EditValue);
} }
@@ -279,7 +279,7 @@ namespace GameLauncher
private void ctxDeletePref_Click(object sender, RoutedEventArgs e) 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() public void ReloadSaveFiles()
{ {
_saveFiles.Clear(); this._saveFiles.Clear();
var files = _saveService.GetSaveFiles(Game); var files = this._saveService.GetSaveFiles(this.Game);
foreach (var f in files) 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 else
{ {
lblCurrentFileName.Text = "セーブファイルは見つかりませんでした"; this.lblCurrentFileName.Text = "セーブファイルは見つかりませんでした";
lblCurrentFilePath.Text = string.Empty; this.lblCurrentFilePath.Text = string.Empty;
txtFileContent.Text = string.Empty; this.txtFileContent.Text = string.Empty;
HideAllEditorPanels(); this.HideAllEditorPanels();
} }
} }
private void HideAllEditorPanels() private void HideAllEditorPanels()
{ {
pnlGuiEditor.Visibility = Visibility.Collapsed; this.pnlGuiEditor.Visibility = Visibility.Collapsed;
pnlTextEditor.Visibility = Visibility.Collapsed; this.pnlTextEditor.Visibility = Visibility.Collapsed;
pnlUnsupportedBinary.Visibility = Visibility.Collapsed; this.pnlUnsupportedBinary.Visibility = Visibility.Collapsed;
btnFormatJson.Visibility = Visibility.Collapsed; this.btnFormatJson.Visibility = Visibility.Collapsed;
btnSaveFileContent.Visibility = Visibility.Collapsed; this.btnSaveFileContent.Visibility = Visibility.Collapsed;
btnSaveGuiProperties.Visibility = Visibility.Collapsed; this.btnSaveGuiProperties.Visibility = Visibility.Collapsed;
badgeCodec.Visibility = Visibility.Collapsed; this.badgeCodec.Visibility = Visibility.Collapsed;
} }
private void lstSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e) private void lstSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
if (lstSaveFiles.SelectedItem is not SaveFileEntry entry) return; if (this.lstSaveFiles.SelectedItem is not SaveFileEntry entry) return;
_currentSelectedFile = entry; this._currentSelectedFile = entry;
lblCurrentFileName.Text = entry.FileName; this.lblCurrentFileName.Text = entry.FileName;
lblCurrentFilePath.Text = entry.FilePath; this.lblCurrentFilePath.Text = entry.FilePath;
HideAllEditorPanels(); this.HideAllEditorPanels();
// 1. コーデック(対応形式)が存在するか判定 // 1. コーデック(対応形式)が存在するか判定
var codec = SaveDataCodecManager.Instance.FindCodec(Game, entry); var codec = SaveDataCodecManager.Instance.FindCodec(this.Game, entry);
if (codec != null) if (codec != null)
{ {
// GUI エディタモードをアクティブ化 // GUI エディタモードをアクティブ化
_currentCodec = codec; this._currentCodec = codec;
badgeCodec.Visibility = Visibility.Visible; this.badgeCodec.Visibility = Visibility.Visible;
lblCodecName.Text = codec.CodecName; this.lblCodecName.Text = codec.CodecName;
LoadGuiPropertiesFromCodec(codec, entry.FilePath); this.LoadGuiPropertiesFromCodec(codec, entry.FilePath);
pnlGuiEditor.Visibility = Visibility.Visible; this.pnlGuiEditor.Visibility = Visibility.Visible;
btnSaveGuiProperties.Visibility = Visibility.Visible; this.btnSaveGuiProperties.Visibility = Visibility.Visible;
lblStatus.Text = $"{codec.CodecName} で読み込みました: {entry.FileName}"; this.lblStatus.Text = $"{codec.CodecName} で読み込みました: {entry.FileName}";
return; return;
} }
// 2. プレーンテキスト/JSON形式の場合 // 2. プレーンテキスト/JSON形式の場合
if (entry.IsTextOrJson) if (entry.IsTextOrJson)
{ {
pnlTextEditor.Visibility = Visibility.Visible; this.pnlTextEditor.Visibility = Visibility.Visible;
txtFileContent.Text = _saveService.ReadSaveFileText(entry.FilePath); this.txtFileContent.Text = this._saveService.ReadSaveFileText(entry.FilePath);
btnFormatJson.Visibility = Visibility.Visible; this.btnFormatJson.Visibility = Visibility.Visible;
btnSaveFileContent.Visibility = Visibility.Visible; this.btnSaveFileContent.Visibility = Visibility.Visible;
lblStatus.Text = $"テキストとして開きました: {entry.FileName}"; this.lblStatus.Text = $"テキストとして開きました: {entry.FileName}";
return; return;
} }
// 3. 未対応のバイナリセーブデータ形式の場合 // 3. 未対応のバイナリセーブデータ形式の場合
pnlUnsupportedBinary.Visibility = Visibility.Visible; this.pnlUnsupportedBinary.Visibility = Visibility.Visible;
DisplayUnsupportedBinaryInfo(entry); this.DisplayUnsupportedBinaryInfo(entry);
lblStatus.Text = $"未対応のバイナリセーブデータ: {entry.FileName}"; this.lblStatus.Text = $"未対応のバイナリセーブデータ: {entry.FileName}";
} }
private void LoadGuiPropertiesFromCodec(ISaveDataCodec codec, string filePath) private void LoadGuiPropertiesFromCodec(ISaveDataCodec codec, string filePath)
{ {
_guiProperties.Clear(); this._guiProperties.Clear();
var props = codec.LoadProperties(filePath); var props = codec.LoadProperties(filePath);
foreach (var p in props) 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) if (props.Count > 0)
{ {
dgGuiProperties.SelectedIndex = 0; this.dgGuiProperties.SelectedIndex = 0;
} }
} }
private bool FilterGuiProperties(object obj) private bool FilterGuiProperties(object obj)
{ {
if (obj is not SaveDataPropertyEntry prop) return false; 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; if (string.IsNullOrEmpty(query)) return true;
return prop.Key.Contains(query, StringComparison.OrdinalIgnoreCase) || return prop.Key.Contains(query, StringComparison.OrdinalIgnoreCase) ||
@@ -389,26 +389,26 @@ namespace GameLauncher
private void txtSearchGuiProps_TextChanged(object sender, TextChangedEventArgs e) private void txtSearchGuiProps_TextChanged(object sender, TextChangedEventArgs e)
{ {
_guiPropsView.Refresh(); this._guiPropsView.Refresh();
int visibleCount = _guiPropsView.Cast<object>().Count(); int visibleCount = this._guiPropsView.Cast<object>().Count();
lblGuiPropCount.Text = $"{visibleCount} / {_guiProperties.Count} 項目"; this.lblGuiPropCount.Text = $"{visibleCount} / {this._guiProperties.Count} 項目";
} }
private void dgGuiProperties_SelectionChanged(object sender, SelectionChangedEventArgs e) 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; this.lblSelectedPropKey.Text = prop.Key;
txtEditPropValueBar.Text = prop.EditValue; this.txtEditPropValueBar.Text = prop.EditValue;
txtEditPropValueBar.IsEnabled = true; this.txtEditPropValueBar.IsEnabled = true;
btnApplyPropValue.IsEnabled = true; this.btnApplyPropValue.IsEnabled = true;
} }
else else
{ {
lblSelectedPropKey.Text = "(未選択)"; this.lblSelectedPropKey.Text = "(未選択)";
txtEditPropValueBar.Text = string.Empty; this.txtEditPropValueBar.Text = string.Empty;
txtEditPropValueBar.IsEnabled = false; this.txtEditPropValueBar.IsEnabled = false;
btnApplyPropValue.IsEnabled = false; this.btnApplyPropValue.IsEnabled = false;
} }
} }
@@ -416,28 +416,28 @@ namespace GameLauncher
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {
btnApplyPropValue_Click(sender, e); this.btnApplyPropValue_Click(sender, e);
} }
} }
private void btnApplyPropValue_Click(object sender, RoutedEventArgs 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; prop.EditValue = this.txtEditPropValueBar.Text;
dgGuiProperties.Items.Refresh(); this.dgGuiProperties.Items.Refresh();
lblStatus.Text = $"項目 '{prop.Key}' の値を変更しました。(「変更を保存」ボタンでファイルへ書き戻せます)"; this.lblStatus.Text = $"項目 '{prop.Key}' の値を変更しました。(「変更を保存」ボタンでファイルへ書き戻せます)";
} }
} }
private void btnSaveGuiProperties_Click(object sender, RoutedEventArgs e) 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) if (success)
{ {
lblStatus.Text = $"セーブファイルを正常に更新しました (自動バックアップ .bak 作成済み): {_currentSelectedFile.FileName}"; this.lblStatus.Text = $"セーブファイルを正常に更新しました (自動バックアップ .bak 作成済み): {this._currentSelectedFile.FileName}";
MessageBox.Show("セーブファイルを正常に更新・保存しました。\n(元のファイルは同階層に .bak として自動バックアップされています)", MessageBox.Show("セーブファイルを正常に更新・保存しました。\n(元のファイルは同階層に .bak として自動バックアップされています)",
"保存完了", MessageBoxButton.OK, MessageBoxImage.Information); "保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
} }
@@ -460,41 +460,41 @@ namespace GameLauncher
{ {
hexList.Add(bytes[i].ToString("X2")); hexList.Add(bytes[i].ToString("X2"));
} }
lblHexPreview.Text = string.Join(" ", hexList) + (bytes.Length > 32 ? " ..." : ""); this.lblHexPreview.Text = string.Join(" ", hexList) + (bytes.Length > 32 ? " ..." : "");
} }
} }
catch catch
{ {
lblHexPreview.Text = "(読み込み失敗)"; this.lblHexPreview.Text = "(読み込み失敗)";
} }
} }
private void btnCopyIdePrompt_Click(object sender, RoutedEventArgs e) 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); Clipboard.SetText(prompt);
lblStatus.Text = "📋 Antigravity IDE 用の解析依頼プロンプトをクリップボードにコピーしました!"; this.lblStatus.Text = "📋 Antigravity IDE 用の解析依頼プロンプトをクリップボードにコピーしました!";
MessageBox.Show("Antigravity IDE 解析用プロンプトをコピーしました!\n\nAntigravity IDE のチャット欄に貼り付けて送信すると、AIがこのゲームのセーブデータ構造を解析し、GUI編集プラグインを自動で追加してくれます。", MessageBox.Show("Antigravity IDE 解析用プロンプトをコピーしました!\n\nAntigravity IDE のチャット欄に貼り付けて送信すると、AIがこのゲームのセーブデータ構造を解析し、GUI編集プラグインを自動で追加してくれます。",
"プロンプトをコピーしました", MessageBoxButton.OK, MessageBoxImage.Information); "プロンプトをコピーしました", MessageBoxButton.OK, MessageBoxImage.Information);
} }
private void btnForceShowBinary_Click(object sender, RoutedEventArgs e) private void btnForceShowBinary_Click(object sender, RoutedEventArgs e)
{ {
if (_currentSelectedFile == null) return; if (this._currentSelectedFile == null) return;
pnlUnsupportedBinary.Visibility = Visibility.Collapsed; this.pnlUnsupportedBinary.Visibility = Visibility.Collapsed;
pnlTextEditor.Visibility = Visibility.Visible; this.pnlTextEditor.Visibility = Visibility.Visible;
btnSaveFileContent.Visibility = Visibility.Visible; this.btnSaveFileContent.Visibility = Visibility.Visible;
txtFileContent.Text = _saveService.ReadSaveFileText(_currentSelectedFile.FilePath); this.txtFileContent.Text = this._saveService.ReadSaveFileText(this._currentSelectedFile.FilePath);
} }
private void btnFormatJson_Click(object sender, RoutedEventArgs e) private void btnFormatJson_Click(object sender, RoutedEventArgs e)
{ {
try try
{ {
var raw = txtFileContent.Text; var raw = this.txtFileContent.Text;
if (string.IsNullOrWhiteSpace(raw)) return; if (string.IsNullOrWhiteSpace(raw)) return;
using var doc = JsonDocument.Parse(raw); using var doc = JsonDocument.Parse(raw);
@@ -503,8 +503,8 @@ namespace GameLauncher
WriteIndented = true, WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
}); });
txtFileContent.Text = formatted; this.txtFileContent.Text = formatted;
lblStatus.Text = "JSONを整形しました。"; this.lblStatus.Text = "JSONを整形しました。";
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -514,12 +514,12 @@ namespace GameLauncher
private void btnSaveFileContent_Click(object sender, RoutedEventArgs e) 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) if (success)
{ {
lblStatus.Text = $"ファイルを保存しました (自動バックアップ .bak 作成済み): {_currentSelectedFile.FileName}"; this.lblStatus.Text = $"ファイルを保存しました (自動バックアップ .bak 作成済み): {this._currentSelectedFile.FileName}";
MessageBox.Show("ファイルを保存しました。\n(元のファイルは同階層に .bak としてバックアップされています)", MessageBox.Show("ファイルを保存しました。\n(元のファイルは同階層に .bak としてバックアップされています)",
"保存完了", MessageBoxButton.OK, MessageBoxImage.Information); "保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
} }
@@ -532,14 +532,14 @@ namespace GameLauncher
private void btnBackupSingleFile_Click(object sender, RoutedEventArgs e) 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 backupDir = AppPathHelper.GetGameBackupDirectory(this.Game.FolderName, this.Game.RootDirectory);
var result = _saveService.BackupSaveFile(_currentSelectedFile.FilePath, backupDir); var result = this._saveService.BackupSaveFile(this._currentSelectedFile.FilePath, backupDir);
if (result != null) if (result != null)
{ {
ReloadBackups(); this.ReloadBackups();
lblStatus.Text = $"ファイルをバックアップしました: {Path.GetFileName(result)}"; this.lblStatus.Text = $"ファイルをバックアップしました: {Path.GetFileName(result)}";
MessageBox.Show($"ファイルをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show($"ファイルをバックアップしました:\n\n{result}", "バックアップ完了", MessageBoxButton.OK, MessageBoxImage.Information);
} }
else else
@@ -550,7 +550,7 @@ namespace GameLauncher
private void btnReloadSaveFiles_Click(object sender, RoutedEventArgs e) private void btnReloadSaveFiles_Click(object sender, RoutedEventArgs e)
{ {
ReloadSaveFiles(); this.ReloadSaveFiles();
} }
// ==================================================================== // ====================================================================
@@ -559,22 +559,22 @@ namespace GameLauncher
public void ReloadBackups() public void ReloadBackups()
{ {
_backups.Clear(); this._backups.Clear();
var list = _saveService.GetBackupList(Game); var list = this._saveService.GetBackupList(this.Game);
foreach (var b in list) foreach (var b in list)
{ {
_backups.Add(b); this._backups.Add(b);
} }
} }
private void btnReloadBackups_Click(object sender, RoutedEventArgs e) private void btnReloadBackups_Click(object sender, RoutedEventArgs e)
{ {
ReloadBackups(); this.ReloadBackups();
} }
private void btnOpenBackupDir_Click(object sender, RoutedEventArgs e) 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); UnitySaveManagerService.OpenFolderInExplorer(backupDir);
} }
@@ -588,9 +588,9 @@ namespace GameLauncher
"復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning); "復元の確認", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (res == MessageBoxResult.Yes) if (res == MessageBoxResult.Yes)
{ {
if (_saveService.RestoreRegistry(backup.BackupPath)) if (this._saveService.RestoreRegistry(backup.BackupPath))
{ {
ReloadPlayerPrefs(); this.ReloadPlayerPrefs();
MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show("レジストリを正常に復元しました。", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
} }
else else
@@ -613,29 +613,29 @@ namespace GameLauncher
private void btnOpenLocalLow_Click(object sender, RoutedEventArgs e) 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)) if (parent != null && Directory.Exists(parent))
{ {
UnitySaveManagerService.OpenFolderInExplorer(parent); UnitySaveManagerService.OpenFolderInExplorer(parent);
return; return;
} }
} }
UnitySaveManagerService.OpenFolderInExplorer(Game.LocalLowPath); UnitySaveManagerService.OpenFolderInExplorer(this.Game.LocalLowPath);
} }
} }
private void btnOpenGameFolder_Click(object sender, RoutedEventArgs e) 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) private void btnOpenRegedit_Click(object sender, RoutedEventArgs e)
{ {
_saveService.OpenRegistryEditor(Game.RegistryPath); this._saveService.OpenRegistryEditor(this.Game.RegistryPath);
} }
} }
} }
+6 -4
View File
@@ -270,15 +270,17 @@ namespace GameLauncher.Services.Codecs
/// <returns>バイナリ情報プロパティのリスト</returns> /// <returns>バイナリ情報プロパティのリスト</returns>
private List<SaveDataPropertyEntry> ExtractBinaryPropertiesFallback(byte[] bytes) private List<SaveDataPropertyEntry> ExtractBinaryPropertiesFallback(byte[] bytes)
{ {
var list = new List<SaveDataPropertyEntry>(); var list = new List<SaveDataPropertyEntry>
list.Add(new SaveDataPropertyEntry {
new SaveDataPropertyEntry
{ {
Key = "FileSize", Key = "FileSize",
Category = "ファイル情報", Category = "ファイル情報",
Type = "Int", Type = "Int",
EditValue = bytes.Length.ToString(), EditValue = bytes.Length.ToString(),
Description = "ファイルサイズ (bytes)" Description = "ファイルサイズ (bytes)"
}); }
};
// 先頭 128 バイトから 4 バイト整数と ASCII 文字列を検出してプロパティ化 // 先頭 128 バイトから 4 バイト整数と ASCII 文字列を検出してプロパティ化
int limit = Math.Min(bytes.Length - 4, 128); int limit = Math.Min(bytes.Length - 4, 128);
@@ -388,7 +390,7 @@ namespace GameLauncher.Services.Codecs
try try
{ {
// ドットと角括弧でパスを分割 // ドットと角括弧でパスを分割
var parts = path.Split(new[] { '.', '[', ']' }, StringSplitOptions.RemoveEmptyEntries); var parts = path.Split(['.', '[', ']'], StringSplitOptions.RemoveEmptyEntries);
JsonNode? current = root; JsonNode? current = root;
for (int i = 0; i < parts.Length - 1; i++) for (int i = 0; i < parts.Length - 1; i++)
+57 -57
View File
@@ -132,8 +132,8 @@ namespace GameLauncher.Services
public GameScannerService() public GameScannerService()
{ {
var baseDir = AppPathHelper.GetExeDirectory(); var baseDir = AppPathHelper.GetExeDirectory();
_cacheFilePath = Path.Combine(baseDir, "games_cache.json"); this._cacheFilePath = Path.Combine(baseDir, "games_cache.json");
_bookmarksFilePath = Path.Combine(baseDir, "bookmarks.json"); this._bookmarksFilePath = Path.Combine(baseDir, "bookmarks.json");
} }
/// <summary> /// <summary>
@@ -145,11 +145,11 @@ namespace GameLauncher.Services
var list = new List<GameItemBase>(); var list = new List<GameItemBase>();
// 1. 本アプリのキャッシュが存在すればロード // 1. 本アプリのキャッシュが存在すればロード
if (File.Exists(_cacheFilePath)) if (File.Exists(this._cacheFilePath))
{ {
try try
{ {
string json = File.ReadAllText(_cacheFilePath); string json = File.ReadAllText(this._cacheFilePath);
var entries = JsonSerializer.Deserialize<List<UnifiedGameCacheEntry>>(json); var entries = JsonSerializer.Deserialize<List<UnifiedGameCacheEntry>>(json);
if (entries != null) if (entries != null)
{ {
@@ -451,7 +451,7 @@ namespace GameLauncher.Services
if (imported) if (imported)
{ {
SaveCache(list); this.SaveCache(list);
} }
} }
catch { } catch { }
@@ -460,7 +460,7 @@ namespace GameLauncher.Services
// キャッシュが破棄・再スキャンされても、ブックマークは bookmarks.json から維持されます。 // キャッシュが破棄・再スキャンされても、ブックマークは bookmarks.json から維持されます。
try try
{ {
var bookmarkKeys = LoadBookmarks(); var bookmarkKeys = this.LoadBookmarks();
if (bookmarkKeys.Count > 0) if (bookmarkKeys.Count > 0)
{ {
foreach (var item in list) foreach (var item in list)
@@ -473,7 +473,7 @@ namespace GameLauncher.Services
} }
// フォルダが消えたブックマークを除去し、既存キャッシュからの移行も兼ねて保存し直します。 // フォルダが消えたブックマークを除去し、既存キャッシュからの移行も兼ねて保存し直します。
SaveBookmarks(list); this.SaveBookmarks(list);
} }
catch { } catch { }
@@ -569,7 +569,7 @@ namespace GameLauncher.Services
}; };
string json = JsonSerializer.Serialize(entries, options); string json = JsonSerializer.Serialize(entries, options);
File.WriteAllText(_cacheFilePath, json); File.WriteAllText(this._cacheFilePath, json);
} }
catch { } catch { }
} }
@@ -606,12 +606,12 @@ namespace GameLauncher.Services
try try
{ {
if (!File.Exists(_bookmarksFilePath)) if (!File.Exists(this._bookmarksFilePath))
{ {
return set; return set;
} }
string json = File.ReadAllText(_bookmarksFilePath); string json = File.ReadAllText(this._bookmarksFilePath);
var keys = JsonSerializer.Deserialize<List<string>>(json); var keys = JsonSerializer.Deserialize<List<string>>(json);
if (keys != null) if (keys != null)
{ {
@@ -651,7 +651,7 @@ namespace GameLauncher.Services
}; };
string json = JsonSerializer.Serialize(keys, options); string json = JsonSerializer.Serialize(keys, options);
File.WriteAllText(_bookmarksFilePath, json); File.WriteAllText(this._bookmarksFilePath, json);
} }
catch { } catch { }
} }
@@ -712,7 +712,7 @@ namespace GameLauncher.Services
} }
// セーブデータ有無確認 // セーブデータ有無確認
bool hasSave = CheckHasSaveData(ug); bool hasSave = this.CheckHasSaveData(ug);
if (ug.HasSaveData != hasSave) if (ug.HasSaveData != hasSave)
{ {
ug.HasSaveData = hasSave; ug.HasSaveData = hasSave;
@@ -987,7 +987,7 @@ namespace GameLauncher.Services
if (cacheNeedsSave) if (cacheNeedsSave)
{ {
SaveCache(copyList.Where(g => Directory.Exists(g.RootDirectory))); this.SaveCache(copyList.Where(g => Directory.Exists(g.RootDirectory)));
} }
}, ct); }, ct);
} }
@@ -1017,7 +1017,7 @@ namespace GameLauncher.Services
List<string> subDirs; List<string> subDirs;
try try
{ {
subDirs = Directory.EnumerateDirectories(targetPath).ToList(); subDirs = [.. Directory.EnumerateDirectories(targetPath)];
} }
catch catch
{ {
@@ -1042,7 +1042,7 @@ namespace GameLauncher.Services
if (isExisting) return; if (isExisting) return;
// ディレクトリ直下のゲームを検出 // ディレクトリ直下のゲームを検出
var game = DetectGameInDirectory(dir); var game = this.DetectGameInDirectory(dir);
if (game != null) if (game != null)
{ {
lock (existingPaths) lock (existingPaths)
@@ -1068,7 +1068,7 @@ namespace GameLauncher.Services
} }
if (isChildExisting) continue; if (isChildExisting) continue;
var childGame = DetectGameInDirectory(childDir); var childGame = this.DetectGameInDirectory(childDir);
if (childGame != null) if (childGame != null)
{ {
lock (existingPaths) lock (existingPaths)
@@ -1105,21 +1105,21 @@ namespace GameLauncher.Services
// 後段のティラノ判定が誤反応してUnityがティラノ扱いになるため、 // 後段のティラノ判定が誤反応してUnityがティラノ扱いになるため、
// 信頼性の高いUnity証拠(UnityPlayer.dll / *_Data\globalgamemanagers 等)を // 信頼性の高いUnity証拠(UnityPlayer.dll / *_Data\globalgamemanagers 等)を
// 最優先で評価し、他エンジン判定より先に確定させる。 // 最優先で評価し、他エンジン判定より先に確定させる。
var unityGame = DetectUnityGameInDirectory(dirPath); var unityGame = this.DetectUnityGameInDirectory(dirPath);
if (unityGame != null) if (unityGame != null)
{ {
return unityGame; return unityGame;
} }
// 2. 次にツクール/ティラノ判定 // 2. 次にツクール/ティラノ判定
var tkoolGame = DetectTkoolGameInDirectory(dirPath); var tkoolGame = this.DetectTkoolGameInDirectory(dirPath);
if (tkoolGame != null) if (tkoolGame != null)
{ {
return tkoolGame; return tkoolGame;
} }
// 3. どの特定エンジンにも該当しない場合は「その他」ゲーム判定 // 3. どの特定エンジンにも該当しない場合は「その他」ゲーム判定
var otherGame = DetectOtherGameInDirectory(dirPath); var otherGame = this.DetectOtherGameInDirectory(dirPath);
if (otherGame != null) if (otherGame != null)
{ {
return otherGame; return otherGame;
@@ -1240,7 +1240,7 @@ namespace GameLauncher.Services
var canApplyMod = false; var canApplyMod = false;
if (isExtracted && evbOutDir != null) if (isExtracted && evbOutDir != null)
{ {
var pluginsJs = FindPluginsJs(evbOutDir, maxDepth: 2); var pluginsJs = this.FindPluginsJs(evbOutDir, maxDepth: 2);
if (!string.IsNullOrEmpty(pluginsJs) && File.Exists(pluginsJs)) if (!string.IsNullOrEmpty(pluginsJs) && File.Exists(pluginsJs))
{ {
pluginsJsPath = pluginsJs; pluginsJsPath = pluginsJs;
@@ -1315,22 +1315,22 @@ namespace GameLauncher.Services
// 0. Enigma Virtual Box (EVB) パック済みゲームの検出(最優先・前段)。 // 0. Enigma Virtual Box (EVB) パック済みゲームの検出(最優先・前段)。
// EVB は汎用パッカーで、内部にどのエンジンのゲームでも包めるため、 // EVB は汎用パッカーで、内部にどのエンジンのゲームでも包めるため、
// 他エンジン判定より前に評価し、Evb 用の情報(本来エンジン等)を付与する。 // 他エンジン判定より前に評価し、Evb 用の情報(本来エンジン等)を付与する。
var evbGame = DetectEvbGameInDirectory(dirPath, folderName, folderModified); var evbGame = this.DetectEvbGameInDirectory(dirPath, folderName, folderModified);
if (evbGame != null) if (evbGame != null)
{ {
return evbGame; return evbGame;
} }
// 1. 通常の plugins.js 探索 // 1. 通常の plugins.js 探索
var pluginsJs = FindPluginsJs(dirPath, maxDepth: 2); var pluginsJs = this.FindPluginsJs(dirPath, maxDepth: 2);
if (pluginsJs != null) if (pluginsJs != null)
{ {
var pluginsDir = Path.Combine(Path.GetDirectoryName(pluginsJs)!, "plugins"); var pluginsDir = Path.Combine(Path.GetDirectoryName(pluginsJs)!, "plugins");
var jsDir = Path.GetDirectoryName(pluginsJs)!; var jsDir = Path.GetDirectoryName(pluginsJs)!;
var engineType = DetectEngineType(jsDir); var engineType = this.DetectEngineType(jsDir);
var title = ExtractTkoolTitle(dirPath, jsDir); var title = this.ExtractTkoolTitle(dirPath, jsDir);
var exePath = FindTkoolExecutable(dirPath, jsDir); var exePath = this.FindTkoolExecutable(dirPath, jsDir);
var icon = LoadIcon(exePath, dirPath); var icon = LoadIcon(exePath, dirPath);
var isModded = TkoolModService.CheckIsModded(pluginsJs); var isModded = TkoolModService.CheckIsModded(pluginsJs);
@@ -1357,24 +1357,24 @@ namespace GameLauncher.Services
} }
// 2. boxed(nw.js埋め込み: *boxed*.exe + 埋め込みpackage.nw または on-disk www\)のツクール探索 // 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) if (boxedGame != null)
{ {
return boxedGame; return boxedGame;
} }
// 3. FOSSIL単体exe同梱のツクールMZ探索 (js/plugins.jsがexe内に埋め込まれている形態) // 3. FOSSIL単体exe同梱のツクールMZ探索 (js/plugins.jsがexe内に埋め込まれている形態)
var fossilMzGame = DetectFossilMZGameInDirectory(dirPath, folderName, folderModified); var fossilMzGame = this.DetectFossilMZGameInDirectory(dirPath, folderName, folderModified);
if (fossilMzGame != null) if (fossilMzGame != null)
{ {
return fossilMzGame; return fossilMzGame;
} }
// 3. 通常のティラノスクリプト探索 // 3. 通常のティラノスクリプト探索
var tyranoIndex = FindTyranoIndexHtml(dirPath); var tyranoIndex = this.FindTyranoIndexHtml(dirPath);
if (tyranoIndex != null) if (tyranoIndex != null)
{ {
var exePath = FindTkoolExecutable(dirPath, Path.GetDirectoryName(tyranoIndex)!); var exePath = this.FindTkoolExecutable(dirPath, Path.GetDirectoryName(tyranoIndex)!);
var icon = LoadIcon(exePath, dirPath); var icon = LoadIcon(exePath, dirPath);
var isModded = TyranoModService.CheckIsModded(tyranoIndex); var isModded = TyranoModService.CheckIsModded(tyranoIndex);
bool isAsarPkg = AsarArchiveService.FindAsarPackage(dirPath, out var aPath, out bool isExt, out var extDir); bool isAsarPkg = AsarArchiveService.FindAsarPackage(dirPath, out var aPath, out bool isExt, out var extDir);
@@ -1403,14 +1403,14 @@ namespace GameLauncher.Services
// 4. app.asar パッケージであるか判定 // 4. app.asar パッケージであるか判定
if (AsarArchiveService.FindAsarPackage(dirPath, out var asarPath, out bool isExtracted, out var extractedDirPath)) 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)) if (inspect.IsValid && (inspect.IsTkoolGame || inspect.IsTyranoGame))
{ {
var relJs = inspect.RelativePluginsJsPath ?? (inspect.IsTyranoGame ? "index.html" : "project/js/plugins.js"); var relJs = inspect.RelativePluginsJsPath ?? (inspect.IsTyranoGame ? "index.html" : "project/js/plugins.js");
var plannedJsPath = Path.Combine(extractedDirPath!, relJs.Replace('/', Path.DirectorySeparatorChar)); var plannedJsPath = Path.Combine(extractedDirPath!, relJs.Replace('/', Path.DirectorySeparatorChar));
var plannedPluginsDir = Path.Combine(Path.GetDirectoryName(plannedJsPath)!, "plugins"); 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); var icon = LoadIcon(exePath, dirPath);
bool isModded = false; bool isModded = false;
@@ -1446,21 +1446,21 @@ namespace GameLauncher.Services
} }
// 5. WOLF RPGエディター(ウディタ)ゲームの検出 // 5. WOLF RPGエディター(ウディタ)ゲームの検出
var wolfGame = DetectWolfGameInDirectory(dirPath, folderName, folderModified); var wolfGame = this.DetectWolfGameInDirectory(dirPath, folderName, folderModified);
if (wolfGame != null) if (wolfGame != null)
{ {
return wolfGame; return wolfGame;
} }
// 6. SRPG Studio ゲームの検出 // 6. SRPG Studio ゲームの検出
var srpgGame = DetectSrpgGameInDirectory(dirPath, folderName, folderModified); var srpgGame = this.DetectSrpgGameInDirectory(dirPath, folderName, folderModified);
if (srpgGame != null) if (srpgGame != null)
{ {
return srpgGame; return srpgGame;
} }
// 7. ツクールVX / VX Ace (RGSS2 / RGSS3) ゲームの検出 // 7. ツクールVX / VX Ace (RGSS2 / RGSS3) ゲームの検出
var rgssGame = DetectRgssGameInDirectory(dirPath, folderName, folderModified); var rgssGame = this.DetectRgssGameInDirectory(dirPath, folderName, folderModified);
if (rgssGame != null) if (rgssGame != null)
{ {
return rgssGame; return rgssGame;
@@ -1634,12 +1634,12 @@ namespace GameLauncher.Services
long size = fs.Length; long size = fs.Length;
// package.nw マーカーは exe の中間域に置かれることが多いため、中央付近から数点だけ走査する // package.nw マーカーは exe の中間域に置かれることが多いため、中央付近から数点だけ走査する
long[] probes = new[] long[] probes =
{ [
Math.Max(0, size / 2 - windowSize / 2), Math.Max(0, size / 2 - windowSize / 2),
Math.Max(0, size / 4), Math.Max(0, size / 4),
Math.Max(0, size * 3 / 4), Math.Max(0, size * 3 / 4),
}; ];
foreach (var start in probes) foreach (var start in probes)
{ {
@@ -1699,7 +1699,7 @@ namespace GameLauncher.Services
var dataDir = Path.Combine(dirPath, "data"); var dataDir = Path.Combine(dirPath, "data");
var engine = DetectEngineTypeByDataJson(dirPath); var engine = DetectEngineTypeByDataJson(dirPath);
var title = ExtractTkoolTitle(dirPath, dataDir); var title = this.ExtractTkoolTitle(dirPath, dataDir);
var icon = LoadIcon(boxedExe, dirPath); var icon = LoadIcon(boxedExe, dirPath);
return new TkoolGameItem return new TkoolGameItem
@@ -1769,7 +1769,7 @@ namespace GameLauncher.Services
return false; 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) foreach (var frac in fractions)
{ {
long start = (long)(size * frac); long start = (long)(size * frac);
@@ -1888,7 +1888,7 @@ namespace GameLauncher.Services
var trim = line.Trim(); var trim = line.Trim();
if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase)) if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase))
{ {
var val = trim.Substring(6).Trim(); var val = trim[6..].Trim();
if (!string.IsNullOrWhiteSpace(val)) if (!string.IsNullOrWhiteSpace(val))
{ {
title = val; title = val;
@@ -2082,7 +2082,7 @@ namespace GameLauncher.Services
var trim = line.Trim(); var trim = line.Trim();
if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase)) if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase))
{ {
var val = trim.Substring(6).Trim(); var val = trim[6..].Trim();
if (!string.IsNullOrWhiteSpace(val)) if (!string.IsNullOrWhiteSpace(val))
{ {
title = val; title = val;
@@ -2284,12 +2284,12 @@ namespace GameLauncher.Services
} }
else if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase)) else if (trim.StartsWith("Title=", StringComparison.OrdinalIgnoreCase))
{ {
var val = trim.Substring(6).Trim(); var val = trim[6..].Trim();
if (!string.IsNullOrEmpty(val)) title = val; if (!string.IsNullOrEmpty(val)) title = val;
} }
else if (trim.StartsWith("RTP=", StringComparison.OrdinalIgnoreCase)) else if (trim.StartsWith("RTP=", StringComparison.OrdinalIgnoreCase))
{ {
var val = trim.Substring(4).Trim(); var val = trim[4..].Trim();
if (val.Contains("RPGVXAce", StringComparison.OrdinalIgnoreCase)) if (val.Contains("RPGVXAce", StringComparison.OrdinalIgnoreCase))
{ {
engineType = TkoolEngineType.VXAce; engineType = TkoolEngineType.VXAce;
@@ -2303,7 +2303,7 @@ namespace GameLauncher.Services
} }
else if (trim.StartsWith("Library=", StringComparison.OrdinalIgnoreCase)) else if (trim.StartsWith("Library=", StringComparison.OrdinalIgnoreCase))
{ {
var val = trim.Substring(8).Trim(); var val = trim[8..].Trim();
if (val.Contains("RGSS3", StringComparison.OrdinalIgnoreCase)) if (val.Contains("RGSS3", StringComparison.OrdinalIgnoreCase))
{ {
engineType = TkoolEngineType.VXAce; engineType = TkoolEngineType.VXAce;
@@ -2321,7 +2321,7 @@ namespace GameLauncher.Services
} }
else if (trim.StartsWith("Scripts=", StringComparison.OrdinalIgnoreCase)) else if (trim.StartsWith("Scripts=", StringComparison.OrdinalIgnoreCase))
{ {
var val = trim.Substring(8).Trim(); var val = trim[8..].Trim();
if (val.EndsWith(".rvdata2", StringComparison.OrdinalIgnoreCase)) if (val.EndsWith(".rvdata2", StringComparison.OrdinalIgnoreCase))
{ {
engineType = TkoolEngineType.VXAce; engineType = TkoolEngineType.VXAce;
@@ -2346,8 +2346,8 @@ namespace GameLauncher.Services
} }
// アーカイブファイルの探索 // アーカイブファイルの探索
var rgss3aFiles = Directory.Exists(searchDir) ? Directory.GetFiles(searchDir, "*.rgss3a", SearchOption.TopDirectoryOnly) : Array.Empty<string>(); var rgss3aFiles = Directory.Exists(searchDir) ? Directory.GetFiles(searchDir, "*.rgss3a", SearchOption.TopDirectoryOnly) : [];
var rgss2aFiles = Directory.Exists(searchDir) ? Directory.GetFiles(searchDir, "*.rgss2a", SearchOption.TopDirectoryOnly) : Array.Empty<string>(); var rgss2aFiles = Directory.Exists(searchDir) ? Directory.GetFiles(searchDir, "*.rgss2a", SearchOption.TopDirectoryOnly) : [];
if (rgss3aFiles.Length > 0) if (rgss3aFiles.Length > 0)
{ {
@@ -2475,7 +2475,7 @@ namespace GameLauncher.Services
continue; continue;
} }
var result = FindPluginsJs(dir, maxDepth, currentDepth + 1); var result = this.FindPluginsJs(dir, maxDepth, currentDepth + 1);
if (result != null) return result; if (result != null) return result;
} }
} }
@@ -2489,14 +2489,14 @@ namespace GameLauncher.Services
try try
{ {
var directIndex = Path.Combine(dirPath, "index.html"); var directIndex = Path.Combine(dirPath, "index.html");
if (File.Exists(directIndex) && CheckIsTyranoDirectory(dirPath)) if (File.Exists(directIndex) && this.CheckIsTyranoDirectory(dirPath))
{ {
return directIndex; return directIndex;
} }
// FOSSILで梱包されたティラノスクリプトは index.html が FOSSILindex.html にリネームされる // FOSSILで梱包されたティラノスクリプトは index.html が FOSSILindex.html にリネームされる
var directFossilIndex = Path.Combine(dirPath, "FOSSILindex.html"); var directFossilIndex = Path.Combine(dirPath, "FOSSILindex.html");
if (File.Exists(directFossilIndex) && CheckIsTyranoDirectory(dirPath)) if (File.Exists(directFossilIndex) && this.CheckIsTyranoDirectory(dirPath))
{ {
return directFossilIndex; return directFossilIndex;
} }
@@ -2511,13 +2511,13 @@ namespace GameLauncher.Services
continue; continue;
var subIndex = Path.Combine(sub, "index.html"); var subIndex = Path.Combine(sub, "index.html");
if (File.Exists(subIndex) && CheckIsTyranoDirectory(sub)) if (File.Exists(subIndex) && this.CheckIsTyranoDirectory(sub))
{ {
return subIndex; return subIndex;
} }
var subFossilIndex = Path.Combine(sub, "FOSSILindex.html"); var subFossilIndex = Path.Combine(sub, "FOSSILindex.html");
if (File.Exists(subFossilIndex) && CheckIsTyranoDirectory(sub)) if (File.Exists(subFossilIndex) && this.CheckIsTyranoDirectory(sub))
{ {
return subFossilIndex; return subFossilIndex;
} }
@@ -2732,7 +2732,7 @@ namespace GameLauncher.Services
} }
// 3. 実行可能ファイル(.exe)の探索 // 3. 実行可能ファイル(.exe)の探索
var exePath = FindUnityExecutable(dirPath, dataDir); var exePath = this.FindUnityExecutable(dirPath, dataDir);
if (exePath == null) if (exePath == null)
{ {
return null; return null;
@@ -2753,14 +2753,14 @@ namespace GameLauncher.Services
} }
// 5. バックエンド(IL2CPP / Mono)の判定 // 5. バックエンド(IL2CPP / Mono)の判定
var backend = DetectUnityBackendType(dirPath, dataDir); var backend = this.DetectUnityBackendType(dirPath, dataDir);
// 6. Unityバージョンの取得 // 6. Unityバージョンの取得
var unityVersion = DetectUnityVersion(dirPath, dataDir, unityPlayerDll); var unityVersion = this.DetectUnityVersion(dirPath, dataDir, unityPlayerDll);
// 7. タイトルの決定 // 7. タイトルの決定
var folderName = Path.GetFileName(dirPath.TrimEnd('\\', '/')); var folderName = Path.GetFileName(dirPath.TrimEnd('\\', '/'));
var title = DetermineUnityTitle(dirPath, exePath, productName, folderName); var title = this.DetermineUnityTitle(dirPath, exePath, productName, folderName);
// 8. アイコン読み込み // 8. アイコン読み込み
var icon = LoadIcon(exePath, dirPath); var icon = LoadIcon(exePath, dirPath);
@@ -2784,7 +2784,7 @@ namespace GameLauncher.Services
FolderLastModified = folderModified FolderLastModified = folderModified
}; };
game.HasSaveData = CheckHasSaveData(game); game.HasSaveData = this.CheckHasSaveData(game);
return game; return game;
} }
+2 -2
View File
@@ -67,12 +67,12 @@ namespace GameLauncher.Services
catch (Exception ex) catch (Exception ex)
{ {
// 外部ツール起動失敗時は内蔵方式にフォールバック // 外部ツール起動失敗時は内蔵方式にフォールバック
var (ok, msg) = await ApplyBuiltInResizeAsync(process); var (ok, msg) = await this.ApplyBuiltInResizeAsync(process);
return (ok, $"外部ツール起動に失敗したため内蔵方式を使用: {ex.Message} / {msg}"); return (ok, $"外部ツール起動に失敗したため内蔵方式を使用: {ex.Message} / {msg}");
} }
} }
return await ApplyBuiltInResizeAsync(process); return await this.ApplyBuiltInResizeAsync(process);
} }
/// <summary> /// <summary>
+63 -63
View File
@@ -27,15 +27,15 @@ namespace GameLauncher
public WolfSaveEditorDialog(TkoolGameItem game, WolfSaveService saveService) public WolfSaveEditorDialog(TkoolGameItem game, WolfSaveService saveService)
{ {
InitializeComponent(); this.InitializeComponent();
_game = game; this._game = game;
_saveService = saveService; this._saveService = saveService;
lblGameTitle.Text = _game.Title; this.lblGameTitle.Text = this._game.Title;
lblGamePath.Text = _game.RootDirectory; this.lblGamePath.Text = this._game.RootDirectory;
txtInfoBackupDir.Text = AppPathHelper.GetGameBackupDirectory(_game.FolderName, _game.RootDirectory); this.txtInfoBackupDir.Text = AppPathHelper.GetGameBackupDirectory(this._game.FolderName, this._game.RootDirectory);
LoadSaveFileList(); this.LoadSaveFileList();
} }
/// <summary> /// <summary>
@@ -45,36 +45,36 @@ namespace GameLauncher
{ {
try try
{ {
var files = _saveService.GetSaveFiles(_game.RootDirectory); var files = this._saveService.GetSaveFiles(this._game.RootDirectory);
cboSaveFiles.Items.Clear(); this.cboSaveFiles.Items.Clear();
foreach (var f in files) 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 else
{ {
lblStatus.Text = "セーブデータ(*.sav)が見つかりませんでした。"; this.lblStatus.Text = "セーブデータ(*.sav)が見つかりませんでした。";
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
lblStatus.Text = $"セーブファイル列挙エラー: {ex.Message}"; this.lblStatus.Text = $"セーブファイル列挙エラー: {ex.Message}";
} }
} }
private void cboSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e) private void cboSaveFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
if (cboSaveFiles.SelectedItem == null) return; if (this.cboSaveFiles.SelectedItem == null) return;
var fileName = cboSaveFiles.SelectedItem.ToString(); var fileName = this.cboSaveFiles.SelectedItem.ToString();
if (string.IsNullOrEmpty(fileName)) return; if (string.IsNullOrEmpty(fileName)) return;
LoadSaveFile(fileName); this.LoadSaveFile(fileName);
} }
/// <summary> /// <summary>
@@ -84,46 +84,46 @@ namespace GameLauncher
{ {
try 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)); var fullPath = files.FirstOrDefault(f => string.Equals(Path.GetFileName(f), fileName, StringComparison.OrdinalIgnoreCase));
if (string.IsNullOrEmpty(fullPath) || !File.Exists(fullPath)) if (string.IsNullOrEmpty(fullPath) || !File.Exists(fullPath))
{ {
lblStatus.Text = $"ファイルが存在しません: {fileName}"; this.lblStatus.Text = $"ファイルが存在しません: {fileName}";
return; return;
} }
_currentSaveData = _saveService.LoadSave(fullPath); this._currentSaveData = this._saveService.LoadSave(fullPath);
_allVariables = [.. _currentSaveData.Variables]; this._allVariables = [.. this._currentSaveData.Variables];
_allStrings = [.. _currentSaveData.Strings]; this._allStrings = [.. this._currentSaveData.Strings];
// メタ情報表示 // メタ情報表示
txtInfoTitle.Text = string.IsNullOrEmpty(_currentSaveData.GameTitle) ? "(不明)" : _currentSaveData.GameTitle; this.txtInfoTitle.Text = string.IsNullOrEmpty(this._currentSaveData.GameTitle) ? "(不明)" : this._currentSaveData.GameTitle;
txtInfoVersion.Text = $"0x{_currentSaveData.FileVersion:X4}"; this.txtInfoVersion.Text = $"0x{this._currentSaveData.FileVersion:X4}";
txtInfoEncoding.Text = _currentSaveData.IsUtf8 ? "UTF-8" : "Shift-JIS (CP932)"; this.txtInfoEncoding.Text = this._currentSaveData.IsUtf8 ? "UTF-8" : "Shift-JIS (CP932)";
txtInfoSize.Text = $"{_currentSaveData.RawDecryptedBytes.Length:N0} バイト"; this.txtInfoSize.Text = $"{this._currentSaveData.RawDecryptedBytes.Length:N0} バイト";
ApplyFilter(); this.ApplyFilter();
lblStatus.Text = $"'{fileName}' を正常に読み込みました。"; this.lblStatus.Text = $"'{fileName}' を正常に読み込みました。";
lblSaveCount.Text = $"変数項目: {_allVariables.Count}件, 文字列項目: {_allStrings.Count}件"; this.lblSaveCount.Text = $"変数項目: {this._allVariables.Count}件, 文字列項目: {this._allStrings.Count}件";
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show($"セーブデータの読み込みに失敗しました:\n{ex.Message}", "読み込みエラー", MessageBoxButton.OK, MessageBoxImage.Error); 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) 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 else
{ {
LoadSaveFileList(); this.LoadSaveFileList();
} }
} }
@@ -132,23 +132,23 @@ namespace GameLauncher
/// </summary> /// </summary>
private void ApplyFilter() private void ApplyFilter()
{ {
var filter = txtFilter.Text?.Trim() ?? string.Empty; var filter = this.txtFilter.Text?.Trim() ?? string.Empty;
if (string.IsNullOrEmpty(filter)) if (string.IsNullOrEmpty(filter))
{ {
dgVariables.ItemsSource = _allVariables; this.dgVariables.ItemsSource = this._allVariables;
dgStrings.ItemsSource = _allStrings; this.dgStrings.ItemsSource = this._allStrings;
} }
else else
{ {
dgVariables.ItemsSource = _allVariables this.dgVariables.ItemsSource = this._allVariables
.Where(v => v.DisplayName.Contains(filter, StringComparison.OrdinalIgnoreCase) || .Where(v => v.DisplayName.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
v.Category.Contains(filter, StringComparison.OrdinalIgnoreCase) || v.Category.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
v.Value.ToString().Contains(filter, StringComparison.OrdinalIgnoreCase) || v.Value.ToString().Contains(filter, StringComparison.OrdinalIgnoreCase) ||
v.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase)) v.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase))
.ToList(); .ToList();
dgStrings.ItemsSource = _allStrings this.dgStrings.ItemsSource = this._allStrings
.Where(s => s.Value.Contains(filter, StringComparison.OrdinalIgnoreCase) || .Where(s => s.Value.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
s.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase)) s.Offset.ToString("X").Contains(filter, StringComparison.OrdinalIgnoreCase))
.ToList(); .ToList();
@@ -157,7 +157,7 @@ namespace GameLauncher
private void txtFilter_TextChanged(object sender, TextChangedEventArgs e) private void txtFilter_TextChanged(object sender, TextChangedEventArgs e)
{ {
ApplyFilter(); this.ApplyFilter();
} }
/// <summary> /// <summary>
@@ -165,21 +165,21 @@ namespace GameLauncher
/// </summary> /// </summary>
private void btnSearchValue_Click(object sender, RoutedEventArgs e) 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); MessageBox.Show("検索する数値を半角数字で入力してください。(例: 現在の所持金やステータス)", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Information);
return; return;
} }
var matches = _allVariables.Where(v => v.Value == target).ToList(); var matches = this._allVariables.Where(v => v.Value == target).ToList();
if (matches.Count == 0) if (matches.Count == 0)
{ {
MessageBox.Show($"値が {target:N0} と一致する変数が見つかりませんでした。", "検索結果", MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show($"値が {target:N0} と一致する変数が見つかりませんでした。", "検索結果", MessageBoxButton.OK, MessageBoxImage.Information);
return; return;
} }
dgVariables.ItemsSource = matches; this.dgVariables.ItemsSource = matches;
lblStatus.Text = $"値 {target:N0} に一致する候補が {matches.Count} 件見つかりました。"; this.lblStatus.Text = $"値 {target:N0} に一致する候補が {matches.Count} 件見つかりました。";
} }
/// <summary> /// <summary>
@@ -187,7 +187,7 @@ namespace GameLauncher
/// </summary> /// </summary>
private void btnSetMaxTarget_Click(object sender, RoutedEventArgs e) private void btnSetMaxTarget_Click(object sender, RoutedEventArgs e)
{ {
if (dgVariables.ItemsSource is not IEnumerable<WolfVariableItem> currentList) return; if (this.dgVariables.ItemsSource is not IEnumerable<WolfVariableItem> currentList) return;
var list = currentList.ToList(); var list = currentList.ToList();
if (list.Count == 0) return; if (list.Count == 0) return;
@@ -201,8 +201,8 @@ namespace GameLauncher
{ {
item.Value = 9999999; item.Value = 9999999;
} }
dgVariables.Items.Refresh(); this.dgVariables.Items.Refresh();
lblStatus.Text = $"{list.Count} 件の値を 9,999,999 に変更しました。保存ボタンを押すと反映されます。"; this.lblStatus.Text = $"{list.Count} 件の値を 9,999,999 に変更しました。保存ボタンを押すと反映されます。";
} }
} }
@@ -214,14 +214,14 @@ namespace GameLauncher
if (sender is Button btn && btn.Tag is WolfVariableItem item) if (sender is Button btn && btn.Tag is WolfVariableItem item)
{ {
item.Value = 9999999; item.Value = 9999999;
dgVariables.Items.Refresh(); this.dgVariables.Items.Refresh();
lblStatus.Text = $"{item.DisplayName} の値を 9,999,999 に設定しました。"; this.lblStatus.Text = $"{item.DisplayName} の値を 9,999,999 に設定しました。";
} }
} }
private void dgVariables_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) private void dgVariables_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{ {
lblStatus.Text = "値を編集しました。「上書き保存」を押すとバックアップを作成して保存されます。"; this.lblStatus.Text = "値を編集しました。「上書き保存」を押すとバックアップを作成して保存されます。";
} }
/// <summary> /// <summary>
@@ -229,7 +229,7 @@ namespace GameLauncher
/// </summary> /// </summary>
private void btnSave_Click(object sender, RoutedEventArgs e) private void btnSave_Click(object sender, RoutedEventArgs e)
{ {
if (_currentSaveData == null) if (this._currentSaveData == null)
{ {
MessageBox.Show("保存対象のセーブデータがありません。", "エラー", MessageBoxButton.OK, MessageBoxImage.Warning); MessageBox.Show("保存対象のセーブデータがありません。", "エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
return; return;
@@ -238,19 +238,19 @@ namespace GameLauncher
try 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); MessageBox.Show(msg, "保存完了", MessageBoxButton.OK, MessageBoxImage.Information);
lblStatus.Text = $"保存完了 (バックアップ: {Path.GetFileName(backupPath)})"; this.lblStatus.Text = $"保存完了 (バックアップ: {Path.GetFileName(backupPath)})";
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show($"保存中にエラーが発生しました:\n{ex.Message}", "保存エラー", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show($"保存中にエラーが発生しました:\n{ex.Message}", "保存エラー", MessageBoxButton.OK, MessageBoxImage.Error);
lblStatus.Text = $"保存エラー: {ex.Message}"; this.lblStatus.Text = $"保存エラー: {ex.Message}";
} }
} }
@@ -259,20 +259,20 @@ namespace GameLauncher
/// </summary> /// </summary>
private void btnExportJson_Click(object sender, RoutedEventArgs e) private void btnExportJson_Click(object sender, RoutedEventArgs e)
{ {
if (_currentSaveData == null) return; if (this._currentSaveData == null) return;
var sfd = new SaveFileDialog var sfd = new SaveFileDialog
{ {
Title = "セーブデータを JSON としてエクスポート", Title = "セーブデータを JSON としてエクスポート",
Filter = "JSON ファイル (*.json)|*.json", Filter = "JSON ファイル (*.json)|*.json",
FileName = $"{Path.GetFileNameWithoutExtension(_currentSaveData.FileName)}_export.json" FileName = $"{Path.GetFileNameWithoutExtension(this._currentSaveData.FileName)}_export.json"
}; };
if (sfd.ShowDialog() == true) if (sfd.ShowDialog() == true)
{ {
try try
{ {
_saveService.ExportToJson(_currentSaveData, sfd.FileName); this._saveService.ExportToJson(this._currentSaveData, sfd.FileName);
MessageBox.Show($"JSON ファイルをエクスポートしました:\n{sfd.FileName}", "エクスポート完了", MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show($"JSON ファイルをエクスポートしました:\n{sfd.FileName}", "エクスポート完了", MessageBoxButton.OK, MessageBoxImage.Information);
} }
catch (Exception ex) catch (Exception ex)
@@ -287,7 +287,7 @@ namespace GameLauncher
/// </summary> /// </summary>
private void btnImportJson_Click(object sender, RoutedEventArgs e) private void btnImportJson_Click(object sender, RoutedEventArgs e)
{ {
if (_currentSaveData == null) return; if (this._currentSaveData == null) return;
var ofd = new OpenFileDialog var ofd = new OpenFileDialog
{ {
@@ -299,9 +299,9 @@ namespace GameLauncher
{ {
try try
{ {
_saveService.ImportFromJson(_currentSaveData, ofd.FileName); this._saveService.ImportFromJson(this._currentSaveData, ofd.FileName);
_allVariables = [.. _currentSaveData.Variables]; this._allVariables = [.. this._currentSaveData.Variables];
ApplyFilter(); this.ApplyFilter();
MessageBox.Show("JSON データを正常に取り込みました。「上書き保存」を押すとファイルへ反映されます。", "インポート完了", MessageBoxButton.OK, MessageBoxImage.Information); MessageBox.Show("JSON データを正常に取り込みました。「上書き保存」を押すとファイルへ反映されます。", "インポート完了", MessageBoxButton.OK, MessageBoxImage.Information);
} }
catch (Exception ex) catch (Exception ex)
@@ -318,7 +318,7 @@ namespace GameLauncher
{ {
try try
{ {
var dir = AppPathHelper.GetGameBackupDirectory(_game.FolderName, _game.RootDirectory); var dir = AppPathHelper.GetGameBackupDirectory(this._game.FolderName, this._game.RootDirectory);
if (!Directory.Exists(dir)) if (!Directory.Exists(dir))
{ {
Directory.CreateDirectory(dir); Directory.CreateDirectory(dir);