Compare commits

...

3 Commits

Author SHA1 Message Date
Aigio Liu 96a14d69bd 🚧 Misc 2024-08-06 17:09:13 +08:00
Aigio Liu c79fba98d3 🚧 Misc 2024-07-04 17:51:15 +08:00
Aigio Liu 4160bb43c5 🚧 Misc 2024-06-29 00:57:23 +08:00
195 changed files with 1566 additions and 2517 deletions
+24
View File
@@ -3,6 +3,14 @@ namespace BD.WTTS;
/// <summary>
/// 提供用来获取应用程序信息(如版本号、说明、加载的程序集等)的属性。
/// </summary>
[Mobius3(
"""
Mobius.AssemblyInfo
AssemblyInfo.cs
AssemblyInfo.Version.cs
AssemblyInfo.Version.NativeHost.cs
AssemblyInfo.Version.Setup.Windows.cs
""")]
public static partial class AssemblyInfo
{
const string Version2 = "3.0";
@@ -146,4 +154,20 @@ false
#endif
}
[AttributeUsage(AttributeTargets.All, Inherited = false)]
sealed class Mobius3Attribute : Attribute
{
public Mobius3Attribute()
{
}
public Mobius3Attribute(string str)
{
}
public bool Obsolete { get; set; }
}
+1
View File
@@ -1,3 +1,4 @@
// Mobius Properties\XmlnsDefinition.cs
#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID)
// C# 10 定义全局 using
File diff suppressed because it is too large Load Diff
@@ -11,7 +11,7 @@
<Identity
Name="4651ED44255E.47979655102CE"
Publisher="CN=A90E406B-B2D3-4A23-B061-0FA1D65C4F66"
Version="3.0.207.0" />
Version="3.0.999.0" />
<Properties>
<DisplayName>Watt Toolkit</DisplayName>
@@ -66,15 +66,6 @@
</Application>
</Applications>
<Extensions>
<desktop2:Extension Category="windows.firewallRules">
<desktop2:FirewallRules Executable="Steam++\modules\Accelerator\Steam++.Accelerator.exe">
<desktop2:Rule Direction="in" IPProtocol="TCP" Profile="all"/>
<desktop2:Rule Direction="in" IPProtocol="UDP" Profile="all"/>
</desktop2:FirewallRules>
</desktop2:Extension>
</Extensions>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
@@ -7,12 +7,28 @@ namespace BD.WTTS.UI;
partial class App
{
[Mobius(
"""
App.DefaultActualTheme
""")]
const AppTheme _DefaultActualTheme = AppTheme.FollowingSystem;
[Mobius(
"""
App.DefaultActualTheme
""")]
AppTheme IApplication.DefaultActualTheme => _DefaultActualTheme;
[Mobius(
"""
App.mTheme
""")]
AppTheme mTheme = _DefaultActualTheme;
[Mobius(
"""
App.Theme
""")]
public AppTheme Theme
{
get => mTheme;
@@ -50,6 +66,10 @@ partial class App
}
}
[Mobius(
"""
App.SetThemeNotChangeValue
""")]
public void SetThemeNotChangeValue(AppTheme value)
{
var mode = value switch
@@ -71,6 +91,10 @@ partial class App
}
}
[Mobius(
"""
App.SetThemeAccent
""")]
public static void SetThemeAccent(string? colorHex)
{
if (colorHex == null)
@@ -9,14 +9,34 @@ namespace BD.WTTS.UI;
partial class App
{
[Mobius(
"""
App.TrayMenus
""")]
public Dictionary<string, TrayMenuItem> TrayMenus { get; } = new Dictionary<string, TrayMenuItem>();
[Mobius(
"""
App.TrayIcons
""")]
public TrayIcons TrayIcons { get; init; } = new TrayIcons();
[Mobius(
"""
App.trayIconMenus
""")]
readonly Dictionary<string, ICommand> trayIconMenus = new();
[Mobius(
"""
App.TrayIconMenus
""")]
public IReadOnlyDictionary<string, ICommand> TrayIconMenus => trayIconMenus;
[Mobius(
"""
App.InitTrayIcon
""")]
void InitTrayIcon()
{
if (ApplicationLifetime is not
@@ -67,6 +87,10 @@ partial class App
}
}
[Mobius(
"""
App.UpdateMenuItems
""")]
public void UpdateMenuItems()
{
MainThread2.BeginInvokeOnMainThread(() =>
@@ -166,6 +190,10 @@ partial class App
});
}
[Mobius(
"""
App.UpdateMenuItems
""")]
public void UpdateMenuItems(string menuKey, TrayMenuItem trayMenuItem)
{
if (TrayMenus != null)
@@ -0,0 +1,17 @@
namespace BD;
[AttributeUsage(AttributeTargets.All, Inherited = false)]
public sealed class MobiusAttribute : Attribute
{
public MobiusAttribute()
{
}
public MobiusAttribute(string str)
{
}
public bool Obsolete { get; set; }
}
@@ -6,6 +6,7 @@ namespace BD.WTTS.Services;
/// <summary>
/// 子进程的 IPC 服务实现
/// </summary>
[Mobius(Obsolete = true)]
public interface IPCSubProcessService : IDisposable
{
/// <summary>
@@ -0,0 +1,17 @@
namespace BD;
[AttributeUsage(AttributeTargets.All, Inherited = false)]
public sealed class MobiusAttribute : Attribute
{
public MobiusAttribute()
{
}
public MobiusAttribute(string str)
{
}
public bool Obsolete { get; set; }
}
@@ -0,0 +1,17 @@
namespace BD;
[AttributeUsage(AttributeTargets.All, Inherited = false)]
public sealed class MobiusAttribute : Attribute
{
public MobiusAttribute()
{
}
public MobiusAttribute(string str)
{
}
public bool Obsolete { get; set; }
}
@@ -0,0 +1,17 @@
namespace BD;
[AttributeUsage(AttributeTargets.All, Inherited = false)]
public sealed class MobiusAttribute : Attribute
{
public MobiusAttribute()
{
}
public MobiusAttribute(string str)
{
}
public bool Obsolete { get; set; }
}
@@ -10,6 +10,8 @@ partial interface IApplication
/// </summary>
/// <param name="iconKey"></param>
/// <returns></returns>
[Mobius(Obsolete = true)]
[Obsolete]
string? GetIconSourceByIconKey(string? iconKey) => string.IsNullOrWhiteSpace(iconKey) ? null :
#if WINDOWS || MACCATALYST || MACOS || LINUX
$"avares://BD.WTTS.Client.Avalonia.App/UI/Assets/Icons/{iconKey}.ico";
@@ -22,6 +24,8 @@ partial interface IApplication
/// </summary>
/// <param name="typeName"></param>
/// <returns></returns>
[Mobius(Obsolete = true)]
[Obsolete]
string GetIconKeyByTypeName(string typeName)
{
#if WINDOWS || MACCATALYST || MACOS || LINUX
@@ -12,6 +12,12 @@ partial interface IApplication
/// <param name="msgToast"></param>
/// <param name="showToast"></param>
/// <returns></returns>
[Mobius(
"""
App // ICommand
async void CopyToClipboardCommandCore(object? text)
ICommand CopyToClipboardCommand
""")]
static async Task CopyToClipboardAsync(string? text, string? msgToast = null, bool showToast = true)
{
if (!string.IsNullOrWhiteSpace(text))
@@ -3,37 +3,65 @@ namespace BD.WTTS;
partial interface IApplication : IDisposableHolder
{
[Mobius(
"""
App.CompositeDisposable
""")]
new CompositeDisposable CompositeDisposable { get; }
/// <summary>
/// 切换当前桌面应用的主题而不改变设置值
/// </summary>
/// <param name="value"></param>
[Mobius(
"""
App.SetThemeNotChangeValue
""")]
void SetThemeNotChangeValue(AppTheme value) { }
/// <summary>
/// 退出整个程序
/// </summary>
[Mobius(
"""
App.Shutdown
""")]
void Shutdown() { }
/// <summary>
/// 主窗口恢复显示
/// </summary>
[Mobius(
"""
App.RestoreMainWindow
""")]
void RestoreMainWindow() { }
/// <summary>
/// 主窗口置顶一次
/// </summary>
[Mobius(
"""
App.RestoreMainWindow
""")]
void SetTopmostOneTime() { }
/// <summary>
/// 托盘菜单
/// </summary>
[Mobius(
"""
App.TrayIconMenus
""")]
IReadOnlyDictionary<string, ICommand> TrayIconMenus { get; }
/// <summary>
/// 是否有活动窗口
/// </summary>
/// <returns></returns>
[Mobius(
"""
App.HasActiveWindow
""")]
bool HasActiveWindow();
}
@@ -5,8 +5,16 @@ partial interface IApplication
{
#region Logger
[Mobius(
"""
Mobius.Helpers.LogInitHelper
""")]
const LogLevel DefaultLoggerMinLevel = IPCSubProcessFileSystem.DefaultLoggerMinLevel;
[Mobius(
"""
Mobius.Helpers.LogInitHelper
""")]
public static NLogLevel DefaultNLoggerMinLevel => IPCSubProcessFileSystem.DefaultNLoggerMinLevel;
/// <summary>
@@ -14,12 +22,24 @@ partial interface IApplication
/// </summary>
/// <param name="logLevel">level to be converted.</param>
/// <returns></returns>
[Mobius(
"""
Mobius.Helpers.LogInitHelper
""")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static NLogLevel ConvertLogLevel(LogLevel logLevel) => IPCSubProcessFileSystem.ConvertLogLevel(logLevel);
[Mobius(
"""
Mobius.Helpers.LogInitHelper
""")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static void SetNLoggerMinLevel(LogLevel logLevel) => SetNLoggerMinLevel(ConvertLogLevel(logLevel));
[Mobius(
"""
Mobius.Helpers.LogInitHelper
""")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static void SetNLoggerMinLevel(NLogLevel logLevel)
{
@@ -27,6 +47,7 @@ partial interface IApplication
NInternalLogger.LogLevel = logLevel;
}
[Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void TrySetLoggerMinLevel(LogLevel logLevel)
{
@@ -41,11 +62,19 @@ partial interface IApplication
SetNLoggerMinLevel(ConvertLogLevel(logLevel));
}
[Mobius(
"""
Mobius.Helpers.LogInitHelper
""")]
private static LoggerFilterOptions? _LoggerFilterOptions;
/// <summary>
/// 日志过滤选项
/// </summary>
[Mobius(
"""
Mobius.Helpers.LogInitHelper
""")]
static LoggerFilterOptions? LoggerFilterOptions
{
get
@@ -59,6 +88,10 @@ partial interface IApplication
/// <summary>
/// 配置 NLog 提供程序,仅初始化时调用
/// </summary>
[Mobius(
"""
Mobius.Helpers.LogInitHelper.GetMobiusLoggingBuilder
""")]
public static Action<ILoggingBuilder> ConfigureLogging(LogLevel minLevel = DefaultLoggerMinLevel)
{
return (ILoggingBuilder builder) =>
@@ -92,6 +125,10 @@ partial interface IApplication
/// <summary>
/// 日志最低等级
/// </summary>
[Mobius(
"""
Mobius.Helpers.LogInitHelper
""")]
public static LogLevel LoggerMinLevel
{
get
@@ -119,6 +156,7 @@ partial interface IApplication
/// <summary>
/// 启用日志
/// </summary>
[Mobius(Obsolete = true)]
public static bool EnableLogger
{
get => LoggerMinLevel > LogLevel.None;
@@ -135,6 +173,10 @@ partial interface IApplication
/// <summary>
/// 日志存放文件夹路径
/// </summary>
[Mobius(
"""
MobiusHost.LogDirPath
""")]
static string LogDirPath { get; internal set; } = string.Empty;
#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID)
@@ -142,6 +184,7 @@ partial interface IApplication
/// <summary>
/// 日志存放文件夹路径(ASF)
/// </summary>
[Mobius(Obsolete = true)]
static string LogDirPathASF { get; set; } = string.Empty;
#endif
@@ -154,6 +197,7 @@ partial interface IApplication
static bool LogUnderCache => true;
#endif
[Mobius(Obsolete = true)]
static Action? ASFInitCoreLoggers { get; private set; }
#endregion
@@ -3,6 +3,10 @@ namespace BD.WTTS;
partial interface IApplication
{
[Mobius(
"""
MobiusHost.EnableDevTools
""")]
public static bool EnableDevtools { get; set; } =
#if DEBUG
true
@@ -14,10 +18,18 @@ partial interface IApplication
/// <summary>
/// 禁用 GPU 硬件加速
/// </summary>
[Mobius(
"""
MobiusHost.DisableGPU
""")]
public static bool DisableGPU { get; set; }
/// <summary>
/// 使用 native OpenGL(仅 Windows)
/// </summary>
[Mobius(
"""
MobiusHost.UseWgl
""")]
public static bool UseWgl { get; set; }
}
@@ -20,11 +20,19 @@ partial interface IApplication
}
#endif
[Mobius(
"""
AppConstants.ProgramName
""")]
private static string? _ProgramName;
/// <summary>
/// 获取当前主程序文件名,例如 steam++.exe
/// </summary>
[Mobius(
"""
AppConstants.ProgramName
""")]
static string ProgramName
{
get
@@ -34,6 +42,10 @@ partial interface IApplication
}
}
[Mobius(
"""
AppConstants.ProgramName
""")]
private static string GetProgramName()
{
var processPath = Environment.ProcessPath;
@@ -6,11 +6,19 @@ partial interface IApplication
/// <summary>
/// 获取或设置当前应用的主题,例如跟随系统,浅色,深色
/// </summary>
[Mobius(
"""
App.Theme
""")]
AppTheme Theme { get; set; }
/// <summary>
/// 获取当前应用的实际主题
/// </summary>
[Mobius(
"""
App.ActualTheme
""")]
AppTheme ActualTheme => Theme switch
{
AppTheme.FollowingSystem => GetActualThemeByFollowingSystem(),
@@ -22,8 +30,13 @@ partial interface IApplication
/// <summary>
/// 获取当前应用的默认主题
/// </summary>
[Mobius(
"""
App.DefaultActualTheme
""")]
protected AppTheme DefaultActualTheme { get; }
[Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static AppTheme GetAppThemeByIsLightOrDarkTheme(bool isLightOrDarkTheme) => isLightOrDarkTheme ? AppTheme.Light : AppTheme.Dark;
@@ -31,6 +44,10 @@ partial interface IApplication
/// 获取当前应用主题跟随系统时的实际主题
/// </summary>
/// <returns></returns>
[Mobius(
"""
App.GetActualThemeByFollowingSystem
""")]
protected AppTheme GetActualThemeByFollowingSystem()
{
var dps = IPlatformService.Instance;
@@ -2,6 +2,10 @@ namespace BD.WTTS;
public partial interface IApplication
{
[Mobius(
"""
App.TrayMenus
""")]
Dictionary<string, TrayMenuItem>? TrayMenus { get; }
/// <summary>
@@ -9,5 +13,9 @@ public partial interface IApplication
/// </summary>
/// <param name="menuKey"></param>
/// <param name="trayMenuItem"></param>
[Mobius(
"""
App.UpdateMenuItems
""")]
void UpdateMenuItems(string menuKey, TrayMenuItem trayMenuItem);
}
+34
View File
@@ -6,6 +6,12 @@ namespace BD.WTTS;
/// </summary>
public partial interface IApplication
{
[Mobius(
"""
App // ICommand
async void CopyToClipboardCommandCore(object? text)
ICommand CopyToClipboardCommand
""")]
static IApplication Instance => Ioc.Get<IApplication>();
/// <summary>
@@ -13,6 +19,7 @@ public partial interface IApplication
/// </summary>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[Mobius(Obsolete = true)]
static bool IsDesktop()
#if WINDOWS || MACOS || LINUX
=> true;
@@ -24,6 +31,7 @@ public partial interface IApplication
=> OperatingSystem.IsWindows() || OperatingSystem.IsMacOS() || (OperatingSystem.IsLinux() && !OperatingSystem.IsAndroid());
#endif
[Mobius(Obsolete = true)]
[Obsolete("use IsDesktop", true)]
static bool IsDesktopPlatform => IsDesktop();
@@ -31,6 +39,7 @@ public partial interface IApplication
/// 获取当前平台 UI Host
/// <para>reference to the ViewController (if using Xamarin.iOS), Activity (if using Xamarin.Android) IWin32Window or IntPtr (if using .Net Framework).</para>
/// </summary>
[Mobius(Obsolete = true)]
object CurrentPlatformUIHost { get; }
#if WINDOWS
@@ -52,6 +61,7 @@ public partial interface IApplication
});
#endif
[Mobius(Obsolete = true)]
DeploymentMode DeploymentMode =>
#if WINDOWS
_DeploymentMode.Value;
@@ -60,8 +70,16 @@ public partial interface IApplication
#endif
/// <inheritdoc cref="IPlatformService.SetBootAutoStart(bool, string)"/>
[Mobius(
"""
SystemBootHelper.SetBootAutoStart
""")]
static void SetBootAutoStart(bool isAutoStart) => IPlatformService.Instance.SetBootAutoStart(isAutoStart, Constants.HARDCODED_APP_NAME);
[Mobius(
"""
ISppWebApiService.clientPlatform
""")]
private static readonly Lazy<ClientPlatform> clientPlatform = new(() =>
{
var platform = DeviceInfo2.Platform();
@@ -145,13 +163,29 @@ public partial interface IApplication
return default;
});
[Mobius(
"""
App.GetApplicationIcon
""")]
static byte[] Login_512 => Properties.Resources.AppLogo_512;
[Mobius(
"""
ISppWebApiService.clientPlatform
""")]
static ClientPlatform ClientPlatform => clientPlatform.Value;
[Mobius(Obsolete = true)]
System.Drawing.Size? GetScreenSize() => null;
[Mobius(Obsolete = true)]
bool? IsAnyWindowNotMinimized() => null;
[Mobius(
"""
App // ICommand
async void OpenBrowserCommandCore(object? url)
ICommand OpenBrowserCommand
""")]
async void OpenBrowserCommandCore(object? url) => await Browser2.OpenAsync(url?.ToString());
}
@@ -5,6 +5,8 @@ namespace BD.WTTS;
/// 指定应用此特性的类需要指定的授权
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
[Mobius(Obsolete = true)]
[Obsolete]
public sealed class AuthorizeAttribute : Attribute
{
public static bool HasAuthorize(object obj)
@@ -1,6 +1,7 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Columns;
[Mobius(Obsolete = true)]
public interface IReadOnlyName
{
string? Name { get; }
@@ -1,6 +1,8 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Columns;
[Mobius(Obsolete = true)]
[Obsolete]
public interface IReadOnlyStaticDisplayName
{
static abstract string? DisplayName { get; }
@@ -1,6 +1,10 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
CertificateConstants
""")]
public static class CertificateConstants
{
public const int CertificateValidDays = 300;
@@ -1,6 +1,10 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
Mobius.Constants.UrlConstants
""")]
[Obsolete("use Constants.Urls/Constants", true)]
public static class UrlConstants
{
@@ -4,11 +4,19 @@ namespace BD.WTTS.Diagnostics;
/// 启动耗时跟踪
/// </summary>
[Obsolete]
[Mobius(
"""
App.WriteElapsedMilliseconds
""", Obsolete = true)]
public static class StartWatchTrace
{
static Stopwatch? sw;
static StringBuilder? sb;
[Mobius(
"""
App.WriteElapsedMilliseconds
""")]
public static void Record(string? mark = null, bool dispose = false)
{
if (sw != null)
@@ -41,7 +49,12 @@ public static class StartWatchTrace
}
}
[Mobius(
"""
App.Elapsed
""")]
public static new string ToString() => sb?.ToString() ?? string.Empty;
[Mobius(Obsolete = true)]
public static long ElapsedMilliseconds => sw == null ? 0L : sw.ElapsedMilliseconds;
}
@@ -3,6 +3,7 @@ namespace BD.WTTS.Entities;
/// <summary>
/// 通知记录
/// </summary>
[Mobius(Obsolete = true)]
[SQLiteTable("A765AD32")]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public sealed class Notification : IEntity<Guid>
@@ -1,5 +1,9 @@
namespace BD.WTTS.Entities;
[Mobius(
"""
Mobius.Entities.Http.RequestCache
""")]
[SQLiteTable(TableName)]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public sealed class RequestCache : IEntity<string>
+4
View File
@@ -1,5 +1,9 @@
namespace BD.WTTS.Entities;
[Mobius(
"""
Mobius.Entities.Identity.User
""")]
[SQLiteTable("D5428AED")]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public sealed class User : IEntity<Guid>
+4
View File
@@ -3,6 +3,10 @@ namespace BD.WTTS.Enums;
/// <summary>
/// 应用程序终结点路由
/// </summary>
[Mobius(
"""
Mobius.Enums.App.AppEndPoint
""", Obsolete = true)]
public enum AppEndPoint : byte
{
LoginOrRegister = 1,
+2
View File
@@ -3,6 +3,7 @@ namespace BD.WTTS.Enums;
/// <summary>
/// 指定用于检索应用程序所使用的文件夹目录路径的枚举常数
/// </summary>
[Mobius(Obsolete = true)]
public enum AppFolder : byte
{
/// <summary>
@@ -24,6 +25,7 @@ public enum AppFolder : byte
/// <summary>
/// Enum 扩展 <see cref="AppFolder"/>
/// </summary>
[Mobius(Obsolete = true)]
public static class AppFolderEnumExtensions
{
/// <summary>
@@ -4,6 +4,10 @@ namespace BD.WTTS.Enums;
/// 应用服务级别,较低的级别注入较少的服务,适用于其他轻量进程业务启动
/// </summary>
[Flags]
[Mobius(
"""
Mobius.Enums.App.AppServicesLevel
""")]
public enum AppServicesLevel : uint
{
/// <summary>
+5
View File
@@ -5,6 +5,10 @@ namespace BD.WTTS.Enums;
/// <summary>
/// 应用程序主题
/// </summary>
[Mobius(
"""
Mobius.Enums.App.AppTheme
""")]
public enum AppTheme : byte
{
/// <summary>
@@ -34,6 +38,7 @@ public enum AppTheme : byte
Custom,
}
[Mobius(Obsolete = true)]
public static partial class AppThemeEnumExtensions
{
#if DEBUG
@@ -3,6 +3,10 @@ namespace BD.WTTS.Enums;
/// <summary>
/// 应用程序 Web 代理模式
/// </summary>
[Mobius(
"""
Mobius.Enums.App.AppWebProxyMode
""")]
public enum AppWebProxyMode : byte
{
/// <summary>
@@ -1,5 +1,10 @@
namespace BD.WTTS.Enums;
[Mobius(
"""
Mobius.Enums.ExitCode
// src/ExitCode.cs
""")]
public enum CommandExitCode
{
#region 100 ~ 5xx HttpStatusCode
+4
View File
@@ -1,5 +1,9 @@
namespace BD.WTTS.Enums;
[Mobius(
"""
Mobius.Enums.Text.EncodingType
""")]
public enum EncodingType : byte
{
/// <summary>
@@ -23,6 +23,10 @@ namespace BD.WTTS.Enums;
/// <para>在<see cref="NotificationType_Channel_EnumExtensions.GetDescription(NotificationChannelType)"/>中添加渠道描述</para>
/// <para>在<see cref="NotificationType_Channel_EnumExtensions.GetImportanceLevel(NotificationChannelType)"/>中添加渠道重要性级别</para>
/// </summary>
[Mobius(
"""
Mobius.Enums.PlatformNotification.PlatformNotificationChannelType
""")]
public enum NotificationChannelType
{
/// <inheritdoc cref="NotificationType.NewVersion"/>
@@ -45,6 +49,10 @@ public enum NotificationChannelType
/// <summary>
/// Enum 扩展 <see cref="NotificationType"/> AND <see cref="NotificationChannelType"/>
/// </summary>
[Mobius(
"""
Mobius.Enums.PlatformNotification.PlatformNotificationType_Channel_EnumExtensions
""")]
public static partial class NotificationType_Channel_EnumExtensions
{
/// <summary>
+4
View File
@@ -3,6 +3,10 @@ namespace BD.WTTS.Enums;
/// <summary>
/// 退出操作系统方式
/// </summary>
[Mobius(
"""
Mobius.Enums.App.OSExitMode
""")]
public enum OSExitMode : byte
{
/// <summary>
@@ -4,6 +4,7 @@ namespace BD.WTTS.Enums;
/// 表示操作结果的枚举
/// </summary>
[Description("操作结果的枚举")]
[Mobius(Obsolete = true)]
public enum OperationResultType
{
/// <summary>
@@ -3,6 +3,10 @@ namespace BD.WTTS.Enums;
/// <summary>
/// 文本阅读器提供商
/// </summary>
[Mobius(
"""
Mobius.Enums.Text.TextReaderProvider
""")]
public enum TextReaderProvider
{
/// <summary>
@@ -1,5 +1,9 @@
namespace BD.WTTS.Enums;
[Mobius(
"""
Mobius.Enums.UI.GridLayoutType
""")]
public enum GridLayoutType
{
List = 0,
@@ -1,5 +1,9 @@
namespace BD.WTTS.Enums;
[Mobius(
"""
Mobius.Enums.UI.NavigationTransitionEffect
""")]
public enum NavigationTransitionEffect
{
None = 0,
+4
View File
@@ -4,6 +4,10 @@ namespace BD.WTTS.Enums;
/// <summary>
/// 资源图标
/// </summary>
[Mobius(
"""
Mobius.Enums.UI.ResIcon
""")]
public enum ResIcon
{
None,
@@ -4,6 +4,10 @@ namespace BD.WTTS.Enums;
/// <summary>
/// 指定是否可以调整窗口大小,并在可调整大小的情况下指定如何调整窗口大小。由 SetResizeMode 使用
/// </summary>
[Mobius(
"""
Mobius.Enums.UI.ResizeMode
""")]
public enum ResizeMode : byte
{
/// <summary>
@@ -1,6 +1,10 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Enums;
[Mobius(
"""
Mobius.Enums.UI.WindowBackgroundMaterial
""")]
public enum WindowBackgroundMaterial : byte
{
None = 0,
@@ -1,6 +1,10 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Enums;
[Mobius(
"""
Mobius.Enums.UI.XamlMediaStretch
""")]
public enum XamlMediaStretch : byte
{
None = 0,
@@ -3,10 +3,18 @@ namespace BD.WTTS;
/// <summary>
/// <see cref="ApiRspImpl"/> 的扩展函数
/// </summary>
[Mobius(
"""
Mobius.ApiRspImplHandleUIExtensions
""", Obsolete = true)]
public static class ApiRspImplHandleUIExtensions
{
const string TAG = "HandleUI";
[Mobius(
"""
Mobius.ApiRspImplHandleUIExtensions
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static void LogError(this ApiRspBase apiRsp, string message)
{
@@ -22,6 +30,10 @@ public static class ApiRspImplHandleUIExtensions
/// <param name="errorAppendText"></param>
/// <param name="errorFormat"></param>
/// <returns></returns>
[Mobius(
"""
Mobius.ApiRspImplHandleUIExtensions
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HandleUI(this ApiRspBase apiRsp, ToastIcon icon = ToastIcon.Error, string? errorAppendText = null, string? errorFormat = null)
{
@@ -52,6 +64,10 @@ public static class ApiRspImplHandleUIExtensions
/// <param name="errorAppendText"></param>
/// <param name="errorFormat"></param>
/// <returns></returns>
[Mobius(
"""
Mobius.ApiRspImplHandleUIExtensions
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HandleUI<TContent>(this ApiRsp<TContent> apiRsp,
[NotNullWhen(true)] out TContent? content, ToastIcon icon = ToastIcon.Error, string? errorAppendText = null, string? errorFormat = null)
@@ -107,6 +123,10 @@ public static class ApiRspImplHandleUIExtensions
/// <param name="errorAppendText"></param>
/// <param name="errorFormat"></param>
/// <returns></returns>
[Mobius(
"""
Mobius.ApiRspImplHandleUIExtensions
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HandleUIAllowNull<TContent>(this ApiRsp<TContent> apiRsp,
out TContent? content, ToastIcon icon = ToastIcon.Error, string? errorAppendText = null, string? errorFormat = null)
@@ -3,12 +3,15 @@ using System.Reactive.Disposables;
// ReSharper disable once CheckNamespace
namespace System;
[BD.Mobius(Obsolete = true)]
public static partial class CompositeDisposableExtensions
{
[BD.Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Add(this CompositeDisposable @this, Action dispose)
=> @this.Add(Disposable.Create(dispose));
[BD.Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Add(this CompositeDisposable @this, Func<ValueTask> dispose)
=> @this.Add(new AsyncDisposable(dispose));
@@ -7,6 +7,10 @@ namespace Microsoft.Extensions.DependencyInjection;
public static partial class ServiceCollectionExtensions
{
[BD.Mobius(
"""
Mobius.Helpers.*
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection AddPlatformService(
this IServiceCollection services,
@@ -4,6 +4,10 @@ namespace Microsoft.Extensions.DependencyInjection;
public static partial class ServiceCollectionExtensions
{
[BD.Mobius(
"""
Mobius.Helpers.WinScheduledTaskHelper
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection AddScheduledTaskService(this IServiceCollection services)
{
@@ -7,6 +7,7 @@ namespace System;
public static class ProcessExtensions
{
/// <inheritdoc cref="IPlatformService.GetCommandLineArgs(Process)"/>
[BD.Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string GetCommandLineArgs(this Process process)
{
@@ -8,6 +8,10 @@ public static partial class ServiceCollectionExtensions
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(
"""
BD.Common8.Security.Extensions.AddSecurityService
""")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection AddSecurityService(this IServiceCollection services)
{
@@ -10,6 +10,10 @@ public static partial class ServiceCollectionExtensions
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(
"""
Mobius.Helpers.LogInitHelper.AddMobiusLogging
""")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection AddGeneralLogging(this IServiceCollection services)
{
@@ -9,6 +9,10 @@ public static partial class ServiceCollectionExtensions
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(
"""
services.AddSingleton<IHostsFileService, HostsFileServiceImpl>();
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection AddHostsFileService(this IServiceCollection services)
{
@@ -3,6 +3,11 @@ namespace Microsoft.Extensions.DependencyInjection;
public static partial class ServiceCollectionExtensions
{
[BD.Mobius(
"""
services.AddSingleton<IUserRepository, UserRepository>();
services.AddSingleton<IRequestCacheRepository, RequestCacheRepository>();
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection AddRepositories(this IServiceCollection services)
{
@@ -3,6 +3,10 @@ namespace Microsoft.Extensions.DependencyInjection;
public static partial class ServiceCollectionExtensions
{
[BD.Mobius(
"""
AddFrontendToast
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection AddStartupToastIntercept(this IServiceCollection services)
{
@@ -8,6 +8,7 @@ public static partial class ServiceCollectionExtensions
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection AddViewModelManager(this IServiceCollection services)
{
@@ -8,6 +8,10 @@ public static partial class ServiceCollectionExtensions
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(
"""
services.AddSingleton<IHttpPlatformHelperService, ClientHttpPlatformHelperServiceImpl>();
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection TryAddClientHttpPlatformHelperService(this IServiceCollection services)
{
@@ -3,6 +3,7 @@ namespace Microsoft.Extensions.DependencyInjection;
public static partial class ServiceCollectionExtensions
{
[BD.Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection TryAddFontManager(this IServiceCollection services)
{
@@ -8,6 +8,10 @@ public static partial class ServiceCollectionExtensions
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(
"""
services.AddSingleton<IImageHttpClientService, ImageHttpClientServiceImpl>();
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection TryImageHttpClientService(this IServiceCollection services)
{
@@ -12,6 +12,10 @@ public static partial class ServiceCollectionExtensions
/// <param name="config"></param>
/// <param name="configureHandler"></param>
/// <returns></returns>
[BD.Mobius(
"""
services.AddSingleton<ISppWebApiService, SppWebApiServiceImpl>();
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection TryAddMicroServiceClient(
this IServiceCollection services)
@@ -8,6 +8,10 @@ public static partial class ServiceCollectionExtensions
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(
"""
services.AddSingleton<INativeNotificationService, NativeNotificationServiceImpl>();
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection TryAddNotificationService(this IServiceCollection services)
{
@@ -8,6 +8,10 @@ public static partial class ServiceCollectionExtensions
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(
"""
AddFrontendToast
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection TryAddToast(this IServiceCollection services)
=> ToastImpl.TryAddToast(services);
@@ -3,6 +3,10 @@ namespace Microsoft.Extensions.DependencyInjection;
public static partial class ServiceCollectionExtensions
{
[BD.Mobius(
"""
services.AddSingleton<IUserManager, BackendUserManager>();
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection TryAddUserManager(this IServiceCollection services)
{
@@ -3,8 +3,10 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(Obsolete = true)]
public static partial class CurrencyCodeEnumExtensions
{
[Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ECurrencyCode Convert(this CurrencyCode currencyCode)
{
@@ -13,6 +15,7 @@ public static partial class CurrencyCodeEnumExtensions
throw new ArgumentOutOfRangeException(nameof(currencyCode), currencyCode, null);
}
[Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static CurrencyCode Convert(this ECurrencyCode eCurrencyCode)
{
@@ -11,6 +11,10 @@ public static partial class ServiceCollectionExtensions
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(
"""
services.AddSingleton<ISteamService, FrontendSteamService>();
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection AddSteamService2(this IServiceCollection services)
{
@@ -13,6 +13,10 @@ namespace BD.WTTS;
/// <item>Logs: $XDG_CACHE_HOME/Steam++/Logs or $HOME/.cache/Steam++/Logs</item>
/// </list>
/// </summary>
[Mobius(
"""
Mobius.Helpers
""")]
sealed class LinuxFileSystem : IOPath.FileSystemBase
{
private LinuxFileSystem() => throw new NotSupportedException();
@@ -9,6 +9,10 @@ namespace BD.WTTS;
/// <item>Logs: ~/Library/Caches/Steam++/Logs</item>
/// </list>
/// </summary>
[Mobius(
"""
Mobius.Helpers
""")]
sealed class MacCatalystFileSystem : IOPath.FileSystemBase
{
private MacCatalystFileSystem() => throw new NotSupportedException();
@@ -10,6 +10,10 @@ namespace BD.WTTS;
/// <item>Logs: \Logs or %Tmp%\Steam++\Logs</item>
/// </list>
/// </summary>
[Mobius(
"""
Mobius.Helpers
""")]
sealed class WindowsFileSystem : IOPath.FileSystemBase
{
private WindowsFileSystem() => throw new NotSupportedException();
@@ -12,6 +12,10 @@ namespace BD.WTTS;
/// <item>Logs: %USERPROFILE%\AppData\Local\Packages\4651ED44255E.47979655102CE_k6txddmbb6c52\LocalCache\Logs</item>
/// </list>
/// </summary>
[Mobius(
"""
Mobius.Helpers
""")]
sealed class WindowsRuntimeFileSystem : IOPath.FileSystemBase
{
private WindowsRuntimeFileSystem() => throw new NotSupportedException();
@@ -7,6 +7,11 @@ using ICSharpCode.SharpZipLib.Zip.Compression;
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
use Mobius.Services.Abstractions.ICompressionService
OR CompressionHelper
""", Obsolete = true)]
public static class TarGZipHelper
{
/// <summary>
@@ -17,6 +22,7 @@ public static class TarGZipHelper
/// <param name="level">压缩等级,取值范围在 <see cref="Deflater.NO_COMPRESSION"/> ~ <see cref="Deflater.BEST_COMPRESSION"/></param>
/// <param name="progress">进度值监听</param>
/// <returns></returns>
[Mobius(Obsolete = true)]
public static bool Create(string filePath, string dirPath, int level = Deflater.BEST_COMPRESSION, ProgressMessageHandler? progress = null)
{
if (!filePath.EndsWith(FileEx.TAR_GZ)) filePath += FileEx.TAR_GZ;
@@ -64,6 +70,7 @@ public static class TarGZipHelper
/// <param name="progress">进度值监听</param>
/// <param name="maxProgress"></param>
/// <returns></returns>
[Mobius(Obsolete = true)]
public static bool Unpack(string filePath, string dirPath,
ProgressMessageHandler? progressMessage = null,
IProgress<float>? progress = null,
@@ -6,10 +6,18 @@ using Windows.ApplicationModel.Activation;
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
Mobius.Helpers.OSHelper
""")]
sealed class DesktopBridgeHelper : DesktopBridge
{
DesktopBridgeHelper() => throw new NotSupportedException();
[Mobius(
"""
Mobius.Helpers.OSHelper.Init
""")]
internal static bool Init(int min_os_build = 17763)
{
if (!OperatingSystem.IsWindowsVersionAtLeast(10, 0, min_os_build))
@@ -1,6 +1,10 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
Mobius.Helpers.DeviceIdHelper
""")]
public static class DeviceIdHelper
{
const int DeviceIdRLength = Constants.Lengths.DeviceIdR;
@@ -1,6 +1,10 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
Mobius.Helpers.DotNetRuntimeHelper
""")]
static class DotNetRuntimeHelper
{
// https://learn.microsoft.com/zh-cn/dotnet/core/tools/dotnet-environment-variables#net-sdk-and-cli-environment-variables
@@ -8,16 +8,19 @@ static partial class GlobalDllImportResolver
/// <summary>
/// e_sqlite3 SQLitePCLRaw.provider.e_sqlite3
/// </summary>
[Mobius(Obsolete = true)]
internal const string e_sqlite3 = "e_sqlite3";
/// <summary>
/// libSkiaSharp SkiaSharp
/// </summary>
[Mobius(Obsolete = true)]
internal const string libSkiaSharp = "libSkiaSharp";
/// <summary>
/// libHarfBuzzSharp
/// </summary>
[Mobius(Obsolete = true)]
internal const string libHarfBuzzSharp = "libHarfBuzzSharp";
#if WINDOWS || TOOL_PUBLISH
@@ -25,36 +28,44 @@ static partial class GlobalDllImportResolver
/// <summary>
/// av_libGLESv2.dll Avalonia.OpenGL
/// </summary>
[Mobius(Obsolete = true)]
internal const string av_libGLESv2 = "av_libGLESv2";
/// <summary>
/// WebView2Loader
/// </summary>
[Mobius(Obsolete = true)]
internal const string WebView2Loader = "WebView2Loader";
/// <summary>
/// WinDivert
/// </summary>
[Mobius(Obsolete = true)]
internal const string WinDivert = "WinDivert";
/// <summary>
/// WinDivert
/// </summary>
[Mobius(Obsolete = true)]
internal const string WinDivert32 = "WinDivert32";
/// <summary>
/// WinDivert
/// </summary>
[Mobius(Obsolete = true)]
internal const string WinDivert64 = "WinDivert64";
/// <summary>
/// 7z
/// </summary>
[Mobius(Obsolete = true)]
internal const string _7z = "7z";
[Mobius(Obsolete = true)]
internal const string xunyoucall64 = "xunyoucall64";
#endif
[Mobius(Obsolete = true)]
static IEnumerable<string> GetLibraryNames()
{
yield return e_sqlite3;
@@ -71,6 +82,7 @@ static partial class GlobalDllImportResolver
#pragma warning disable SA1304 // Non-private readonly fields should begin with upper-case letter
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
[Mobius(Obsolete = true)]
internal static readonly HashSet<string> libraryNames = new(GetLibraryNames());
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter
#pragma warning restore SA1304 // Non-private readonly fields should begin with upper-case letter
@@ -9,6 +9,7 @@ namespace BD.WTTS;
/// <para>本机库放入 .\native\win-x64\xxx.dll</para>
/// <para>参考:https://learn.microsoft.com/zh-cn/nuget/create-packages/supporting-multiple-target-frameworks#architecture-specific-folders</para>
/// </summary>
[Mobius(Obsolete = true)]
public static partial class GlobalDllImportResolver
{
#if DEBUG
@@ -18,6 +19,7 @@ public static partial class GlobalDllImportResolver
#endif
/// <inheritdoc cref="RID"/>
[Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static string GetRID()
{
@@ -53,11 +55,14 @@ public static partial class GlobalDllImportResolver
/// <summary>
/// https://learn.microsoft.com/zh-cn/dotnet/core/rid-catalog
/// </summary>
[Mobius(Obsolete = true)]
public static readonly string RID = GetRID();
[Mobius(Obsolete = true)]
static string? _BaseDirectory;
/// <inheritdoc cref="AppContext.BaseDirectory"/>
[Mobius(Obsolete = true)]
public static string BaseDirectory
{
get => _BaseDirectory ?? AppContext.BaseDirectory;
@@ -67,6 +72,7 @@ public static partial class GlobalDllImportResolver
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
//static string GetDllDirectory() => GetLibraryPath();
[Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string GetLibraryPath(string? libraryName = null, string? baseDirectory = null)
{
@@ -79,6 +85,7 @@ public static partial class GlobalDllImportResolver
return libraryPath;
}
[Mobius(Obsolete = true)]
const string fileExtension_ =
#if WINDOWS
".dll";
@@ -89,6 +96,7 @@ public static partial class GlobalDllImportResolver
#else
#endif
[Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static string GetLibraryFileName(string libraryName, string? fileExtension = null)
{
@@ -129,6 +137,7 @@ public static partial class GlobalDllImportResolver
return false;
}
[Mobius(Obsolete = true)]
public static nint Delegate(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
{
libraryName = libraryName.TrimEnd(fileExtension_, StringComparison.OrdinalIgnoreCase);
@@ -194,6 +203,7 @@ public static partial class GlobalDllImportResolver
/// <summary>
/// 调试时加载本机库之前将本机库位置移动到预设文件夹中
/// </summary>
[Mobius(Obsolete = true)]
public static void MoveFiles()
{
//Console.WriteLine("MoveFiles");
+4
View File
@@ -6,6 +6,10 @@ namespace BD.WTTS;
/// <summary>
/// Windows ICO 格式编码器
/// </summary>
[Mobius(
"""
Mobius.Helpers.IcoEncoder
""")]
public static class IcoEncoder
{
public static void Encode(Stream stream, IReadOnlyList<SKBitmap> bitmaps)
+2
View File
@@ -4,8 +4,10 @@ namespace BD.WTTS;
static partial class Interop
{
#if MACCATALYST || MACOS || LINUX || IOS || ANDROID
[Mobius(Obsolete = true)]
public static partial class Libc
{
[Mobius(Obsolete = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[LibraryImport("libc", EntryPoint = "geteuid", SetLastError = true)]
public static partial uint GetEUID();
+4
View File
@@ -5,6 +5,10 @@ using PointInt32 = System.Drawing.Point;
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
Mobius.Helpers.MouseHook
""")]
static partial class MouseHook
{
static PInvoke.User32.SafeHookHandle? _mouseHookHandle;
@@ -1,6 +1,7 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(Obsolete = true)]
static class ReflectionHelper
{
/// <summary>
@@ -9,6 +10,7 @@ static class ReflectionHelper
/// <param name="thisAssembly"></param>
/// <param name="stackTrace"></param>
/// <returns></returns>
[Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsInternalCall(Assembly thisAssembly, StackTrace stackTrace)
{
@@ -37,6 +39,7 @@ static class ReflectionHelper
}
/// <inheritdoc cref="IsInternalCall(Assembly, StackTrace)"/>
[Mobius(Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsInternalCall<T>(StackTrace stackTrace)
=> IsInternalCall(typeof(T).Assembly, stackTrace);
@@ -5,9 +5,12 @@
// ReSharper disable once CheckNamespace
namespace Microsoft.NodejsTools.SharedProject;
using BD;
/// <summary>
/// Utility for accessing window IShell* interfaces in order to use them to launch a process unelevated
/// </summary>
[Mobius(Obsolete = true)]
static class SystemUtility
{
/// <summary>
@@ -15,6 +18,7 @@ static class SystemUtility
/// process directly without it becoming elevated. So to workaround this, we have
/// explorer do the process creation (explorer is typically running unelevated).
/// </summary>
[Mobius(Obsolete = true)]
internal static void ExecuteProcessUnElevated(string process, string args, string currentDirectory = "")
{
var shellWindows = (IShellWindows)new CShellWindows();
@@ -1,6 +1,10 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
Mobius.Helpers.ImageUrlHelper
""")]
public static class ImageUrlHelper
{
/// <summary>
@@ -13,5 +17,9 @@ public static class ImageUrlHelper
/// </summary>
/// <param name="imageId"></param>
/// <returns></returns>
[Mobius(
"""
Mobius.Helpers.ImageUrlHelper
""")]
public static string? GetImageApiUrlById(Guid imageId) => imageId == default ? default : string.Format(GetImageApiUrl, imageId, IMicroServiceClient.Instance.ApiBaseUrl);
}
@@ -12,6 +12,10 @@ namespace Net.Codecrete.QrCodeGenerator;
static class QrCodeBitmapExtensions
{
[BD.Mobius(
"""
Mobius.Helpers.QRCodeHelper
""")]
public static SKBitmap ToBitmap(this QrCode qrCode, int scale, int border, SKColor foreground, SKColorType colorType = SKColorType.Argb4444, SKAlphaType alphaType = SKAlphaType.Premul)
{
// check arguments
@@ -6,6 +6,10 @@ namespace BD.WTTS;
partial class QRCodeHelper
{
[Mobius(
"""
Mobius.Helpers.QRCodeHelper
""")]
public static (QRCodeCreateResult result, Stream? stream, Exception? exception) Create(byte[] bytes, QrCode.Ecc? level = null)
{
level ??= QrCode.Ecc.Low;
@@ -1,11 +1,19 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
Mobius.Helpers.QRCodeHelper
""")]
public static partial class QRCodeHelper
{
/// <summary>
/// QRCode 生成结果
/// </summary>
[Mobius(
"""
Mobius.Helpers.QRCodeHelper
""")]
public enum QRCodeCreateResult
{
Success,
@@ -3,6 +3,10 @@ using AppResources = BD.WTTS.Client.Resources.Strings;
// ReSharper disable once CheckNamespace
namespace BD.WTTS.UI.ViewModels;
[Mobius(
"""
Mobius.Helpers.SendSmsUIHelper
""")]
public static class SendSmsUIHelper
{
public interface IViewModel
@@ -8,6 +8,10 @@ namespace BD.WTTS.UI.ViewModels;
/// <summary>
/// 第三方快速登录助手类
/// </summary>
[Mobius(
"""
Mobius.Helpers.ThirdPartyLoginHelper
""")]
public static class ThirdPartyLoginHelper
{
#if DEBUG
@@ -4,15 +4,27 @@ using AppResources = BD.WTTS.Client.Resources.Strings;
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
[Mobius(
"""
Mobius.Helpers.ShellHelper
""")]
static partial class UnixHelper
{
const string TAG = nameof(UnixHelper);
/// <inheritdoc cref="IPlatformService.RunShellAsync(string, bool)"/>
[Mobius(
"""
Mobius.Helpers.ShellHelper.RunAsync
""")]
public static ValueTask RunShellAsync(string script, bool requiredAdministrator)
=> RunShellAsync(script, requiredAdministrator, 3);
/// <inheritdoc cref="IPlatformService.RunShellAsync(string, bool)"/>
[Mobius(
"""
Mobius.Helpers.ShellHelper.RunAsync
""")]
static async ValueTask RunShellAsync(string script, bool requiredAdministrator, sbyte retry)
{
if (retry <= 0) return;
@@ -30,7 +42,10 @@ static partial class UnixHelper
return;
scriptContent.AppendLine($"echo \"{vm.Value}\" | sudo -S {script}");
}
scriptContent.AppendLine(script);
else
{
scriptContent.AppendLine(script);
}
var msg = RunShell(scriptContent.ToString());
if (!string.IsNullOrWhiteSpace(msg))
Toast.Show(ToastIcon.None, msg);
@@ -41,6 +56,10 @@ static partial class UnixHelper
/// </summary>
/// <param name="shell">脚本指令</param>
/// <returns>返回结果</returns>
[Mobius(
"""
Mobius.Helpers.ShellHelper.RunAsync
""")]
public static string RunShell(string shell)
=> Process2.RunShell(Process2.BinBash, shell, e => e.LogAndShowT(TAG));
}
@@ -5,6 +5,7 @@ namespace BD.WTTS.Logging;
/// 客户端日志
/// <para>https://github.com/dotnet/extensions/blob/v3.1.5/src/Logging/Logging.Console/src/ConsoleLogger.cs</para>
/// </summary>
[Mobius(Obsolete = true)]
public abstract class ClientLogger : ILogger
{
static readonly string _messagePadding;
+1
View File
@@ -3,6 +3,7 @@
namespace BD.WTTS.Logging;
/// <inheritdoc cref="ClientLogger"/>
[Mobius(Obsolete = true)]
public sealed partial class NSLogger : ClientLogger
{
public NSLogger(string name) : base(name)
@@ -3,6 +3,7 @@
namespace BD.WTTS.Logging;
[ProviderAlias("NSLog")]
[Mobius(Obsolete = true)]
public sealed class NSLoggerProvider : ILoggerProvider
{
private NSLoggerProvider() { }
+1
View File
@@ -6,6 +6,7 @@ namespace BD.WTTS.Logging;
/// <para>https://github.com/dotnet/extensions/blob/v3.1.5/src/Logging/shared/NullScope.cs</para>
/// <para>https://github.com/dotnet/runtime/blob/v5.0.0-rtm.20519.4/src/libraries/Common/src/Extensions/Logging/NullScope.cs</para>
/// </summary>
[Mobius(Obsolete = true)]
sealed class NullScope : IDisposable
{
public static NullScope Instance { get; } = new();
@@ -3,6 +3,7 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS.Logging;
[Mobius(Obsolete = true)]
internal sealed class OSLogLogger : ILogger<object>, ILogger
{
static readonly string _loglevelPadding = ": ";
@@ -9,6 +9,7 @@ namespace BD.WTTS.Logging;
/// <summary>
/// A provider of <see cref="OSLogLogger"/> instances.
/// </summary>
[Mobius(Obsolete = true)]
public sealed class OSLogLoggerProvider : ILoggerProvider
{
readonly ConcurrentDictionary<string, OSLogLogger> _loggers;
@@ -4,6 +4,7 @@ namespace BD.WTTS;
/// <summary>
/// 新版本破坏性更改迁移
/// </summary>
[Mobius("Migrations 文件夹")]
public static class Migrations
{
public const string DirName_Scripts = "Scripts";
@@ -0,0 +1,17 @@
namespace BD;
[AttributeUsage(AttributeTargets.All, Inherited = false)]
public sealed class MobiusAttribute : Attribute
{
public MobiusAttribute()
{
}
public MobiusAttribute(string str)
{
}
public bool Obsolete { get; set; }
}
@@ -3,6 +3,7 @@ namespace BD.WTTS.Models.Abstractions;
/// <summary>
/// 操作结果信息类,对操作结果进行封装
/// </summary>
[Mobius("ApiRspImpl", Obsolete = true)]
public interface IOperationResult
{
/// <summary>
@@ -22,6 +23,7 @@ public interface IOperationResult
}
/// <inheritdoc cref="IOperationResult"/>
[Mobius("ApiRspImpl", Obsolete = true)]
public interface IOperationResult<T> : IOperationResult
{
/// <summary>
@@ -31,6 +33,7 @@ public interface IOperationResult<T> : IOperationResult
}
/// <inheritdoc cref="IOperationResult{T}"/>
[Mobius("ApiRspImpl", Obsolete = true)]
public abstract class OperationResultBase<T> : IOperationResult<T>
{
#region 构造函数
+4
View File
@@ -5,6 +5,10 @@ namespace BD.WTTS.Models;
/// <summary>
/// Watt Toolkit 应用程序设置项
/// </summary>
[Mobius(
"""
Mobius.Models.App.AppSecrets
""")]
[MPObj, MP2Obj(SerializeLayout.Explicit)]
public sealed partial class AppSettings : IMicroServiceClient.ISettings
{
@@ -1,5 +1,24 @@
namespace BD.WTTS.Models;
[Mobius(
"""
BD.Common8.Essentials.Models.EssentialsFilePickerFileType
use EssentialsFilePickerFileType, var fileTypes = new EssentialsFilePickerFileType([new("??? Files"){...}]);
//var fileTypes = new EssentialsFilePickerFileType([
// new("JavaScript Files") {
// Patterns = [ "*.js", ],
// MimeTypes = [ MediaTypeNames.JS, ],
// //AppleUniformTypeIdentifiers =
// },
// new("Text Files") {
// Patterns = [ "*.txt", ],
// MimeTypes = [ MediaTypeNames.TXT, ],
// //AppleUniformTypeIdentifiers =
// },
// ]);
""")]
public sealed class AvaloniaFilePickerFileTypeFilter : IFilePickerFileType
{
public IEnumerable<Item> Values { get; }
+8
View File
@@ -2,6 +2,10 @@ using AppResources = BD.WTTS.Client.Resources.Strings;
namespace BD.WTTS.Models;
[Mobius(
"""
Mobius.Models.EnumModel
""")]
public abstract class EnumModel : ReactiveObject
{
public static IEnumerable<EnumModel<TEnum>> GetEnums<TEnum>() where TEnum : struct, Enum
@@ -16,6 +20,10 @@ public abstract class EnumModel : ReactiveObject
}
}
[Mobius(
"""
Mobius.Models.EnumModel<TEnum>
""")]
public class EnumModel<TEnum> : EnumModel where TEnum : struct, Enum
{
public EnumModel() { }

Some files were not shown because too many files have changed in this diff Show More