优化更新代码,添加界面功能并整合

This commit is contained in:
GG Z
2025-02-10 20:53:40 +08:00
parent 83b846f15f
commit 978e03a67f
1389 changed files with 95739 additions and 22200 deletions

View File

@@ -0,0 +1,77 @@
/* This Source Code is partially based on reverse engineering of the Windows Operating System,
and is intended for use on Windows systems only.
This Source Code is partially based on the source code provided by the .NET Foundation. */
using WPFluent.Controls;
using WPFluent.Taskbar;
namespace WPFluent.Interop;
/// <summary>
/// A set of dangerous methods to modify the appearance.
/// </summary>
internal static class UnsafeReflection
{
/// <summary>
/// Casts <see cref="WindowBackdropType"/> to <see cref="Dwmapi.DWMSBT"/>.
/// </summary>
public static Dwmapi.DWMSBT Cast(WindowBackdropType backgroundType)
{
return backgroundType switch
{
WindowBackdropType.Auto => Dwmapi.DWMSBT.DWMSBT_AUTO,
WindowBackdropType.Mica => Dwmapi.DWMSBT.DWMSBT_MAINWINDOW,
WindowBackdropType.Acrylic => Dwmapi.DWMSBT.DWMSBT_TRANSIENTWINDOW,
WindowBackdropType.Tabbed => Dwmapi.DWMSBT.DWMSBT_TABBEDWINDOW,
_ => Dwmapi.DWMSBT.DWMSBT_DISABLE,
};
}
/// <summary>
/// Casts <see cref="WindowCornerPreference"/> to <see cref="Dwmapi.DWM_WINDOW_CORNER_PREFERENCE"/>.
/// </summary>
public static Dwmapi.DWM_WINDOW_CORNER_PREFERENCE Cast(WindowCornerPreference cornerPreference)
{
return cornerPreference switch
{
WindowCornerPreference.Round => Dwmapi.DWM_WINDOW_CORNER_PREFERENCE.ROUND,
WindowCornerPreference.RoundSmall => Dwmapi.DWM_WINDOW_CORNER_PREFERENCE.ROUNDSMALL,
WindowCornerPreference.DoNotRound => Dwmapi.DWM_WINDOW_CORNER_PREFERENCE.DONOTROUND,
_ => Dwmapi.DWM_WINDOW_CORNER_PREFERENCE.DEFAULT,
};
}
/// <summary>
/// Casts <see cref="TaskBarProgressState"/> to <see cref="ShObjIdl.TBPFLAG"/>.
/// </summary>
public static ShObjIdl.TBPFLAG Cast(TaskBarProgressState taskBarProgressState)
{
return taskBarProgressState switch
{
TaskBarProgressState.Indeterminate => ShObjIdl.TBPFLAG.TBPF_INDETERMINATE,
TaskBarProgressState.Error => ShObjIdl.TBPFLAG.TBPF_ERROR,
TaskBarProgressState.Paused => ShObjIdl.TBPFLAG.TBPF_PAUSED,
TaskBarProgressState.Normal => ShObjIdl.TBPFLAG.TBPF_NORMAL,
_ => ShObjIdl.TBPFLAG.TBPF_NOPROGRESS,
};
}
/// <summary>
/// Casts <see cref="ShObjIdl.TBPFLAG"/> to <see cref="TaskBarProgressState"/>.
/// </summary>
public static TaskBarProgressState Cast(ShObjIdl.TBPFLAG progressState)
{
return progressState switch
{
ShObjIdl.TBPFLAG.TBPF_INDETERMINATE => TaskBarProgressState.Indeterminate,
ShObjIdl.TBPFLAG.TBPF_ERROR => TaskBarProgressState.Error,
ShObjIdl.TBPFLAG.TBPF_PAUSED => TaskBarProgressState.Paused,
ShObjIdl.TBPFLAG.TBPF_NORMAL => TaskBarProgressState.Normal,
_ => TaskBarProgressState.None,
};
}
}