refactor: reorganize engine-based structure and add agent rules

- Engines/ 配下へエンジン別に再編 (Common/Rgss/Tkool/Tyrano/Wolf/Unity/Nwjs)
- ゲーム個別処理を Engines/<Engine>/Games/<GameName>/ へ分離し、共通処理から明示呼び出し
- 外部ツールを Engines/<Engine>/Tools/ へ移動し、AppPathHelper 経由で解決
- 旧 Tools/ 直下参照と不要な参照ファイル/バックアップを削除
- エージェント規則 AGENTS.md を追加し、README から参照
- publish.ps1 を Engines/<Engine>/Tools/ の再帰配置に対応
This commit is contained in:
armonica committed 2026-10-07 02:30:49 +09:00
1 parent 0d11039ee9
commit 8cea2a147d
47 files changed
+2976 -176

No files matched your search

+177
View File
@@ -0,0 +1,177 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using GameLauncher.Models;
namespace GameLauncher.Engines.Unity
{
/// <summary>
/// PlayerPrefs(レジストリ)の1エントリを表すモデル
/// </summary>
public class PlayerPrefsEntry : INotifyPropertyChanged
{
private string _rawKey = string.Empty;
private string _cleanKey = string.Empty;
private PlayerPrefsType _type = PlayerPrefsType.Int;
private object? _value;
private string _editValue = string.Empty;
private bool _isModified;
public event PropertyChangedEventHandler? PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
/// <summary>レジストリの生キー名(例: ClearedLevel_h1378399435)</summary>
public string RawKey
{
get => _rawKey;
set { if (_rawKey != value) { _rawKey = value; OnPropertyChanged(); } }
}
/// <summary>Unityのハッシュを除去した整形式キー名(例: ClearedLevel)</summary>
public string CleanKey
{
get => _cleanKey;
set { if (_cleanKey != value) { _cleanKey = value; OnPropertyChanged(); } }
}
/// <summary>値のデータ型</summary>
public PlayerPrefsType Type
{
get => _type;
set { if (_type != value) { _type = value; OnPropertyChanged(); OnPropertyChanged(nameof(TypeDisplay)); } }
}
/// <summary>実際の値(int, float, string, byte[])</summary>
public object? Value
{
get => _value;
set
{
if (!Equals(_value, value))
{
_value = value;
OnPropertyChanged();
UpdateEditValue();
}
}
}
/// <summary>UI表示・編集用の文字列値</summary>
public string EditValue
{
get => _editValue;
set
{
if (_editValue != value)
{
_editValue = value;
_isModified = true;
OnPropertyChanged();
OnPropertyChanged(nameof(IsModified));
}
}
}
/// <summary>値が変更されたかどうか</summary>
public bool IsModified
{
get => _isModified;
set { if (_isModified != value) { _isModified = value; OnPropertyChanged(); } }
}
public string TypeDisplay => Type switch
{
PlayerPrefsType.Int => "Int (数値)",
PlayerPrefsType.Float => "Float (小数)",
PlayerPrefsType.String => "String (文字列)",
PlayerPrefsType.Binary => "Binary (バイナリ)",
_ => "Unknown"
};
private void UpdateEditValue()
{
if (_value == null)
{
_editValue = string.Empty;
}
else if (_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;
return;
}
}
catch { }
if (bytes.Length == 4)
{
float f = BitConverter.ToSingle(bytes, 0);
if (!float.IsNaN(f) && !float.IsInfinity(f))
{
_editValue = f.ToString("G");
_type = PlayerPrefsType.Float;
return;
}
}
_editValue = BitConverter.ToString(bytes).Replace("-", " ");
}
else
{
_editValue = _value.ToString() ?? string.Empty;
}
_isModified = false;
OnPropertyChanged(nameof(EditValue));
OnPropertyChanged(nameof(IsModified));
}
}
/// <summary>
/// ディスク上のセーブファイル(LocalLow または ゲームフォルダ内)を表すモデル
/// </summary>
public class SaveFileEntry
{
public string FileName { get; set; } = string.Empty;
public string FilePath { get; set; } = string.Empty;
public long FileSize { get; set; }
public DateTime LastModified { get; set; }
public string LocationType { get; set; } = string.Empty; // "LocalLow" または "ゲームフォルダ"
public bool IsTextOrJson { get; set; }
public string FileSizeDisplay
{
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";
}
}
public string LastModifiedDisplay => LastModified.ToString("yyyy/MM/dd HH:mm:ss");
}
/// <summary>
/// セーブデータのバックアップ履歴モデル
/// </summary>
public class SaveBackupEntry
{
public string Name { get; set; } = string.Empty;
public string BackupPath { get; set; } = string.Empty;
public DateTime Timestamp { get; set; }
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");
}
}