diff --git a/src/BD.WTTS.Client.Avalonia.App/AppDelegate.cs b/src/BD.WTTS.Client.Avalonia.App/AppDelegate.cs deleted file mode 100644 index 2868bedc0..000000000 --- a/src/BD.WTTS.Client.Avalonia.App/AppDelegate.cs +++ /dev/null @@ -1,13 +0,0 @@ -#if IOS || MACOS || MACCATALYST - -namespace BD.WTTS; - -[Register("AppDelegate")] -public sealed class AppDelegate : UIApplicationDelegate -{ - public sealed override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) - { - return true; - } -} -#endif \ No newline at end of file diff --git a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon1024.png b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon1024.png index d76627d49..9dade1b81 100644 Binary files a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon1024.png and b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon1024.png differ diff --git a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon128.png b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon128.png index 0f75ad9c6..69b101c66 100644 Binary files a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon128.png and b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon128.png differ diff --git a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon16.png b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon16.png index fbbb18701..76e95e502 100644 Binary files a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon16.png and b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon16.png differ diff --git a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon256.png b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon256.png index 5233b44b5..adac63fd3 100644 Binary files a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon256.png and b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon256.png differ diff --git a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon32.png b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon32.png index 5ac181616..8d0873cf4 100644 Binary files a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon32.png and b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon32.png differ diff --git a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon512.png b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon512.png index b152227c7..eb680fc5a 100644 Binary files a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon512.png and b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon512.png differ diff --git a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon64.png b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon64.png index 5c497ade8..fa393b992 100644 Binary files a/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon64.png and b/src/BD.WTTS.Client.Avalonia.App/Assets.xcassets/AppIcon.appiconset/Icon64.png differ diff --git a/src/BD.WTTS.Client.Avalonia.App/BD.WTTS.Client.Avalonia.App.csproj b/src/BD.WTTS.Client.Avalonia.App/BD.WTTS.Client.Avalonia.App.csproj index 9b29ac1be..43ae94d44 100644 --- a/src/BD.WTTS.Client.Avalonia.App/BD.WTTS.Client.Avalonia.App.csproj +++ b/src/BD.WTTS.Client.Avalonia.App/BD.WTTS.Client.Avalonia.App.csproj @@ -2,12 +2,9 @@ Steam++ - OutOfProcess Exe BD.WTTS AVALONIA;$(DefineConstants) - win-x64 - false @@ -18,6 +15,10 @@ WinExe + + osx-x64;osx-arm64 + + - - + @@ -135,15 +136,6 @@ - - - - - - - - - diff --git a/src/BD.WTTS.Client.Avalonia.App/Info.plist b/src/BD.WTTS.Client.Avalonia.App/Info.plist index 4b2e7dc13..9921ff2e5 100644 --- a/src/BD.WTTS.Client.Avalonia.App/Info.plist +++ b/src/BD.WTTS.Client.Avalonia.App/Info.plist @@ -24,5 +24,7 @@ © 长沙次元超越科技有限公司. All Rights Reserved. NSPrincipalClass NSApplication + XSAppIconAssets + Assets.xcassets/AppIcon.appiconset \ No newline at end of file diff --git a/src/BD.WTTS.Client.Avalonia.App/Program.cs b/src/BD.WTTS.Client.Avalonia.App/Program.cs index b24501d80..f485b5de0 100644 --- a/src/BD.WTTS.Client.Avalonia.App/Program.cs +++ b/src/BD.WTTS.Client.Avalonia.App/Program.cs @@ -33,7 +33,7 @@ static partial class Program if (!DesktopBridgeHelper.Init()) return 0; InitWithDesktopBridge(ref args); #elif IOS || MACOS || MACCATALYST - UIApplication.Main(args, null, typeof(AppDelegate)); + NSApplication.Init(); #endif var host = Host.Instance; @@ -71,6 +71,7 @@ static partial class Program } } +#if WINDOWS public static bool IsCustomEntryPoint { get; internal set; } /// @@ -88,6 +89,7 @@ static partial class Program AppContext.SetData("APP_CONTEXT_BASE_DIRECTORY", Environment.CurrentDirectory); return Main(Environment.GetCommandLineArgs().Skip(1).ToArray()); } +#endif #if WINDOWS_DESKTOP_BRIDGE static void InitWithDesktopBridge(ref string[] args) @@ -123,9 +125,6 @@ static partial class Program builder.With(new AvaloniaNativePlatformOptions { UseGpu = useGpu, - EnableMultiTouch = true, - UseDBusMenu = true, - EnableIme = true }); #elif LINUX builder.With(new X11PlatformOptions @@ -133,7 +132,7 @@ static partial class Program UseGpu = useGpu, EnableMultiTouch = true, UseDBusMenu = true, - EnableIme = true + EnableIme = true, }); #elif WINDOWS var useWgl = IApplication.UseWgl || GeneralSettings.UseWgl.Value; diff --git a/src/BD.WTTS.Client.Avalonia.App/Program/Program.OnCreateApplication.cs b/src/BD.WTTS.Client.Avalonia.App/Program/Program.OnCreateApplication.cs index bf45de619..5d61a4e7f 100644 --- a/src/BD.WTTS.Client.Avalonia.App/Program/Program.OnCreateApplication.cs +++ b/src/BD.WTTS.Client.Avalonia.App/Program/Program.OnCreateApplication.cs @@ -14,11 +14,16 @@ static partial class Program if (isOnCreateAppExecuting) return; isOnCreateAppExecuting = true; +#if WINDOWS + //#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID) #if DEBUG // 调试时移动本机库到 native,通常指定了单个 RID(RuntimeIdentifier) 后本机库将位于程序根目录上否则将位于 runtimes 文件夹中 GlobalDllImportResolver.MoveFiles(); #endif +#endif +#if WINDOWS + //#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID) // 监听当前应用程序域的程序集加载 AppDomain.CurrentDomain.AssemblyLoad += (_, args) => CurrentDomain_AssemblyLoad(args.LoadedAssembly); @@ -45,6 +50,7 @@ static partial class Program var assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (var assembly in assemblies) CurrentDomain_AssemblyLoad(assembly); +#endif AppDomain.CurrentDomain.AssemblyResolve += (_, args) => { @@ -161,7 +167,10 @@ static partial class Program #if DEBUG Console.WriteLine($"CurrentUICulture: {CultureInfo.CurrentUICulture}"); +#if WINDOWS + //#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID) Console.WriteLine($"RID: {GlobalDllImportResolver.RID}"); +#endif Console.WriteLine($"DefaultFontFamilyName: {SkiaSharp.SKTypeface.Default.FamilyName}"); Console.WriteLine($"DefaultFontFamilyName2: {IPlatformService.Instance.GetDefaultFontFamily()}"); Console.WriteLine("FontFamilies: "); diff --git a/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/linux-x64.pubxml b/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/linux-x64.pubxml index e861eb342..cdb9a0152 100644 --- a/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/linux-x64.pubxml +++ b/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/linux-x64.pubxml @@ -3,22 +3,22 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - - Release - Any CPU - bin\Release\Publish\linux-x64\ - FileSystem - <_TargetId>Folder - net7.0 - linux-x64 - false - false - false - false - true - false - false - false - true - + + Release + Any CPU + bin\Release\Publish\linux-x64\ + FileSystem + <_TargetId>Folder + net7.0 + linux-x64 + true + true + false + false + true + false + false + false + true + \ No newline at end of file diff --git a/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/win-arm64.pubxml b/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/win-arm64.pubxml index f655bcea4..62a4440bf 100644 --- a/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/win-arm64.pubxml +++ b/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/win-arm64.pubxml @@ -1,22 +1,22 @@ - + - - Release - Any CPU - bin\Release\Publish\win-arm64\ - FileSystem - <_TargetId>Folder - net7.0-windows10.0.19041.0 - win-arm64 - false - false - false - true - false - false - false - + + Release + Any CPU + bin\Release\Publish\win-arm64\ + FileSystem + <_TargetId>Folder + net7.0-windows10.0.19041.0 + win-arm64 + false + false + false + false + false + false + false + \ No newline at end of file diff --git a/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/win-x64.pubxml b/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/win-x64.pubxml index d3468833d..41c63ef8e 100644 --- a/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/win-x64.pubxml +++ b/src/BD.WTTS.Client.Avalonia.App/Properties/PublishProfiles/win-x64.pubxml @@ -3,21 +3,21 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - - Release - Any CPU - bin\Release\Publish\win-x64\ - FileSystem - <_TargetId>Folder - net7.0-windows10.0.19041.0 - win-x64 - false - false - false - false - false - false - false - false - + + Release + Any CPU + bin\Release\Publish\win-x64\ + FileSystem + <_TargetId>Folder + net7.0-windows10.0.19041.0 + win-x64 + false + false + false + false + false + false + false + false + \ No newline at end of file diff --git a/src/BD.WTTS.Client.Avalonia.App/Resources/LaunchScreen.xib b/src/BD.WTTS.Client.Avalonia.App/Resources/LaunchScreen.xib deleted file mode 100644 index e4e7335c0..000000000 --- a/src/BD.WTTS.Client.Avalonia.App/Resources/LaunchScreen.xib +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/BD.WTTS.Client.Avalonia.App/SceneDelegate.cs b/src/BD.WTTS.Client.Avalonia.App/SceneDelegate.cs deleted file mode 100644 index 20c5a84f9..000000000 --- a/src/BD.WTTS.Client.Avalonia.App/SceneDelegate.cs +++ /dev/null @@ -1,60 +0,0 @@ -#if IOS || MACOS || MACCATALYST - -namespace BD.WTTS; - -[Register("SceneDelegate")] -public sealed class SceneDelegate : UIResponder, IUIWindowSceneDelegate -{ - - [Export("window")] - public UIWindow? Window { get; set; } - - [Export("scene:willConnectToSession:options:")] - public void WillConnect(UIScene scene, UISceneSession session, UISceneConnectionOptions connectionOptions) - { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate `GetConfiguration` instead). - } - - [Export("sceneDidDisconnect:")] - public void DidDisconnect(UIScene scene) - { - // Called as the scene is being released by the system. - // This occurs shortly after the scene enters the background, or when its session is discarded. - // Release any resources associated with this scene that can be re-created the next time the scene connects. - // The scene may re-connect later, as its session was not neccessarily discarded (see UIApplicationDelegate `DidDiscardSceneSessions` instead). - } - - [Export("sceneDidBecomeActive:")] - public void DidBecomeActive(UIScene scene) - { - // Called when the scene has moved from an inactive state to an active state. - // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. - } - - [Export("sceneWillResignActive:")] - public void WillResignActive(UIScene scene) - { - // Called when the scene will move from an active state to an inactive state. - // This may occur due to temporary interruptions (ex. an incoming phone call). - } - - [Export("sceneWillEnterForeground:")] - public void WillEnterForeground(UIScene scene) - { - // Called as the scene transitions from the background to the foreground. - // Use this method to undo the changes made on entering the background. - } - - [Export("sceneDidEnterBackground:")] - public void DidEnterBackground(UIScene scene) - { - // Called as the scene transitions from the foreground to the background. - // Use this method to save data, release shared resources, and store enough scene-specific state information - // to restore the scene back to its current state. - } -} - -#endif - diff --git a/src/BD.WTTS.Client/Helpers/GlobalDllImportResolver.LibraryName.cs b/src/BD.WTTS.Client/Helpers/GlobalDllImportResolver.LibraryName.cs index 060541ac8..91c13b253 100644 --- a/src/BD.WTTS.Client/Helpers/GlobalDllImportResolver.LibraryName.cs +++ b/src/BD.WTTS.Client/Helpers/GlobalDllImportResolver.LibraryName.cs @@ -1,4 +1,5 @@ -#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID) +#if WINDOWS +//#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID) // ReSharper disable once CheckNamespace namespace BD.WTTS; diff --git a/src/BD.WTTS.Client/Helpers/GlobalDllImportResolver.cs b/src/BD.WTTS.Client/Helpers/GlobalDllImportResolver.cs index 81a7544bd..0a78adc0c 100644 --- a/src/BD.WTTS.Client/Helpers/GlobalDllImportResolver.cs +++ b/src/BD.WTTS.Client/Helpers/GlobalDllImportResolver.cs @@ -1,4 +1,5 @@ -#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID) +#if WINDOWS +//#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID) // ReSharper disable once CheckNamespace namespace BD.WTTS; diff --git a/src/README.md b/src/README.md index e6bdbf183..f0d0a263e 100644 --- a/src/README.md +++ b/src/README.md @@ -114,7 +114,7 @@ namespace Microsoft.Extensions.DependencyInjection - [.NET 分发打包](https://learn.microsoft.com/zh-cn/dotnet/core/distribution-packaging) - [环境变量 - 指定 .NET 运行时的位置](https://learn.microsoft.com/zh-cn/dotnet/core/tools/dotnet-environment-variables#dotnet_root-dotnet_rootx86) -### 程序目录结构 +### 程序目录结构(Windows) - dotnet 共享运行时,删除后将使用已安装的运行时,此目录参考 ```C:\Program Files\dotnet```,可自行升级运行库小版本号,二进制兼容 - host - fxr @@ -153,8 +153,44 @@ namespace Microsoft.Extensions.DependencyInjection - Steam++.Plugins.LocalAuth.dll - GameTools 游戏工具 - Steam++.Plugins.GameTools.dll -- Steam++.exe 主程序 -- Steam++.Uninstall.exe 卸载程序(WinForms?AOT?) +- Steam++.exe .NET Framework 二进制主程序 +- Steam++.exe.config 使用该配置文件以允许在 .NET Framework 3.5 ~ 4.8.1 中任意版本中兼容运行(从 Windows 7 ~ 11 中所有系统自带运行时) +- Steam++.Uninstall.exe 卸载程序(WinForms?AOT?) + +### 程序目录结构(Linux) +- Steam++ 本机二进制主程序 +- libe_sqlite3.so +- libHarfBuzzSharp.so +- libSkiaSharp.so +- native + - linux-x64 + - TODO? +- modules 可选模块 + - TODO +``` +改成 Windows 的目录结构,但在 AOT 的 AppHost 中无法加载已使用框架依赖发布的程序集,错误 Initialization for self-contained components is not supported +参考 +https://github.com/dotnet/runtime/issues/35329 +https://github.com/dotnet/runtime/search?l=C%2B%2B&q=get_is_framework_dependent +https://github.com/dotnet/runtime/blob/6702dc5c7814e624a42ab4615224920a5635beeb/src/native/corehost/runtime_config.cpp +https://github.com/dotnet/runtime/blob/main/docs/design/features/host-error-codes.md +https://github.com/dotnet/samples/blob/91355ef22a10ec614a2e8daefd68785066860d57/core/hosting/src/NativeHost/nativehost.cpp +``` + +### 程序目录结构(macOS) +- Steam++.app + - Contents + - Info.plist + - MacOS + - Steam++ 本机二进制主程序 + - MonoBundle + - Steam++.Accelerator.X64 网络加速控制台子服务进程二进制程序 + - Steam++.Accelerator.Arm64 + - PkgInfo + - Resources + +对子服务进程二进制程序的 RID 使用 ```RuntimeInformation.ProcessArchitecture.ToString()``` +通过 ```PublishFolderType="Assembly"``` 指定 Copy 到 MonoBundle 中,没有其他选项能够将其放在 MacOS 文件夹中 ### 应用分发(安装包程序方案) - Steam 软件商店 diff --git a/src/TFM_NET7_WITH_DESKTOP.props b/src/TFM_NET7_WITH_DESKTOP.props index 936141075..1dd0ad851 100644 --- a/src/TFM_NET7_WITH_DESKTOP.props +++ b/src/TFM_NET7_WITH_DESKTOP.props @@ -1,7 +1,7 @@ net7.0 - + $(TargetFrameworks);net7.0-macos;net7.0-windows10.0.19041.0 $(TargetFrameworks);net7.0-windows10.0.19041.0 $(TargetFrameworks);net7.0-macos $(TargetFrameworks)