diff --git a/.gitignore b/.gitignore index 0ad1873de..349629ffa 100644 --- a/.gitignore +++ b/.gitignore @@ -338,4 +338,6 @@ ASALocalRun/ .localhistory/ # BeatPulse healthcheck temp database -healthchecksdb \ No newline at end of file +healthchecksdb + +.DS_Store \ No newline at end of file diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml.cs b/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml.cs index 834caba5b..cddfc6d78 100644 --- a/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml.cs +++ b/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml.cs @@ -17,6 +17,8 @@ using WindowState = Avalonia.Controls.WindowState; #if WINDOWS using System.Windows.Shell; using WpfApplication = System.Windows.Application; +#elif MAC +using MonoMac.AppKit; #endif namespace System.Application.UI @@ -60,10 +62,12 @@ namespace System.Application.UI if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - if (!AppHelper.IsOfficialChannelPackage) - { - IsNotOfficialChannelPackageWarning(); - } +#if MAC + NSApplication.Init(); + var appDelegate = DI.Get(); + //AvaloniaLocator.CurrentMutable.Bind().ToConstant(appDelegate); + NSApplication.SharedApplication.Delegate = appDelegate; +#endif #region NotifyIcon @@ -115,6 +119,11 @@ namespace System.Application.UI AddJumpTask(); #endif + if (!AppHelper.IsOfficialChannelPackage) + { + IsNotOfficialChannelPackageWarning(); + } + desktop.MainWindow = MainWindow; desktop.Exit += ApplicationLifetime_Exit; desktop.ShutdownMode = ShutdownMode.OnExplicitShutdown; @@ -126,6 +135,9 @@ namespace System.Application.UI void ApplicationLifetime_Exit(object? sender, ControlledApplicationLifetimeExitEventArgs e) { compositeDisposable.Dispose(); +#if WINDOWS + WpfApplication.Current.Shutdown(); +#endif } void NotifyIcon_Click(object? sender, EventArgs e) @@ -175,9 +187,6 @@ namespace System.Application.UI { desktop.Shutdown(0); } -#if WINDOWS - WpfApplication.Current.Shutdown(); -#endif } #region IDisposable members diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia.App/Program.cs b/System.Application.SteamTools.Client.Desktop.Avalonia.App/Program.cs index c86b6c9fd..25f8f1783 100644 --- a/System.Application.SteamTools.Client.Desktop.Avalonia.App/Program.cs +++ b/System.Application.SteamTools.Client.Desktop.Avalonia.App/Program.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.ReactiveUI; using NLog; +using System.IO; using System.Threading.Tasks; namespace System.Application.UI @@ -13,6 +14,8 @@ namespace System.Application.UI [STAThread] static void Main(string[] args) { + FixNLogConfig(); + // 目前桌面端默认使用 SystemTextJson 如果出现兼容性问题可取消下面这行代码 // Serializable.DefaultJsonImplType = Serializable.JsonImplType.NewtonsoftJson; @@ -49,5 +52,30 @@ namespace System.Application.UI .With(new Win32PlatformOptions { AllowEglInitialization = true }) .LogToTrace() .UseReactiveUI(); + + static void FixNLogConfig() + { + const char directorySeparatorChar = '\\'; + if (Path.DirectorySeparatorChar != directorySeparatorChar) + { + const string fileName = "nlog.config"; + var filePath = Path.Combine(AppContext.BaseDirectory, fileName); + if (File.Exists(filePath)) + { + string logConfigStr; + try + { + logConfigStr = File.ReadAllText(filePath); + } + catch + { + return; + } + logConfigStr = logConfigStr.Replace(@"logs\", $"logs{Path.DirectorySeparatorChar}"); + File.Delete(filePath); + File.WriteAllText(filePath, logConfigStr); + } + } + } } } \ No newline at end of file diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia.App/Properties/PublishProfiles/osx-x64.pubxml b/System.Application.SteamTools.Client.Desktop.Avalonia.App/Properties/PublishProfiles/osx-x64.pubxml index 8b78f4ee8..271205366 100644 --- a/System.Application.SteamTools.Client.Desktop.Avalonia.App/Properties/PublishProfiles/osx-x64.pubxml +++ b/System.Application.SteamTools.Client.Desktop.Avalonia.App/Properties/PublishProfiles/osx-x64.pubxml @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - PUBLISH;$(DefineConstants) + MAC;PUBLISH;$(DefineConstants) Release Any CPU bin\Release\Publish\osx-x64 diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia.App/System.Application.SteamTools.Client.Desktop.Avalonia.App.csproj b/System.Application.SteamTools.Client.Desktop.Avalonia.App/System.Application.SteamTools.Client.Desktop.Avalonia.App.csproj index db16c773e..f8ac1a53b 100644 --- a/System.Application.SteamTools.Client.Desktop.Avalonia.App/System.Application.SteamTools.Client.Desktop.Avalonia.App.csproj +++ b/System.Application.SteamTools.Client.Desktop.Avalonia.App/System.Application.SteamTools.Client.Desktop.Avalonia.App.csproj @@ -15,6 +15,10 @@ net5.0-windows + + MAC;$(DefineConstants) + + Properties\AssemblyInfo.cs diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia/System.Application.SteamTools.Client.Desktop.Avalonia.csproj b/System.Application.SteamTools.Client.Desktop.Avalonia/System.Application.SteamTools.Client.Desktop.Avalonia.csproj index f5d2584e2..7f6724ed6 100644 --- a/System.Application.SteamTools.Client.Desktop.Avalonia/System.Application.SteamTools.Client.Desktop.Avalonia.csproj +++ b/System.Application.SteamTools.Client.Desktop.Avalonia/System.Application.SteamTools.Client.Desktop.Avalonia.csproj @@ -1,7 +1,7 @@  - net5.0 + netstandard2.1 System false diff --git a/System.Application.SteamTools.Client.Desktop.Linux/Application/Services/Implementation/LinuxDesktopPlatformServiceImpl.cs b/System.Application.SteamTools.Client.Desktop.Linux/Application/Services/Implementation/LinuxDesktopPlatformServiceImpl.cs index ef59a9454..2eaf0d48d 100644 --- a/System.Application.SteamTools.Client.Desktop.Linux/Application/Services/Implementation/LinuxDesktopPlatformServiceImpl.cs +++ b/System.Application.SteamTools.Client.Desktop.Linux/Application/Services/Implementation/LinuxDesktopPlatformServiceImpl.cs @@ -14,9 +14,12 @@ namespace System.Application.Services.Implementation return string.Empty; } + public const string kate = "kate"; + public const string vi = "vi"; + public string? GetFileName(TextReaderProvider provider) { - return null; + return vi; } public void SetBootAutoStart(bool isAutoStart, string name) diff --git a/System.Application.SteamTools.Client.Desktop.Linux/Application/UI/NotifyIcon.cs b/System.Application.SteamTools.Client.Desktop.Linux/Application/UI/NotifyIcon.cs index b5bf65d65..43fad508a 100644 --- a/System.Application.SteamTools.Client.Desktop.Linux/Application/UI/NotifyIcon.cs +++ b/System.Application.SteamTools.Client.Desktop.Linux/Application/UI/NotifyIcon.cs @@ -98,7 +98,7 @@ namespace System.Application.UI new LinuxTrayIcon(ToolTipText, IconPath, ContextMenu)); } , canTok.Token, TaskCreationOptions.AttachedToParent, TaskScheduler.Default); - }, MainThreadDesktop.DispatcherPriority.MaxValue); + }, MainThreadDesktop.DispatcherPriority.MaxValue, true); } } } diff --git a/System.Application.SteamTools.Client.Desktop.Linux/System.Application.SteamTools.Client.Desktop.Linux.csproj b/System.Application.SteamTools.Client.Desktop.Linux/System.Application.SteamTools.Client.Desktop.Linux.csproj index 5774fdafb..fbc5ca36c 100644 --- a/System.Application.SteamTools.Client.Desktop.Linux/System.Application.SteamTools.Client.Desktop.Linux.csproj +++ b/System.Application.SteamTools.Client.Desktop.Linux/System.Application.SteamTools.Client.Desktop.Linux.csproj @@ -1,7 +1,7 @@  - net5.0 + netstandard2.1 System diff --git a/System.Application.SteamTools.Client.Desktop.Mac/Application/Services/Implementation/MacDesktopPlatformServiceImpl.cs b/System.Application.SteamTools.Client.Desktop.Mac/Application/Services/Implementation/MacDesktopPlatformServiceImpl.cs index cb0e5b1bb..e2e2dd22a 100644 --- a/System.Application.SteamTools.Client.Desktop.Mac/Application/Services/Implementation/MacDesktopPlatformServiceImpl.cs +++ b/System.Application.SteamTools.Client.Desktop.Mac/Application/Services/Implementation/MacDesktopPlatformServiceImpl.cs @@ -14,14 +14,32 @@ namespace System.Application.Services.Implementation return string.Empty; } + void IDesktopPlatformService.StartProcess(string name, string filePath) + { + var p = Process.Start(new ProcessStartInfo + { + FileName = "open", + Arguments = $"-a \"{name}\" \"{filePath}\"", + }); + p?.Close(); + } + public string? GetFileName(TextReaderProvider provider) { - return null; + switch (provider) + { + case TextReaderProvider.VSCode: + return "Visual Studio Code"; + case TextReaderProvider.Notepad: + case TextReaderProvider.NotepadPlusPlus: + return "TextEdit"; + default: + return null; + } } public void SetBootAutoStart(bool isAutoStart, string name) { - } public string? GetSteamDirPath() diff --git a/System.Application.SteamTools.Client.Desktop.Mac/Application/UI/AppDelegateBase.cs b/System.Application.SteamTools.Client.Desktop.Mac/Application/UI/AppDelegateBase.cs new file mode 100644 index 000000000..e1614700c --- /dev/null +++ b/System.Application.SteamTools.Client.Desktop.Mac/Application/UI/AppDelegateBase.cs @@ -0,0 +1,62 @@ +using MonoMac.AppKit; +using MonoMac.Foundation; + +namespace System.Application.UI +{ + /// + /// This class is an AppDelegate helper specifically for Mac OSX + /// Int it's infinite wisdom and unlike Linux and or Windows Mac does not pass in the URL from a sqrl:// invokation + /// directly as a startup app paramter, instead it uses a System Event to do this which has to be registered + /// and listed to. + /// This requires us to use MonoMac to make it work with .net core + /// + [Register("AppDelegate")] + public sealed class AppDelegate : NSApplicationDelegate + { + public AppDelegate() + { + Init(); + } + + /// + /// Registers an event for handling URL Invokation + /// + void Init() + { + //Register this Apple Delegate globablly with Avalonia for Later Use + NSAppleEventManager.SharedAppleEventManager.SetEventHandler(this, new MonoMac.ObjCRuntime.Selector("handleGetURLEvent:withReplyEvent:"), AEEventClass.Internet, AEEventID.GetUrl); + } + + /// + /// Because we are creating our own mac application delegate we are removing / overriding + /// the one that Avalonia creates. This causes the application to not be handled as it should. + /// This is the Avalonia Implementation: https://github.com/AvaloniaUI/Avalonia/blob/5a2ef35dacbce0438b66d9f012e5f629045beb3d/native/Avalonia.Native/src/OSX/app.mm + /// So what we are doing here is re-creating this implementation to mimick their behavior. + /// + /// + public override void WillFinishLaunching(NSNotification notification) + { + if (NSApplication.SharedApplication.ActivationPolicy != NSApplicationActivationPolicy.Regular) + { + foreach (var x in NSRunningApplication.GetRunningApplications(@"com.apple.dock")) + { + x.Activate(NSApplicationActivationOptions.ActivateIgnoringOtherWindows); + break; + } + NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular; + } + } + + /// + /// Because we are creating our own mac application delegate we are removing / overriding + /// the one that Avalonia creates. This causes the application to not be handled as it should. + /// This is the Avalonia Implementation: https://github.com/AvaloniaUI/Avalonia/blob/5a2ef35dacbce0438b66d9f012e5f629045beb3d/native/Avalonia.Native/src/OSX/app.mm + /// So what we are doing here is re-creating this implementation to mimick their behavior. + /// + /// + public override void DidFinishLaunching(NSNotification notification) + { + NSRunningApplication.CurrentApplication.Activate(NSApplicationActivationOptions.ActivateIgnoringOtherWindows); + } + } +} \ No newline at end of file diff --git a/System.Application.SteamTools.Client.Desktop.Mac/Application/UI/NotifyIcon.cs b/System.Application.SteamTools.Client.Desktop.Mac/Application/UI/NotifyIcon.cs index ba02de879..10e50bc18 100644 --- a/System.Application.SteamTools.Client.Desktop.Mac/Application/UI/NotifyIcon.cs +++ b/System.Application.SteamTools.Client.Desktop.Mac/Application/UI/NotifyIcon.cs @@ -1,4 +1,4 @@ -using AppKit; +using MonoMac.AppKit; using System.Diagnostics.CodeAnalysis; namespace System.Application.UI @@ -99,6 +99,15 @@ namespace System.Application.UI StatusBarItem?.Dispose(); } + void Init() + { + var isMainThread = MainThreadDesktop.IsMainThread; + Console.WriteLine($"isMainThread: {isMainThread}"); + var systemStatusBar = NSStatusBar.SystemStatusBar; + StatusBarItem = systemStatusBar.CreateStatusItem(30); + StatusBarItem.ToolTip = ToolTipText; + } + /// /// Creates a new NotifyIcon instance and sets up some /// required resources. @@ -106,12 +115,8 @@ namespace System.Application.UI public NotifyIcon() { - MainThreadDesktop.BeginInvokeOnMainThread(() => - { - var systemStatusBar = NSStatusBar.SystemStatusBar; - StatusBarItem = systemStatusBar.CreateStatusItem(30); - StatusBarItem.ToolTip = ToolTipText; - }, MainThreadDesktop.DispatcherPriority.MaxValue); + MainThreadDesktop.BeginInvokeOnMainThread(Init, + MainThreadDesktop.DispatcherPriority.MaxValue, true); } } } \ No newline at end of file diff --git a/System.Application.SteamTools.Client.Desktop.Mac/ServiceCollectionExtensions.cs b/System.Application.SteamTools.Client.Desktop.Mac/ServiceCollectionExtensions.cs index 087a9c028..38102ee09 100644 --- a/System.Application.SteamTools.Client.Desktop.Mac/ServiceCollectionExtensions.cs +++ b/System.Application.SteamTools.Client.Desktop.Mac/ServiceCollectionExtensions.cs @@ -1,6 +1,7 @@ using System; using System.Application.Services; using System.Application.Services.Implementation; +using System.Application.UI; // ReSharper disable once CheckNamespace namespace Microsoft.Extensions.DependencyInjection @@ -11,6 +12,7 @@ namespace Microsoft.Extensions.DependencyInjection { if (DI.Platform == Platform.Apple) { + services.AddSingleton(); services.AddSingleton(); } else diff --git a/System.Application.SteamTools.Client.Desktop.Mac/System.Application.SteamTools.Client.Desktop.Mac.csproj b/System.Application.SteamTools.Client.Desktop.Mac/System.Application.SteamTools.Client.Desktop.Mac.csproj index 302244ea7..09ee25b7d 100644 --- a/System.Application.SteamTools.Client.Desktop.Mac/System.Application.SteamTools.Client.Desktop.Mac.csproj +++ b/System.Application.SteamTools.Client.Desktop.Mac/System.Application.SteamTools.Client.Desktop.Mac.csproj @@ -1,7 +1,7 @@  - net5.0 + netstandard2.1 System @@ -12,13 +12,11 @@ - + - - $(MSBuildExtensionsPath)\..\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.Mac\v2.0\Xamarin.Mac.dll - + diff --git a/System.Application.SteamTools.Client.Desktop.Windows/Application/Services/Implementation/WindowsDesktopPlatformServiceImpl.cs b/System.Application.SteamTools.Client.Desktop.Windows/Application/Services/Implementation/WindowsDesktopPlatformServiceImpl.cs index be88c0796..d4fc00a6c 100644 --- a/System.Application.SteamTools.Client.Desktop.Windows/Application/Services/Implementation/WindowsDesktopPlatformServiceImpl.cs +++ b/System.Application.SteamTools.Client.Desktop.Windows/Application/Services/Implementation/WindowsDesktopPlatformServiceImpl.cs @@ -1,4 +1,6 @@ -using Microsoft.Win32; +#pragma warning disable CA1416 // 验证平台兼容性 +using Microsoft.Win32; + using Microsoft.Win32.TaskScheduler; using System.Application.Models; using System.Application.UI; @@ -42,20 +44,50 @@ namespace System.Application.Services.Implementation public string HostsFilePath => mHostsFilePath.Value; + static string GetFolderPath(Environment.SpecialFolder folder) + { + switch (folder) + { + case Environment.SpecialFolder.ProgramFiles: + var trimEndMark = " (x86)"; + var value = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); + if (value.EndsWith(trimEndMark, StringComparison.OrdinalIgnoreCase)) + { + var value2 = value.Substring(0, value.Length - trimEndMark.Length); + if (Directory.Exists(value2)) + { + return value2; + } + } + return value; + default: + return Environment.GetFolderPath(folder); + } + } + public string? GetFileName(TextReaderProvider provider) { switch (provider) { - case TextReaderProvider.Notepad: - return "notepad"; case TextReaderProvider.NotepadPlusPlus: return "notepad++"; case TextReaderProvider.VSCode: - var vsCodePath = Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), - "Microsoft VS Code", - "Code.exe"); - return File.Exists(vsCodePath) ? vsCodePath : null; + var vsCodePaths = new[] { + GetFolderPath(Environment.SpecialFolder.ProgramFiles), + GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + }.Distinct().Select(x => Path.Combine(x, "Microsoft VS Code", "Code.exe")); + + foreach (var vsCodePath in vsCodePaths) + { + if (File.Exists(vsCodePath)) + { + return vsCodePath; + } + } + + return null; + case TextReaderProvider.Notepad: + return "notepad"; default: return null; } @@ -111,4 +143,5 @@ namespace System.Application.Services.Implementation public string GetLastSteamLoginUserName() => Registry.CurrentUser.Read(SteamRegistryPath, "AutoLoginUser"); } -} \ No newline at end of file +} +#pragma warning restore CA1416 // 验证平台兼容性 \ No newline at end of file diff --git a/System.Application.SteamTools.Client.Desktop/MainThreadDesktop.cs b/System.Application.SteamTools.Client.Desktop/MainThreadDesktop.cs index 3a2695ff8..5a204a89e 100644 --- a/System.Application.SteamTools.Client.Desktop/MainThreadDesktop.cs +++ b/System.Application.SteamTools.Client.Desktop/MainThreadDesktop.cs @@ -12,9 +12,9 @@ namespace System.Application { public static bool IsMainThread => Instance.PlatformIsMainThread; - public static void BeginInvokeOnMainThread(Action action, DispatcherPriority? priority = null) + public static void BeginInvokeOnMainThread(Action action, DispatcherPriority? priority = null, bool isForce = false) { - if (IsMainThread) + if (!isForce && IsMainThread) { action(); } @@ -24,9 +24,9 @@ namespace System.Application } } - public static Task InvokeOnMainThreadAsync(Action action, DispatcherPriority? priority = null) + public static Task InvokeOnMainThreadAsync(Action action, DispatcherPriority? priority = null, bool isForce = false) { - if (IsMainThread) + if (!isForce && IsMainThread) { action(); #if NETSTANDARD1_0 @@ -49,14 +49,14 @@ namespace System.Application { tcs.TrySetException(ex); } - }, priority); + }, priority, isForce); return tcs.Task; } - public static Task InvokeOnMainThreadAsync(Func func, DispatcherPriority? priority = null) + public static Task InvokeOnMainThreadAsync(Func func, DispatcherPriority? priority = null, bool isForce = false) { - if (IsMainThread) + if (!isForce && IsMainThread) { return Task.FromResult(func()); } @@ -74,14 +74,14 @@ namespace System.Application { tcs.TrySetException(ex); } - }, priority); + }, priority, isForce); return tcs.Task; } - public static Task InvokeOnMainThreadAsync(Func funcTask, DispatcherPriority? priority = null) + public static Task InvokeOnMainThreadAsync(Func funcTask, DispatcherPriority? priority = null, bool isForce = false) { - if (IsMainThread) + if (!isForce && IsMainThread) { return funcTask(); } @@ -100,14 +100,14 @@ namespace System.Application { tcs.SetException(e); } - }, priority); + }, priority, isForce); return tcs.Task; } - public static Task InvokeOnMainThreadAsync(Func> funcTask, DispatcherPriority? priority = null) + public static Task InvokeOnMainThreadAsync(Func> funcTask, DispatcherPriority? priority = null, bool isForce = false) { - if (IsMainThread) + if (!isForce && IsMainThread) { return funcTask(); } @@ -126,7 +126,7 @@ namespace System.Application { tcs.SetException(e); } - }, priority); + }, priority, isForce); return tcs.Task; } diff --git a/System.Application.SteamTools.Client.Desktop/Services/IDesktopPlatformService.cs b/System.Application.SteamTools.Client.Desktop/Services/IDesktopPlatformService.cs index f32469e77..f5d431b5f 100644 --- a/System.Application.SteamTools.Client.Desktop/Services/IDesktopPlatformService.cs +++ b/System.Application.SteamTools.Client.Desktop/Services/IDesktopPlatformService.cs @@ -26,6 +26,8 @@ namespace System.Application.Services /// string HostsFilePath => "/etc/hosts"; + void StartProcess(string name, string filePath) => Process.Start(name, filePath); + /// /// 使用文本阅读器打开文件 /// @@ -50,7 +52,7 @@ namespace System.Application.Services { try { - Process.Start(value, filePath); + StartProcess(value, filePath); return; } catch (Exception e) @@ -79,7 +81,7 @@ namespace System.Application.Services { var fileName = GetFileName(item); if (fileName == null) continue; - Process.Start(fileName, filePath); + StartProcess(fileName, filePath); return; } catch (Exception e) diff --git a/System.Application.SteamTools.Client.Desktop/Services/Implementation/HttpServiceImpl.cs b/System.Application.SteamTools.Client.Desktop/Services/Implementation/HttpServiceImpl.cs index 70126fb69..db6dea875 100644 --- a/System.Application.SteamTools.Client.Desktop/Services/Implementation/HttpServiceImpl.cs +++ b/System.Application.SteamTools.Client.Desktop/Services/Implementation/HttpServiceImpl.cs @@ -38,11 +38,11 @@ namespace System.Application.Services.Implementation var rspContentClrType = typeof(T); if (rspContentClrType == typeof(string)) { - return (T)(object)await response.Content.ReadAsStringAsync(cancellationToken); + return (T)(object)await response.Content.ReadAsStringAsync(); } else if (rspContentClrType == typeof(byte[])) { - return (T)(object)await response.Content.ReadAsByteArrayAsync(cancellationToken); + return (T)(object)await response.Content.ReadAsByteArrayAsync(); } else if (rspContentClrType == typeof(Stream)) { @@ -57,7 +57,7 @@ namespace System.Application.Services.Implementation case MediaTypeNames.XML_APP: { using var stream = await response.Content - .ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + .ReadAsStreamAsync().ConfigureAwait(false); using var reader = new StreamReader(stream, Encoding.UTF8); switch (mime) { diff --git a/System.Application.SteamTools.Client.Desktop/System.Application.SteamTools.Client.Desktop.csproj b/System.Application.SteamTools.Client.Desktop/System.Application.SteamTools.Client.Desktop.csproj index b2aa96dce..886b55758 100644 --- a/System.Application.SteamTools.Client.Desktop/System.Application.SteamTools.Client.Desktop.csproj +++ b/System.Application.SteamTools.Client.Desktop/System.Application.SteamTools.Client.Desktop.csproj @@ -1,7 +1,7 @@  - net5.0 + netstandard2.1 System.Application diff --git a/System.Common.CoreLib/Extensions/StringExtensions.Enhance.cs b/System.Common.CoreLib/Extensions/StringExtensions.Enhance.cs index b0a4f7d74..1de4ccfa6 100644 --- a/System.Common.CoreLib/Extensions/StringExtensions.Enhance.cs +++ b/System.Common.CoreLib/Extensions/StringExtensions.Enhance.cs @@ -13,7 +13,7 @@ /// /// 要查找的 Unicode 字符。 /// 如果找到该字符,则为 value 的从零开始的索引位置;如果未找到,则为 -1。 - public static int IndexOf_(this string str, char value) => DI.IsRunningOnMono ? str.IndexOf(value) : str.IndexOf(value, StringComparison.Ordinal); + public static int IndexOf_(this string str, char value) => str.IndexOf(value, StringComparison.Ordinal); /// /// 报告指定 Unicode 字符在此字符串中的第一个匹配项的从零开始的索引。