feat(ui): ログ出力のバッチフラッシュ化・全体プログレス表示およびUI連携の改善
- ログ出力を ConcurrentQueue によるキューイングとタイマーによるバッチフラッシュ方式へ移行し、大量ログ出力時のUIフリーズを防止 - ログテキストボックスの文字数制限(10万文字超過時のトリム)を導入しメモリ肥大化を抑制 - ステータスバーに全体処理用プログレスバー(pbGlobalProgress)を追加 - EVB要解凍バッジおよびその他エンジンバッジのXAMLバインディング連携を整理 - セーブエディタ・ウディタ・SRPG Studio等の各種操作後に SaveBookmarks を呼び出すよう保存処理を補完
This commit is contained in:
1 parent
cfdba6806a
commit
751e382adc
2 files changed
+433
-437
No files matched your search
+174
-10
@@ -5,6 +5,7 @@ using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
@@ -45,6 +46,7 @@ namespace GameLauncher
|
||||
private readonly SrpgArchiveService _srpgArchiveService = new();
|
||||
private readonly SrpgModService _srpgModService = new();
|
||||
private readonly WindowResizeService _windowResizeService = new();
|
||||
private readonly TkoolResourceRepairService _tkoolResourceRepairService = new();
|
||||
|
||||
/// <summary>直近に起動したゲームプロセス(起動後の外部連携処理で使用)</summary>
|
||||
private Process? _lastStartedProcess;
|
||||
@@ -59,6 +61,8 @@ namespace GameLauncher
|
||||
private readonly string _configFilePath;
|
||||
private LauncherConfig _config = new();
|
||||
private bool _isInitialized;
|
||||
private readonly System.Collections.Concurrent.ConcurrentQueue<string> _logQueue = new();
|
||||
private System.Windows.Threading.DispatcherTimer? _logFlushTimer;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
@@ -79,6 +83,14 @@ namespace GameLauncher
|
||||
|
||||
_isInitialized = true;
|
||||
|
||||
// ログの非同期バッファリング更新タイマー(100ms周期で一括フラッシュしUI負荷をゼロ化)
|
||||
this._logFlushTimer = new System.Windows.Threading.DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(100)
|
||||
};
|
||||
this._logFlushTimer.Tick += (s, e) => this.FlushLogQueue();
|
||||
this._logFlushTimer.Start();
|
||||
|
||||
// ウィンドウ描画後に初期処理(即時一覧作成&裏での更新監視)を開始
|
||||
ContentRendered += MainWindow_ContentRendered;
|
||||
Closing += MainWindow_Closing;
|
||||
@@ -137,6 +149,7 @@ namespace GameLauncher
|
||||
case 7: tabWolf.IsChecked = true; break;
|
||||
case 8: tabSrpg.IsChecked = true; break;
|
||||
case 9: tabNwjs.IsChecked = true; break;
|
||||
case 10: tabOther.IsChecked = true; break;
|
||||
default: tabAll.IsChecked = true; break;
|
||||
}
|
||||
|
||||
@@ -175,6 +188,7 @@ namespace GameLauncher
|
||||
else if (tabWolf.IsChecked == true) tabIndex = 7;
|
||||
else if (tabSrpg.IsChecked == true) tabIndex = 8;
|
||||
else if (tabNwjs.IsChecked == true) tabIndex = 9;
|
||||
else if (tabOther.IsChecked == true) tabIndex = 10;
|
||||
|
||||
_config.SelectedTab = tabIndex;
|
||||
_config.UnityBackendFilter = rbUnityIL2CPP.IsChecked == true ? "IL2CPP" : (rbUnityMono.IsChecked == true ? "Mono" : "All");
|
||||
@@ -377,14 +391,16 @@ namespace GameLauncher
|
||||
{
|
||||
_scannedCountSinceLastSave = 0;
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
await _scannerService.ScanDirectoriesAsync(targetDirs, progress, _scannedPaths, ct);
|
||||
|
||||
// キャッシュの最終同期
|
||||
// キャッシュの最終同期(削除されたゲームのブックマークもここで除去する)
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
lblStatusEngine.Text = "準備完了";
|
||||
lblLogActivity.Text = "";
|
||||
AppendLog($"スキャンが完了しました。総ゲーム数: {_games.Count} 件。");
|
||||
@@ -421,6 +437,7 @@ namespace GameLauncher
|
||||
_scanCts?.Cancel();
|
||||
SaveConfig();
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -491,6 +508,10 @@ namespace GameLauncher
|
||||
{
|
||||
if (game is not TkoolGameItem tg || tg.EngineType != TkoolEngineType.Nwjs) return false;
|
||||
}
|
||||
else if (tabOther.IsChecked == true)
|
||||
{
|
||||
if (!game.IsOther) return false;
|
||||
}
|
||||
|
||||
// 3. 追加属性フィルター(全タブ共通)
|
||||
if (chkFilterBookmarkedOnly.IsChecked == true && !game.IsBookmarked) return false;
|
||||
@@ -556,17 +577,18 @@ namespace GameLauncher
|
||||
|
||||
int total = _games.Count;
|
||||
int visible = _gamesView?.Count ?? 0;
|
||||
int tkoolCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano && !tg.IsRgss && !tg.IsWolf && !tg.IsSrpgStudio && !tg.IsNwjs);
|
||||
int tkoolCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType != TkoolEngineType.Tyrano && !tg.IsRgss && !tg.IsWolf && !tg.IsSrpgStudio && !tg.IsNwjs && !tg.IsOther);
|
||||
int rgssCount = _games.Count(g => g is TkoolGameItem tg && tg.IsRgss);
|
||||
int tyranoCount = _games.Count(g => g is TkoolGameItem tg && tg.EngineType == TkoolEngineType.Tyrano);
|
||||
int wolfCount = _games.Count(g => g is TkoolGameItem tg && tg.IsWolf);
|
||||
int srpgCount = _games.Count(g => g is TkoolGameItem tg && tg.IsSrpgStudio);
|
||||
int nwjsCount = _games.Count(g => g is TkoolGameItem tg && tg.IsNwjs);
|
||||
int unityCount = _games.Count(g => g is UnityGameItem);
|
||||
int otherCount = _games.Count(g => g.IsOther);
|
||||
int bookmarkCount = _games.Count(g => g.IsBookmarked);
|
||||
|
||||
lblStatusSummary.Text = $"総ゲーム数: {total} 件 | 表示: {visible} 件 | ★ ブックマーク: {bookmarkCount} 件";
|
||||
lblStatusBreakdown.Text = $"(ツクールMV/MZ: {tkoolCount}, ツクールVX系: {rgssCount}, ティラノ: {tyranoCount}, ウディタ: {wolfCount}, SRPG Studio: {srpgCount}, NW.js: {nwjsCount}, Unity: {unityCount})";
|
||||
lblStatusBreakdown.Text = $"(ツクールMV/MZ: {tkoolCount}, ツクールVX系: {rgssCount}, ティラノ: {tyranoCount}, ウディタ: {wolfCount}, SRPG Studio: {srpgCount}, NW.js: {nwjsCount}, Unity: {unityCount}, その他: {otherCount})";
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -645,6 +667,17 @@ namespace GameLauncher
|
||||
? tkoolItem.ResolveLaunchExecutable()
|
||||
: game.ExecutablePath;
|
||||
|
||||
// 直下にexeが無い場合やパスが変わっていた場合はサブフォルダ内を再探索して救済
|
||||
if (string.IsNullOrEmpty(effectiveExe) || !File.Exists(effectiveExe))
|
||||
{
|
||||
var foundExe = GameScannerService.FindGameExecutable(game.RootDirectory);
|
||||
if (!string.IsNullOrEmpty(foundExe) && File.Exists(foundExe))
|
||||
{
|
||||
effectiveExe = foundExe;
|
||||
game.ExecutablePath = foundExe;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(effectiveExe) || !File.Exists(effectiveExe))
|
||||
{
|
||||
MessageBox.Show($"実行ファイルが見つかりません:\n{effectiveExe}", "起動エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
@@ -662,6 +695,10 @@ namespace GameLauncher
|
||||
{
|
||||
LaunchUnityGame(ug);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartGameProcess(game);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -772,6 +809,11 @@ namespace GameLauncher
|
||||
AppendLog($"[ティラノ復元] {tg.Title}: {msg}");
|
||||
}
|
||||
}
|
||||
// その他のゲーム(ツクール以外のゲーム)
|
||||
else if (tg.IsOther)
|
||||
{
|
||||
AppendLog($"[その他起動] {tg.Title} を起動します...");
|
||||
}
|
||||
// スクリプト改造の適用または復元(ツクールMV/MZ)
|
||||
else
|
||||
{
|
||||
@@ -806,6 +848,18 @@ namespace GameLauncher
|
||||
var launchExe = game is TkoolGameItem evbItem
|
||||
? evbItem.ResolveLaunchExecutable()
|
||||
: game.ExecutablePath;
|
||||
|
||||
// 直下にexeが無い場合やパスが変わっていた場合はサブフォルダ内を探索して救済
|
||||
if (string.IsNullOrEmpty(launchExe) || !File.Exists(launchExe))
|
||||
{
|
||||
var foundExe = GameScannerService.FindGameExecutable(game.RootDirectory);
|
||||
if (!string.IsNullOrEmpty(foundExe) && File.Exists(foundExe))
|
||||
{
|
||||
launchExe = foundExe;
|
||||
game.ExecutablePath = foundExe;
|
||||
}
|
||||
}
|
||||
|
||||
if (game is TkoolGameItem && launchExe != game.ExecutablePath)
|
||||
{
|
||||
AppendLog($"[EVB起動] 解凍後の実行ファイルを使用: {Path.GetFileName(launchExe)}");
|
||||
@@ -832,7 +886,7 @@ namespace GameLauncher
|
||||
{
|
||||
Directory.CreateDirectory(profileDir);
|
||||
}
|
||||
startInfo.Arguments = $"--user-data-dir=\"{profileDir}\"";
|
||||
startInfo.Arguments = $"--user-data-dir=\"{profileDir}\" --allow-file-access-from-files";
|
||||
AppendLog($"[プロファイル] 専用プロファイルを指定: {Path.GetFileName(profileDir)}");
|
||||
}
|
||||
catch (Exception pEx)
|
||||
@@ -845,6 +899,7 @@ namespace GameLauncher
|
||||
|
||||
game.LastLaunched = DateTime.Now;
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
|
||||
AppendLog($"🚀 {game.Title} を起動しました。");
|
||||
}
|
||||
@@ -867,6 +922,7 @@ namespace GameLauncher
|
||||
|
||||
// ツクール専用メニュー
|
||||
menuTkoolOpenFolder.Visibility = isTkool ? Visibility.Visible : Visibility.Collapsed;
|
||||
menuTkoolRepairResources.Visibility = isTkool ? Visibility.Visible : Visibility.Collapsed;
|
||||
menuTkoolRestoreOriginal.Visibility = isTkool ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
if (selected is TkoolGameItem tg)
|
||||
@@ -907,6 +963,7 @@ namespace GameLauncher
|
||||
menuTkoolRestoreAsar.Visibility = Visibility.Collapsed;
|
||||
menuTkoolExtractRgss.Visibility = Visibility.Collapsed;
|
||||
menuTkoolRestoreRgss.Visibility = Visibility.Collapsed;
|
||||
menuTkoolRepairResources.Visibility = Visibility.Collapsed;
|
||||
menuTkoolOpenPluginsJs.Visibility = Visibility.Collapsed;
|
||||
menuTkoolOpenProfile.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
@@ -982,6 +1039,7 @@ namespace GameLauncher
|
||||
tg.PluginsDirPath = Path.Combine(Path.GetDirectoryName(tg.PluginsJsPath)!, "plugins");
|
||||
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
AppendLog($"[ASAR解凍成功] {message}");
|
||||
MessageBox.Show(message, "ASAR 解凍完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
|
||||
@@ -1038,6 +1096,7 @@ namespace GameLauncher
|
||||
? string.Empty
|
||||
: result.UnderlyingEngine;
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
AppendLog("[EVB解凍完了] ==============================");
|
||||
AppendLog($" ・対象 : {tg.Title}");
|
||||
AppendLog($" ・出力先 : {result.OutputDirectory}");
|
||||
@@ -1080,6 +1139,7 @@ namespace GameLauncher
|
||||
tg.EvbExtractedDirPath = null;
|
||||
tg.EvbUnderlyingEngine = string.Empty;
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
AppendLog("[EVB復元完了] ==============================");
|
||||
AppendLog($" ・対象 : {tg.Title}");
|
||||
AppendLog(" ・内容 : 解凍フォルダを削除し、元 exe(.glbak)を復元しました。");
|
||||
@@ -1115,6 +1175,7 @@ namespace GameLauncher
|
||||
|
||||
game.IsBookmarked = !game.IsBookmarked;
|
||||
this._scannerService.SaveCache(this._games);
|
||||
this._scannerService.SaveBookmarks(this._games);
|
||||
|
||||
if (this.chkFilterBookmarkedOnly.IsChecked == true || this._gameComparer.SortOrder == GameSortOrder.BookmarkedFirst)
|
||||
{
|
||||
@@ -1175,6 +1236,7 @@ namespace GameLauncher
|
||||
tg.IsAsarExtracted = false;
|
||||
tg.IsModded = false;
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
AppendLog($"[ASAR復元成功] {message}");
|
||||
MessageBox.Show(message, "ASAR 復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
@@ -1224,6 +1286,7 @@ namespace GameLauncher
|
||||
if (success)
|
||||
{
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
AppendLog($"[RGSS抽出成功] {message}");
|
||||
MessageBox.Show(message, "RGSS スクリプト抽出完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
@@ -1269,6 +1332,7 @@ namespace GameLauncher
|
||||
{
|
||||
tg.IsModded = false;
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
AppendLog($"[RGSS復元成功] {message}");
|
||||
MessageBox.Show(message, "RGSS 復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
@@ -1336,6 +1400,70 @@ namespace GameLauncher
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ツクールゲームのリソース文字化け・URLエンコード修復メニュー クリック時
|
||||
/// </summary>
|
||||
private async void MenuRepairResources_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (lstGames.SelectedItem is TkoolGameItem tg)
|
||||
{
|
||||
AppendLog($"[リソース修復] {tg.Title}: 手動での完全再検査を開始します...");
|
||||
|
||||
this.pbGlobalProgress.Visibility = Visibility.Visible;
|
||||
this.pbGlobalProgress.IsIndeterminate = true;
|
||||
this.lblGlobalProgressText.Visibility = Visibility.Visible;
|
||||
this.lblGlobalProgressText.Text = "ファイル一覧を収集中...";
|
||||
this.lblStatusEngine.Text = "リソース修復中...";
|
||||
|
||||
var progress = new Progress<TkoolResourceRepairService.RepairProgress>(p =>
|
||||
{
|
||||
if (p.Total > 0)
|
||||
{
|
||||
this.pbGlobalProgress.IsIndeterminate = false;
|
||||
this.pbGlobalProgress.Maximum = p.Total;
|
||||
this.pbGlobalProgress.Value = p.Current;
|
||||
this.lblGlobalProgressText.Text = $"リソース修復中: {p.Current}/{p.Total} (修復: {p.RepairedCount})";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lblGlobalProgressText.Text = p.CurrentStatus;
|
||||
}
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
var result = await _tkoolResourceRepairService.RepairGameResourcesAsync(
|
||||
tg,
|
||||
forceRescan: true,
|
||||
progress: progress,
|
||||
uiLogCallback: msg => AppendLog(msg));
|
||||
|
||||
AppendLog($"[リソース修復完了] {tg.Title}: {result.Message}");
|
||||
var askOpenLog = MessageBox.Show(
|
||||
$"{result.Message}\n\n詳細ログファイルを出力しました:\n{result.LogFilePath}\n\nログファイルを開きますか?",
|
||||
"リソース修復結果",
|
||||
MessageBoxButton.YesNo,
|
||||
result.Success ? MessageBoxImage.Information : MessageBoxImage.Warning);
|
||||
|
||||
if (askOpenLog == MessageBoxResult.Yes && !string.IsNullOrEmpty(result.LogFilePath) && File.Exists(result.LogFilePath))
|
||||
{
|
||||
Process.Start(new ProcessStartInfo { FileName = result.LogFilePath, UseShellExecute = true });
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AppendLog($"[リソース修復エラー] {tg.Title}: {ex.Message}");
|
||||
MessageBox.Show($"リソース修復中にエラーが発生しました:\n{ex.Message}", "修復エラー", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.pbGlobalProgress.Visibility = Visibility.Collapsed;
|
||||
this.lblGlobalProgressText.Visibility = Visibility.Collapsed;
|
||||
this.lblStatusEngine.Text = "待機中";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unity専用機能 (セーブエディタ・LocalLow・regedit・即時バックアップ)
|
||||
@@ -1370,6 +1498,7 @@ namespace GameLauncher
|
||||
// セーブ状態の再チェック
|
||||
ug.HasSaveData = _scannerService.CheckHasSaveData(ug);
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
AppendLog($"[セーブエディタ終了] {ug.Title} のセーブエディタを閉じました。");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1535,6 +1664,7 @@ namespace GameLauncher
|
||||
var (success, msg) = _wolfModService.ApplyProxyDll(tg, 1.0, tg.WolfSpeedMultiplier > 0 ? tg.WolfSpeedMultiplier : 3.0, 5.0);
|
||||
AppendLog($"[ウディタ プロキシDLL] {msg.Replace("\n", " ")}");
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1545,6 +1675,7 @@ namespace GameLauncher
|
||||
var (success, msg) = _wolfModService.RemoveProxyDll(tg);
|
||||
AppendLog($"[ウディタ プロキシDLL] {msg}");
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1557,6 +1688,7 @@ namespace GameLauncher
|
||||
AppendLog($"[ウディタ プロキシDLL] {msg.Replace("\n", " ")}");
|
||||
MessageBox.Show(msg, "プロキシDLL適用", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1569,6 +1701,7 @@ namespace GameLauncher
|
||||
AppendLog($"[ウディタ プロキシDLL] {msg}");
|
||||
MessageBox.Show(msg, "プロキシDLL解除", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1610,6 +1743,7 @@ namespace GameLauncher
|
||||
MessageBox.Show(msg, "解凍エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1636,6 +1770,7 @@ namespace GameLauncher
|
||||
AppendLog($"[ウディタ復元] {tg.Title}: {msg.Replace("\n", " ")}");
|
||||
MessageBox.Show(msg, "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1673,6 +1808,7 @@ namespace GameLauncher
|
||||
AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLLを有効化しました (F6で倍速切替)");
|
||||
}
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
|
||||
private void chkSrpgProxyDll_Unchecked(object sender, RoutedEventArgs e)
|
||||
@@ -1682,6 +1818,7 @@ namespace GameLauncher
|
||||
_srpgModService.DisableProxyDll(tg.RootDirectory);
|
||||
AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLLを解除しました");
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
|
||||
private void btnApplySrpgProxyDll_Click(object sender, RoutedEventArgs e)
|
||||
@@ -1699,6 +1836,7 @@ namespace GameLauncher
|
||||
MessageBox.Show("プロキシDLLの配置に失敗しました。\nEngines/Rgss/Tools/speedhack-i686/version.dll が存在するか確認してください。", "エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
|
||||
private void btnRemoveSrpgProxyDll_Click(object sender, RoutedEventArgs e)
|
||||
@@ -1709,6 +1847,7 @@ namespace GameLauncher
|
||||
AppendLog($"[SRPG Studio 倍速] {tg.Title}: プロキシDLL (version.dll) を解除しました");
|
||||
MessageBox.Show("プロキシDLL (version.dll) を解除しました。", "プロキシDLL解除完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
|
||||
private async void btnApplySrpgMod_Click(object sender, RoutedEventArgs e)
|
||||
@@ -1757,6 +1896,7 @@ namespace GameLauncher
|
||||
MessageBox.Show(msg, "改造適用エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1807,6 +1947,7 @@ namespace GameLauncher
|
||||
MessageBox.Show(msg, "改造解除エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1856,6 +1997,7 @@ namespace GameLauncher
|
||||
MessageBox.Show(msg, "解凍エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1904,6 +2046,7 @@ namespace GameLauncher
|
||||
MessageBox.Show(msg, "再構築エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1944,6 +2087,7 @@ namespace GameLauncher
|
||||
AppendLog($"[SRPG Studio 完全復元] {tg.Title}:\n{msg}");
|
||||
MessageBox.Show($"すべての改造を解除しました:\n\n{msg}", "復元完了", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
_scannerService.SaveCache(_games);
|
||||
_scannerService.SaveBookmarks(_games);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1974,17 +2118,37 @@ namespace GameLauncher
|
||||
|
||||
private void AppendLog(string message)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
string timestamp = DateTime.Now.ToString("HH:mm:ss");
|
||||
this._logQueue.Enqueue($"[{timestamp}] {message}\n");
|
||||
}
|
||||
|
||||
private void FlushLogQueue()
|
||||
{
|
||||
if (this._logQueue.IsEmpty) return;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
while (this._logQueue.TryDequeue(out var msg))
|
||||
{
|
||||
string timestamp = DateTime.Now.ToString("HH:mm:ss");
|
||||
txtLog.AppendText($"[{timestamp}] {message}\n");
|
||||
scrollLog.ScrollToEnd();
|
||||
});
|
||||
sb.Append(msg);
|
||||
if (sb.Length > 20000) break; // 1回あたりの最大文字数を制限してUIを軽快に保つ
|
||||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
// テキストボックスの行数が多すぎる場合は古いログを切り詰める(メモリ肥大化・クラッシュ防止)
|
||||
if (this.txtLog.Text.Length > 100000)
|
||||
{
|
||||
this.txtLog.Text = this.txtLog.Text.Substring(this.txtLog.Text.Length - 50000);
|
||||
}
|
||||
this.txtLog.AppendText(sb.ToString());
|
||||
this.scrollLog.ScrollToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClearLog_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
txtLog.Clear();
|
||||
while (this._logQueue.TryDequeue(out _)) { }
|
||||
this.txtLog.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in new issue
Block a user