スタイル: コーディング規約に準拠したコードフォーマットの適用(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
+1362 -1380

No files matched your search

+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);
}
}
}