3 コミット
作成者 SHA1 メッセージ 日付
routersys 7d79561bba DBファイル名のproxyforge.vdbへの変更と旧ファイル移行処理の追加
DBファイル名の定数DbFileNameをzerodiskproxy.vdbからproxyforge.vdbに変更しました。
旧ファイル名はOldDbFileNameとして定数に保持しました。
コンストラクタに旧フォーマットから新フォーマットへのロバストなマイグレーション処理を追加しました。
マイグレーションは旧DBファイルが存在し、かつ新DBファイルが存在しない場合にのみ実行されるよう条件を設けました。
マイグレーション時はDBファイルを一時ファイルにコピーした後、File.Moveで正式なパスに移動する安全な手順を採用しました。
バックアップファイルが存在する場合も同様に一時ファイル経由で移行しました。
移行完了後は旧DBファイル、旧バックアップファイル、旧一時ファイルを削除してレガシーファイルを完全に除去しました。
マイグレーション処理全体をtry-catchで囲み、失敗時は例外メッセージをDebug.WriteLineに記録して処理を継続できるよう安全性を確保しました。
2026-03-26 10:19:46 +09:00
routersys fb44c7f90d サムネイルの追加 2026-03-26 09:27:26 +09:00
routersys 9d12098663 ポップアップウィンドウへのDWMテーマ自動適用機能の追加
IWindowThemeServiceインターフェースを新規作成し、Bind(Window)メソッドを定義しました。
WindowThemeServiceクラスを実装し、SourceInitializedおよびLoadedイベントにフックしてウィンドウ生成時に自動でテーマを適用するようにしました。
テーマ適用はWindows11以降のみを対象とし、DWM APIのDwmSetWindowAttributeを用いてキャプションバー・ボーダー・テキストの色をWPFのシステムカラーリソースから取得して設定しました。
WindowThemeRegistry静的クラスを導入し、Null Objectパターンにより未登録時でも安全に動作するNullWindowThemeServiceをデフォルト実装として保持するようにしました。
RegisterメソッドはInterlocked.Exchangeでスレッドセーフな差し替えを保証するようにしました。
PluginHostの初期化処理にてWindowThemeServiceをWindowThemeRegistryへ登録し、GenerationPopupView生成直後にWindowThemeRegistry.Bindを呼び出してポップアップウィンドウをテーマサービスに紐付けるようにしました。
2026-03-25 23:06:41 +09:00
9個のファイルの変更、129行の追加、2行の削除

検索条件に一致するファイルはありません

+45 -1
ファイルの表示
@@ -13,7 +13,8 @@ internal sealed class VideoCacheDatabase : IVideoCacheDatabase
private const int FormatVersion = 1;
private const int HeaderSize = 32;
private const int HeaderCrcOffset = 16;
private const string DbFileName = "zerodiskproxy.vdb";
private const string OldDbFileName = "zerodiskproxy.vdb";
private const string DbFileName = "proxyforge.vdb";
private const string BackupSuffix = ".bak";
private const string TempSuffix = ".tmp";
@@ -33,6 +34,49 @@ internal sealed class VideoCacheDatabase : IVideoCacheDatabase
Directory.CreateDirectory(_cacheDirectory);
_dbPath = Path.Combine(_cacheDirectory, DbFileName);
_backupPath = _dbPath + BackupSuffix;
var oldDbPath = Path.Combine(_cacheDirectory, OldDbFileName);
if (File.Exists(oldDbPath) && !File.Exists(_dbPath))
{
Debug.WriteLine("[VideoCacheDatabase] Starting robust data migration to ProxyForge format.");
try
{
var migrationTempPath = _dbPath + ".migration.tmp";
File.Copy(oldDbPath, migrationTempPath, true);
var oldBackupPath = oldDbPath + BackupSuffix;
var migrationBackupTempPath = _backupPath + ".migration.tmp";
var hasBackup = File.Exists(oldBackupPath);
if (hasBackup)
{
File.Copy(oldBackupPath, migrationBackupTempPath, true);
}
File.Move(migrationTempPath, _dbPath, true);
if (hasBackup)
{
File.Move(migrationBackupTempPath, _backupPath, true);
}
File.Delete(oldDbPath);
if (hasBackup)
{
File.Delete(oldBackupPath);
}
var oldTempPath = oldDbPath + TempSuffix;
if (File.Exists(oldTempPath))
{
File.Delete(oldTempPath);
}
Debug.WriteLine("[VideoCacheDatabase] Migration completed successfully. Legacy files removed.");
}
catch (Exception ex)
{
Debug.WriteLine(string.Concat("[VideoCacheDatabase] Migration failed: ", ex.Message));
}
}
_diskStore = new VideoCacheDiskStore(_cacheDirectory);
Span<byte> hashBuf = stackalloc byte[32];
+8
ファイルの表示
@@ -0,0 +1,8 @@
using System.Windows;
namespace ProxyForge.Interfaces;
internal interface IWindowThemeService
{
void Bind(Window window);
}
+3
ファイルの表示
@@ -3,6 +3,7 @@ using ProxyForge.Core;
using ProxyForge.Detection;
using ProxyForge.Interfaces;
using ProxyForge.Memory;
using ProxyForge.Services;
using ProxyForge.Settings;
using ProxyForge.Streaming;
using ProxyForge.ViewModels;
@@ -60,6 +61,7 @@ internal sealed class PluginHost : IDisposable
var chunkAllocator = new ChunkAllocator(65536);
MfSession.AddRef();
WindowThemeRegistry.Register(new WindowThemeService());
IProxyEncoderFactory encoderFactory = new MfProxyEncoderFactory(
budget,
@@ -124,6 +126,7 @@ internal sealed class PluginHost : IDisposable
{
var vm = new GenerationPopupViewModel(CacheManager.ActiveGenerations);
_popupView = new GenerationPopupView(vm);
WindowThemeRegistry.Bind(_popupView);
var mainWindow = Application.Current?.MainWindow;
if (mainWindow is { IsLoaded: true })
+1 -1
ファイルの表示
@@ -5,7 +5,7 @@
<UseWPF>true</UseWPF>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Platforms>AnyCPU;x64;x64</Platforms>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
+22
ファイルの表示
@@ -0,0 +1,22 @@
using ProxyForge.Interfaces;
using System.Windows;
namespace ProxyForge.Services;
internal static class WindowThemeRegistry
{
private static IWindowThemeService _service = NullWindowThemeService.Instance;
internal static void Register(IWindowThemeService service)
=> Interlocked.Exchange(ref _service, service ?? NullWindowThemeService.Instance);
internal static void Bind(Window window)
=> _service.Bind(window);
private sealed class NullWindowThemeService : IWindowThemeService
{
internal static readonly NullWindowThemeService Instance = new();
private NullWindowThemeService() { }
public void Bind(Window window) { }
}
}
+47
ファイルの表示
@@ -0,0 +1,47 @@
using ProxyForge.Interfaces;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
namespace ProxyForge.Services;
internal sealed class WindowThemeService : IWindowThemeService
{
public void Bind(Window window)
{
if (window is null) return;
window.SourceInitialized += (_, _) => ApplyCurrentTheme(window);
window.Loaded += (_, _) => ApplyCurrentTheme(window);
}
private static void ApplyCurrentTheme(Window window)
{
if (!OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000)) return;
var hwnd = new WindowInteropHelper(window).Handle;
if (hwnd == nint.Zero) return;
var captionBrush = (window.TryFindResource(SystemColors.ControlBrushKey) as SolidColorBrush) ?? Brushes.White;
var textBrush = (window.TryFindResource(SystemColors.WindowTextBrushKey) as SolidColorBrush) ?? Brushes.Black;
SetDwmColor(hwnd, NativeMethods.DwmwaCaption, captionBrush.Color);
SetDwmColor(hwnd, NativeMethods.DwmwaBorder, captionBrush.Color);
SetDwmColor(hwnd, NativeMethods.DwmwaText, textBrush.Color);
}
private static void SetDwmColor(nint hwnd, uint attribute, Color color)
{
uint colorRef = color.R | ((uint)color.G << 8) | ((uint)color.B << 16);
NativeMethods.DwmSetWindowAttribute(hwnd, attribute, ref colorRef, sizeof(uint));
}
private static class NativeMethods
{
internal const uint DwmwaCaption = 35;
internal const uint DwmwaBorder = 34;
internal const uint DwmwaText = 36;
[DllImport("dwmapi.dll")]
internal static extern int DwmSetWindowAttribute(nint hwnd, uint dwAttribute, ref uint pvAttribute, uint cbAttribute);
}
}
+2
ファイルの表示
@@ -8,6 +8,8 @@ YukkuriMovieMaker4 (YMM4) 上で動作する**動画プロキシ自動生成プ
大容量の動画ファイルから低解像度プロキシを自動生成し、編集中のプレビュー負荷を軽減します。
プロキシはディスクにキャッシュされ、動画出力(エクスポート)時にはオリジナル解像度に自動で切り替わるため、最終出力の品質に影響を与えません。
![Image](https://github.com/routersys/YMM4-ProxyForge/blob/main/docs/ProxyForge.png)
## 概要
本プラグインは、YMM4の映像ファイルソースとして動作します。
サブモジュール
+1
サブモジュール YukkuriMovieMaker.Generator が 9d67caf6e6 で追加されました。
バイナリ
ファイルの表示
バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 519 KiB