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