feat: ツクールVX/VX Ace改造対応、Backupsフォルダ統一、全エンジンの種類別一覧表示タブの実装

This commit is contained in:
armonica committed 2026-10-04 19:28:36 +09:00
1 parent 7ac4dbc825
commit bc5ba43ce7
14 files changed
+2157 -130

No files matched your search

+31 -8
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using GameLauncher.Helpers;
using GameLauncher.Models;
namespace GameLauncher.Services
@@ -69,15 +70,24 @@ namespace GameLauncher.Services
try
{
var dir = Path.GetDirectoryName(indexPath)!;
var backupPath = indexPath + IndexBackupSuffix;
var gameBackupDir = AppPathHelper.GetGameBackupDirectory(game.FolderName, game.RootDirectory);
var backupPath = Path.Combine(gameBackupDir, "index.html" + IndexBackupSuffix);
var legacyBackupPath = indexPath + IndexBackupSuffix;
// 1. バックアップの作成(存在しない場合)
// 1. バックアップの作成(存在しない場合、Backups フォルダに保存)
if (!File.Exists(backupPath))
{
string originalContent = File.ReadAllText(indexPath, Encoding.UTF8);
// 既にタグが含まれていた場合は除去したものをバックアップとする
string cleanContent = RemoveScriptTag(originalContent);
File.WriteAllText(backupPath, cleanContent, new UTF8Encoding(false));
if (File.Exists(legacyBackupPath))
{
File.Copy(legacyBackupPath, backupPath, true);
}
else
{
string originalContent = File.ReadAllText(indexPath, Encoding.UTF8);
// 既にタグが含まれていた場合は除去したものをバックアップとする
string cleanContent = RemoveScriptTag(originalContent);
File.WriteAllText(backupPath, cleanContent, new UTF8Encoding(false));
}
}
// 2. 有効化する機能の判定
@@ -121,14 +131,21 @@ namespace GameLauncher.Services
try
{
var dir = Path.GetDirectoryName(indexPath)!;
var backupPath = indexPath + IndexBackupSuffix;
var gameBackupDir = AppPathHelper.GetGameBackupDirectory(game.FolderName, game.RootDirectory);
var backupPath = Path.Combine(gameBackupDir, "index.html" + IndexBackupSuffix);
var legacyBackupPath = indexPath + IndexBackupSuffix;
var modJsPath = Path.Combine(dir, ModScriptFileName);
// 1. index.html の復元
// 1. index.html の復元 (Backups フォルダを優先)
if (File.Exists(backupPath))
{
File.Copy(backupPath, indexPath, true);
}
else if (File.Exists(legacyBackupPath))
{
File.Copy(legacyBackupPath, indexPath, true);
try { File.Copy(legacyBackupPath, backupPath, true); } catch { }
}
else if (File.Exists(indexPath))
{
string content = File.ReadAllText(indexPath, Encoding.UTF8);
@@ -136,6 +153,12 @@ namespace GameLauncher.Services
File.WriteAllText(indexPath, clean, new UTF8Encoding(false));
}
// ゲームフォルダ内の旧バックアップがあれば削除
if (File.Exists(legacyBackupPath))
{
try { File.Delete(legacyBackupPath); } catch { }
}
// 2. tyrano_launcher_mod.js の削除
if (File.Exists(modJsPath))
{