From b6733bf965ea1d69b175b82fc80e67eb7400488d Mon Sep 17 00:00:00 2001 From: Aigio Liu Date: Mon, 25 Apr 2022 18:28:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 191 ++++++- Directory.Packages.props | 537 +++++++++--------- references/.editorconfig | 7 + src/AboutAppInfoPopup.cs | 1 - .../Avalonia.Skia.Internals.csproj | 4 + .../SKTypefaceCollection.cs | 1 + src/Common.AreaLib/Common.AreaLib.csproj | 4 + .../Implementation/PlatformToastImpl.cs | 4 +- .../Common.ClientLib.iOS.csproj | 4 + .../Application/Essentials/DeviceInfo2.cs | 2 + .../Essentials/VersionTracking2.cs | 4 + .../Services/IDeviceInfoPlatformService.cs | 1 - .../LocalDataProtectionProviderBase.cs | 8 +- .../PreferencesPlatformServiceImpl.cs | 1 + .../Services/Implementation/ToastBaseImpl.cs | 4 +- .../UI/ViewModels/IdTitleIconViewModel.cs | 3 + src/Common.ClientLib/Common.ClientLib.csproj | 4 + .../Application/Models/PagedModel.cs | 6 +- .../Application/PhoneNumberHelper.cs | 3 +- .../Settings/SerializableProperty.cs | 2 + .../Application/Settings/SettingsHost.cs | 2 + .../Settings/ValueChangedEventArgs.cs | 1 + src/Common.CoreLib/Common.CoreLib.csproj | 4 + .../Extensions/ByteArrayExtensions.cs | 8 +- .../Extensions/StringExtensions.cs | 4 +- .../Extensions/TaskExtensions.cs | 1 - .../IO/FileFormats/VideoFormat.cs | 18 +- .../Http/GeneralHttpClientFactory.WebProxy.cs | 20 +- .../Net/Sockets/SocketHelper.cs | 15 +- .../Properties/ThisAssembly.DynamicVersion.cs | 3 + .../Security/Cryptography/AESUtils.cs | 6 +- src/Common.CoreLib/Serializable.cs | 5 +- src/Common.CoreLib/ShortGuid.cs | 8 +- .../Common.PinyinLib.CFStringTransform.csproj | 4 + .../PinyinImpl.cs | 1 - .../Common.PinyinLib.ChnCharInfo.csproj | 4 + .../Common.PinyinLib.TinyPinyin.csproj | 4 + src/Common.PinyinLib/Common.PinyinLib.csproj | 4 + .../AuthMessageRecordRepository.cs | 4 +- .../QueryableExtensions.cs | 4 +- .../Application.Repositories/Repository.cs | 2 + .../AsyncTableQueryExtensions.cs | 4 +- .../Repositories.sqlite-net-pcl.csproj | 4 + .../ST.Client.Android.App.Modern.csproj | 4 + .../ST.Client.Android.ResSecrets.csproj | 4 + src/ST.Client.Android/GoToPlatformPages.cs | 1 + .../ST.Client.Android.csproj | 4 + .../AndroidDeviceInfoPlatformServiceImpl.cs | 5 + .../AndroidNotificationServiceImpl.cs | 3 + .../AndroidWindowManagerImpl.cs | 2 + .../ProxyForegroundService.JNI.tun2http.cs | 10 + .../Services/Native/ProxyForegroundService.cs | 2 + .../Services/Shadowsocks/VpnService.cs | 1 + .../UI/Activities/GuideCACertActivity.cs | 1 + .../LocalAuthPage/ExportAuthActivity.cs | 1 - .../LocalAuthPage/SteamAuthTradeActivity.cs | 1 + .../UI/Activities/MainActivity3.cs | 1 + .../UI/Activities/ProxySettingsActivity.cs | 4 + .../UserProfile/UserProfileActivity.cs | 1 + .../Adapters/AccelerateProjectGroupAdapter.cs | 1 + src/ST.Client.Android/UI/Base/BaseActivity.cs | 2 + src/ST.Client.Android/UI/Base/BaseFragment.cs | 1 + .../UI/Base/BaseViewHolder.cs | 1 + .../UI/Base/ControllerBase.cs | 2 +- .../UI/Base/Features/ItemClick.cs | 7 +- .../UI/Base/Features/OnClick.cs | 12 + src/ST.Client.Android/UI/ComboBoxHelper.cs | 2 +- .../UI/Controllers/SettingsController.cs | 2 + .../ArchiSteamFarmPlus/ASFPlusFragment.cs | 1 + .../UI/Fragments/CommunityFixFragment.cs | 1 + .../LocalAuthPage/LocalAuthFragment.cs | 1 + .../UserProfile/UserBasicInfoFragment.cs | 2 + src/ST.Client.Android/UI/ImageLoader.cs | 1 + src/ST.Client.Android/UI/MainApplication.cs | 5 + .../Steam++.csproj | 4 + .../App.axaml.cs | 10 +- .../NotifyIconHelper.cs | 1 + src/ST.Client.Desktop.Avalonia.App/Program.cs | 2 + .../ST.Client.Avalonia.App.csproj | 4 + .../Converters/StringFormatConverter.cs | 1 - .../AvaloniaApplicationUpdateServiceImpl.cs | 1 + .../AvaloniaWin32WindowingPlatformImpl.cs | 6 +- .../AvaloniaWindowManagerImpl.cs | 1 - .../UserControl/ConsoleShell.axaml.cs | 1 + .../UserControl/ItemsSelector.axaml.cs | 1 - .../UI/Views/Controls/WallpaperControl.cs | 2 +- .../Application/UI/Views/MainView.axaml.cs | 1 - .../ArchiSteamFarmPlus/ASF_BotPage.axaml.cs | 1 - .../GameRelated_BorderlessPage.axaml.cs | 1 - .../Pages/Settings/Settings_General.axaml.cs | 1 + .../Views/Pages/Settings/Settings_UI.axaml.cs | 1 - .../UI/Views/Windows/DebugWindow.axaml.cs | 3 +- .../GameListPage/EditAppInfoWindow.axaml.cs | 1 - .../ST.Client.Avalonia.csproj | 4 + .../ST.Client.Linux.csproj | 4 + .../LinuxPlatformServiceImpl.cs | 6 +- .../Internals/UnixHelper.RunShellAsync.cs | 3 +- .../ST.Client.Mac.csproj | 4 + .../Implementation/MacPlatformServiceImpl.cs | 9 +- src/ST.Client.Desktop.Mac/UI/AppDelegate.cs | 1 + .../Internals/DWMApi.cs | 1 + .../Internals/MouseHook.cs | 2 + .../Internals/NativeMethods.cs | 5 +- .../Internals/UnmanagedMethods.cs | 19 + .../Internals/User32Window.cs | 2 +- .../Internals/WinInet.cs | 2 +- .../ST.Client.Windows.csproj | 4 + .../NativeWindowApiServiceImpl.cs | 5 +- .../Implementation/SteamServiceImpl.cs | 6 +- ...ormServiceImpl.UnelevatedProcessStarter.cs | 5 + .../WindowsPlatformServiceImpl.cs | 5 +- src/ST.Client.Desktop.Windows/VdfHelper.cs | 3 +- .../VisualStudioAppCenterSDK.cs | 5 +- .../Windows/Generated/Point.cs | 34 +- .../ST.Client.Mac.ResSecrets.csproj | 4 + .../ST.Client.Android.App.csproj | 4 +- .../ST.Client.ResSecrets.csproj | 4 + .../ST.Client.Windows.ResSecrets.csproj | 4 + .../ST.Client.XamarinForms.csproj | 4 + src/ST.Client.XamarinForms/UI/App.xaml.cs | 1 + .../UI/AppShell.xaml.cs | 2 +- .../UI/Controls/CardButton.cs | 2 + .../ST.Client.iOS.ResSecrets.csproj | 4 + src/ST.Client.iOS/ST.Client.iOS.csproj | 4 + src/ST.Client/Entities/Script.cs | 8 +- src/ST.Client/Models/AuthorizedDevice.cs | 15 +- src/ST.Client/Models/CurrentUser.cs | 2 +- src/ST.Client/Models/Enums/EnumModel.cs | 5 +- .../Models/MyAuthenticator.Mobile.cs | 1 + src/ST.Client/Models/MyAuthenticator.cs | 43 +- src/ST.Client/Models/SizePosition.cs | 5 +- src/ST.Client/Models/Steam/AchievementInfo.cs | 1 + src/ST.Client/Models/Steam/FloatStatInfo.cs | 7 +- src/ST.Client/Models/Steam/IntStatInfo.cs | 9 +- src/ST.Client/Models/Steam/KeyValue.cs | 2 +- src/ST.Client/Models/Steam/ModifiedApp.cs | 2 + src/ST.Client/Models/Steam/SteamApp.cs | 32 +- .../Models/Steam/SteamAppProperty.cs | 20 +- .../Models/Steam/SteamAppSaveFile.cs | 8 +- src/ST.Client/Models/Steam/SteamUser.cs | 9 +- .../Repositories/IScriptRepository.cs | 2 +- .../Implementation/ScriptRepository.cs | 6 +- src/ST.Client/ST.Client.csproj | 4 + src/ST.Client/Services/IDnsAnalysisService.cs | 1 - src/ST.Client/Services/IHttpProxyService.cs | 1 - .../Services/INotificationService.cs | 5 +- .../Services/IPlatformService.Linux.cs | 4 +- src/ST.Client/Services/IPlatformService.cs | 7 +- src/ST.Client/Services/IScriptManager.cs | 9 +- .../Services/ISteamGridDBWebApiServiceImpl.cs | 1 + .../ApplicationUpdateServiceBaseImpl.cs | 10 + .../ArchiSteamFarmServiceImpl.ASF_CRYPTKEY.cs | 1 - .../ArchiSteamFarmServiceImpl.cs | 2 + .../Implementation/HostsFileServiceImpl.cs | 2 + .../Implementation/HttpProxyServiceImpl.cs | 23 +- .../Services/Implementation/ScriptManager.cs | 8 +- .../Implementation/StartupToastIntercept.cs | 1 + .../Implementation/ViewModelManager.cs | 2 + src/ST.Client/Services/Mvvm/ASFService.cs | 4 + src/ST.Client/Services/Mvvm/AuthService.cs | 1 + .../Services/Mvvm/NotificationService.cs | 14 +- src/ST.Client/Services/Mvvm/ProxyService.cs | 9 +- .../Services/Mvvm/SteamConnectService.cs | 9 +- src/ST.Client/Services/Mvvm/ToastService.cs | 5 +- src/ST.Client/Services/Mvvm/UserService.cs | 11 +- src/ST.Client/Services/OperationResult.cs | 16 +- .../Settings/GameLibrarySettings.Avalonia.cs | 6 +- .../Settings/GeneralSettings.Android.cs | 2 +- .../Settings/GeneralSettings.Avalonia.cs | 10 +- .../Settings/ProxySettings.Avalonia.cs | 3 + src/ST.Client/Settings/ProxySettings.cs | 6 +- .../Settings/SteamAccountSettings.cs | 4 +- src/ST.Client/Settings/SteamSettings.cs | 7 +- src/ST.Client/Settings/UISettings.Avalonia.cs | 13 + src/ST.Client/StartupOptions.cs | 1 + src/ST.Client/SteamApiUrls.cs | 1 - src/ST.Client/SteamGridDBApiUrls.cs | 11 +- src/ST.Client/UI/IApplication.Log.cs | 7 +- .../UI/IApplication.SingletonInstance.cs | 1 + src/ST.Client/UI/Resx/R.cs | 3 + src/ST.Client/UI/ViewModels/AreaUIHelper.cs | 27 + .../UI/ViewModels/Base/IWindowViewModel.cs | 2 - .../UI/ViewModels/Base/TabItemViewModel.cs | 3 + .../UI/ViewModels/CustomTabItemViewModel.cs | 3 +- .../UI/ViewModels/General/ItemViewModel.cs | 2 + .../ViewModels/General/MenuItemViewModel.cs | 9 + .../General/MessageBoxWindowViewModel.cs | 5 +- .../UI/ViewModels/General/PageViewModel.cs | 2 +- .../General/TextBoxWindowViewModel.cs | 3 + .../UI/ViewModels/General/WindowViewModel.cs | 1 + .../MainWindowViewModel.TabItems.cs | 2 + .../UI/ViewModels/MainWindowViewModel.cs | 30 +- .../Pages/About/AboutPageViewModel.Mobile.cs | 2 + .../Pages/About/AboutPageViewModel.cs | 6 +- .../Pages/Account/AccountPageViewModel.cs | 6 +- .../ArchiSteamFarmPlusPageViewModel.cs | 9 +- .../UI/ViewModels/Pages/DebugPageViewModel.cs | 24 +- .../ViewModels/Pages/ExplorerPageViewModel.cs | 6 + .../ViewModels/Pages/GameListPageViewModel.cs | 18 +- .../GameRelated_BorderlessPageViewModel.cs | 5 +- .../Pages/LocalAuthPageViewModel.cs | 5 + .../UI/ViewModels/Pages/MyPageViewModel.cs | 4 + .../Pages/ProxyScriptManagePageViewModel.cs | 6 +- .../Pages/Settings/SettingsPageViewModel.cs | 9 +- .../UI/ViewModels/Pages/StartPageViewModel.cs | 1 - .../Pages/SteamAccountPageViewModel.cs | 25 +- .../UI/ViewModels/SendSmsUIHelper.cs | 3 +- .../UI/ViewModels/ThirdPartyLoginHelper.cs | 6 +- .../ASF_AddBotWindowViewModel.cs | 2 + .../Windows/BindPhoneNumberWindowViewModel.cs | 6 + .../ChangeBindPhoneNumberWindowViewModel.cs | 13 + .../AchievementWindowViewModel.cs | 8 +- .../EditAppInfoWindowViewModel.cs | 6 +- .../GameListPage/HideAppWindowViewModel.cs | 2 + .../GameListPage/IdleAppWindowViewModel.cs | 7 + .../SaveEditedAppInfoWindowViewModel.cs | 7 +- .../SteamShutdownWindowViewModel.cs | 3 +- .../AddAuthWindowViewModel.Mobile.cs | 2 +- .../LocalAuthPage/AddAuthWindowViewModel.cs | 48 +- .../AuthTradeWindowViewModel.Mobile.cs | 2 + .../LocalAuthPage/AuthTradeWindowViewModel.cs | 12 +- .../EncryptionAuthWindowViewModel.cs | 4 + .../ExportAuthWindowViewModel.cs | 11 +- .../Windows/LoginOrRegisterWindowViewModel.cs | 12 + .../NoticePage/NoticeWindowViewModel.cs | 4 + .../SignWindowViewModel.cs | 5 +- .../ScriptStoreWindowViewModel.cs | 3 + .../SteamAccountPage/ShareManageViewModel.cs | 1 + .../TaskBarWindowViewModel.TrayIcon.cs | 1 - .../Windows/UserProfileWindowViewModel.cs | 7 + .../Models/AccelerateProjectDTO.cs | 1 + .../Models/AccelerateProjectGroupDTO.cs | 6 +- .../Models/Advertisement/AdvertisementDTO.cs | 3 - .../ExternalTransaction/RankingRequest.cs | 1 + .../Models/Notice/NoticeDTO.cs | 22 +- .../Models/Notice/NoticeTypeDTO.cs | 6 +- .../Models/ScriptDTO.cs | 13 +- .../Models/ScriptRequest.cs | 2 - .../Models/ScriptResponse.cs | 73 +-- .../Models/UserInfoDTO.cs | 13 +- .../ST.Services.CloudService.Models.csproj | 4 + ...ST.Services.CloudService.ViewModels.csproj | 4 + ...APAuthenticatorValueDTO.Compat_WinAuth3.cs | 4 +- .../BattleNetAuthenticator.Compat_WinAuth3.cs | 22 +- .../HOTPAuthenticator.Compat_WinAuth3.cs | 5 +- .../SteamAuthenticator.Compat_WinAuth3.cs | 22 +- .../ST.Services.CloudService.csproj | 4 + .../Services/CloudService/ApiConnection.cs | 3 +- .../Clients/Abstractions/IAccountClient.cs | 2 + .../Clients/Abstractions/INoticeClient.cs | 4 +- .../CloudService/Clients/AccountClient.cs | 4 + .../Clients/DonateRankingClient.cs | 1 - .../CloudService/Clients/NoticeClient.cs | 2 +- .../CloudService/CloudServiceClientBase.cs | 11 +- .../CloudService/MockCloudServiceClient.cs | 10 +- .../Services/ICloudServiceClient.cs | 13 +- .../WinAuth/AuthenticatorException.cs | 5 + .../WinAuth/WinAuthSteamClient.cs | 16 +- src/ST.Tools.AndroidResourceLink/Program.cs | 4 +- .../ST.Tools.AndroidResourceLink.csproj | 4 + src/ST.Tools.AreaImport/Program.cs | 9 +- .../ST.Tools.AreaImport.csproj | 4 + src/ST.Tools.DesktopBridgeLink/Program.cs | 10 +- .../ST.Tools.DesktopBridgeLink.csproj | 4 + src/ST.Tools.MinifyStaticSites/Program.cs | 6 +- .../ST.Tools.MinifyStaticSites.csproj | 4 + .../ST.Tools.OpenSourceLibraryList.csproj | 4 + .../ST.Tools.Packager.InstallerSetup.csproj | 4 + src/ST.Tools.Packager/Program.cs | 6 +- .../ST.Tools.Packager.csproj | 4 + src/ST.Tools.Publish/MSBuild/TaskItem.cs | 2 +- src/ST.Tools.Publish/ST.Tools.Publish.csproj | 4 + .../Steps/StepAppHostPatcher.cs | 13 +- src/ST.Tools.Publish/Steps/Step_cd.cs | 11 +- src/ST.Tools.Publish/Steps/Step_rel.cs | 1 - src/ST.Tools.Publish/Steps/Step_start.cs | 3 +- src/ST.Tools.Publish/Utils.cs | 8 +- .../Commands/ProofreadCommand.cs | 3 +- .../Commands/ReadCommand.cs | 3 +- .../Commands/WriteCommand.cs | 1 - src/ST.Tools.Translate/Constants.cs | 3 +- .../ST.Tools.Translate.csproj | 4 + src/ST.Tools.Translate/Translate.cs | 19 +- src/ST.Tools.Translate/Utils.cs | 7 +- src/ST/BuildConfig.cs | 14 +- src/ST/FastLoginChannel.cs | 1 - src/ST/ST.csproj | 4 + .../AlibabaCloud/SmsSenderProvider.cs | 21 +- .../NetEaseCloud/SmsSenderProvider.cs | 3 +- src/Startup2.HandleGlobalException.cs | 6 +- src/Startup2.cs | 5 +- 291 files changed, 1677 insertions(+), 802 deletions(-) create mode 100644 references/.editorconfig diff --git a/.editorconfig b/.editorconfig index dc3ca11ee..71a03cea3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,7 +17,7 @@ charset = utf-8 [Makefile] indent_style = tab -[*.{js,json,xaml,axaml,xml,resx,resw,csproj,wapproj,appxmanifest,.props}] +[*.{js,json,xaml,axaml,xml,resx,resw,csproj,wapproj,appxmanifest,props}] indent_style = space indent_size = 2 @@ -240,3 +240,192 @@ dotnet_style_namespace_match_folder = false # IDE0130: 命名空间与文件夹结构不匹配 dotnet_diagnostic.IDE0130.severity = none + +# IDE0055: 修正格式 +dotnet_diagnostic.IDE0055.severity = error + +# IDE1006: 命名样式 +dotnet_diagnostic.IDE1006.severity = error + +# SA1600: Elements should be documented +dotnet_diagnostic.SA1600.severity = none + +# SA1629: Documentation text should end with a period +dotnet_diagnostic.SA1629.severity = silent + +# SA1101: Prefix local calls with this +dotnet_diagnostic.SA1101.severity = silent + +# SA1623: Property summary documentation should match accessors +dotnet_diagnostic.SA1623.severity = none + +# SA1200: Using directives should be placed correctly +dotnet_diagnostic.SA1200.severity = none + +# SA1208: System using directives should be placed before other using directives +dotnet_diagnostic.SA1208.severity = silent + +# Default severity for analyzer diagnostics with category 'StyleCop.CSharp.LayoutRules' +dotnet_analyzer_diagnostic.category-StyleCop.CSharp.LayoutRules.severity = error + +# SA1400: Access modifier should be declared +dotnet_diagnostic.SA1400.severity = silent + +# SA1633: File should have header +dotnet_diagnostic.SA1633.severity = silent + +# SA1128: Put constructor initializers on their own line +dotnet_diagnostic.SA1128.severity = silent + +# SA1413: Use trailing comma in multi-line initializers +dotnet_diagnostic.SA1413.severity = suggestion + +# SA1005: Single line comments should begin with single space +dotnet_diagnostic.SA1005.severity = none + +# SA1515: Single-line comment should be preceded by blank line +dotnet_diagnostic.SA1515.severity = silent + +# SA1512: Single-line comments should not be followed by blank line +dotnet_diagnostic.SA1512.severity = silent + +# SA1122: Use string.Empty for empty strings +dotnet_diagnostic.SA1122.severity = silent + +# SA1616: Element return value documentation should have text +dotnet_diagnostic.SA1616.severity = silent + +# SA1310: Field names should not contain underscore +dotnet_diagnostic.SA1310.severity = silent + +# SA1137: Elements should have the same indentation +dotnet_diagnostic.SA1137.severity = error + +# SA1503: Braces should not be omitted +dotnet_diagnostic.SA1503.severity = silent + +# SA1513: Closing brace should be followed by blank line +dotnet_diagnostic.SA1513.severity = silent + +# SA1402: File may only contain a single type +dotnet_diagnostic.SA1402.severity = silent + +# SA1133: Do not combine attributes +dotnet_diagnostic.SA1133.severity = silent + +# SA1011: Closing square brackets should be spaced correctly +dotnet_diagnostic.SA1011.severity = silent + +# SA1502: Element should not be on a single line +dotnet_diagnostic.SA1502.severity = silent + +# SA1201: Elements should appear in the correct order +dotnet_diagnostic.SA1201.severity = silent + +# SA1505: Opening braces should not be followed by blank line +dotnet_diagnostic.SA1505.severity = silent + +# SA1508: Closing braces should not be preceded by blank line +dotnet_diagnostic.SA1508.severity = silent + +# SA1614: Element parameter documentation should have text +dotnet_diagnostic.SA1614.severity = silent + +# SA1116: Split parameters should start on line after declaration +dotnet_diagnostic.SA1116.severity = silent + +# SA1601: Partial elements should be documented +dotnet_diagnostic.SA1601.severity = silent + +# SA1009: Closing parenthesis should be spaced correctly +dotnet_diagnostic.SA1009.severity = silent + +# SA1202: Elements should be ordered by access +dotnet_diagnostic.SA1202.severity = silent + +# SA1311: Static readonly fields should begin with upper-case letter +dotnet_diagnostic.SA1311.severity = silent + +# SA1127: Generic type constraints should be on their own line +dotnet_diagnostic.SA1127.severity = silent + +# SA1503: Braces should not be omitted +dotnet_diagnostic.SA1503.severity = silent + +# SA1649: File name should match first type name +dotnet_diagnostic.SA1649.severity = silent + +# SA1210: Using directives should be ordered alphabetically by namespace +dotnet_diagnostic.SA1210.severity = silent + +# SA1028: Code should not contain trailing whitespace +dotnet_diagnostic.SA1028.severity = silent + +# SA1204: Static elements should appear before instance elements +dotnet_diagnostic.SA1204.severity = silent + +# SA1203: Constants should appear before fields +dotnet_diagnostic.SA1203.severity = silent + +# SA1123: Do not place regions within elements +dotnet_diagnostic.SA1123.severity = silent + +# SA1615: Element return value should be documented +dotnet_diagnostic.SA1615.severity = silent + +# SA1611: Element parameters should be documented +dotnet_diagnostic.SA1611.severity = silent + +# SA1124: Do not use regions +dotnet_diagnostic.SA1124.severity = silent + +# SA1520: Use braces consistently +dotnet_diagnostic.SA1520.severity = silent + +# SA1107: Code should not contain multiple statements on one line +dotnet_diagnostic.SA1107.severity = silent + +# SA1312: Variable names should begin with lower-case letter +dotnet_diagnostic.SA1312.severity = error + +# SA1519: Braces should not be omitted from multi-line child statement +dotnet_diagnostic.SA1519.severity = silent + +# SA1000: Keywords should be spaced correctly +dotnet_diagnostic.SA1000.severity = silent + +# SA1205: Partial elements should declare access +dotnet_diagnostic.SA1205.severity = silent + +# SA1401: Fields should be private +dotnet_diagnostic.SA1401.severity = silent + +# SA1622: Generic type parameter documentation should have text +dotnet_diagnostic.SA1622.severity = silent + +# SA1627: Documentation text should not be empty +dotnet_diagnostic.SA1627.severity = silent + +# SA1403: File may only contain a single namespace +dotnet_diagnostic.SA1403.severity = silent + +# SA1602: Enumeration items should be documented +dotnet_diagnostic.SA1602.severity = silent + +# SA1108: Block statements should not contain embedded comments +dotnet_diagnostic.SA1108.severity = silent + +# SA1642: Constructor summary documentation should begin with standard text +dotnet_diagnostic.SA1642.severity = silent + +# SA1117: Parameters should be on same line or separate lines +dotnet_diagnostic.SA1117.severity = silent + +# SA1501: Statement should not be on a single line +dotnet_diagnostic.SA1501.severity = silent + +# SA1500: Braces for multi-line statements should not share line +dotnet_diagnostic.SA1500.severity = silent + +# SA1518: Use line endings correctly at end of file +dotnet_diagnostic.SA1518.severity = silent \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index 1b0bed779..b5bc10bb2 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,310 +1,313 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + - - + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - + + + - - - - - - + + + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - + + - - - - - - - + + + + + + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - + + - - + + - - - + + + - - - - + + + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - + + + + diff --git a/references/.editorconfig b/references/.editorconfig new file mode 100644 index 000000000..5293d630d --- /dev/null +++ b/references/.editorconfig @@ -0,0 +1,7 @@ +[*.cs] + +# IDE0055: 修正格式 +dotnet_diagnostic.IDE0055.severity = suggestion + +# IDE1006: 命名样式 +dotnet_diagnostic.IDE1006.severity = suggestion \ No newline at end of file diff --git a/src/AboutAppInfoPopup.cs b/src/AboutAppInfoPopup.cs index 64da417a8..3d1e97527 100644 --- a/src/AboutAppInfoPopup.cs +++ b/src/AboutAppInfoPopup.cs @@ -162,7 +162,6 @@ namespace System.Application.UI } #endif - b.Append("[memory.usage] "); #if __ANDROID__ var activityManager = activity.GetActivityManager(); diff --git a/src/Avalonia.Skia.Internals/Avalonia.Skia.Internals.csproj b/src/Avalonia.Skia.Internals/Avalonia.Skia.Internals.csproj index 10e8864c8..f195425c7 100644 --- a/src/Avalonia.Skia.Internals/Avalonia.Skia.Internals.csproj +++ b/src/Avalonia.Skia.Internals/Avalonia.Skia.Internals.csproj @@ -14,4 +14,8 @@ + + + + diff --git a/src/Avalonia.Skia.Internals/SKTypefaceCollection.cs b/src/Avalonia.Skia.Internals/SKTypefaceCollection.cs index 12d0c9efc..5fc8f43a9 100644 --- a/src/Avalonia.Skia.Internals/SKTypefaceCollection.cs +++ b/src/Avalonia.Skia.Internals/SKTypefaceCollection.cs @@ -9,6 +9,7 @@ namespace Avalonia.Skia public sealed class SKTypefaceCollection { readonly @this @this; + internal SKTypefaceCollection(@this @this) { this.@this = @this; diff --git a/src/Common.AreaLib/Common.AreaLib.csproj b/src/Common.AreaLib/Common.AreaLib.csproj index 77a1fee5a..3d0ad9fb9 100644 --- a/src/Common.AreaLib/Common.AreaLib.csproj +++ b/src/Common.AreaLib/Common.AreaLib.csproj @@ -37,4 +37,8 @@ SR.Designer.cs + + + + \ No newline at end of file diff --git a/src/Common.ClientLib.Droid/Application/Services/Implementation/PlatformToastImpl.cs b/src/Common.ClientLib.Droid/Application/Services/Implementation/PlatformToastImpl.cs index 1cd354ec3..1301e22c0 100644 --- a/src/Common.ClientLib.Droid/Application/Services/Implementation/PlatformToastImpl.cs +++ b/src/Common.ClientLib.Droid/Application/Services/Implementation/PlatformToastImpl.cs @@ -55,9 +55,9 @@ namespace System.Application.Services.Implementation Log.Error(TAG, e, "ShowDroidToast Error, text: {0}, IsMainThread: {1}", text, IsMainThread); // 解决在子线程中调用Toast的异常情况处理 Looper.Prepare(); - var _toast = AndroidToast.MakeText(context, text, duration2) + var toast_ = AndroidToast.MakeText(context, text, duration2) ?? throw new NullReferenceException("toast markeText Fail(2)"); - SetTextAndShow(_toast, text); + SetTextAndShow(toast_, text); Looper.Loop(); } diff --git a/src/Common.ClientLib.iOS/Common.ClientLib.iOS.csproj b/src/Common.ClientLib.iOS/Common.ClientLib.iOS.csproj index 88260b6d7..02b5e2a40 100644 --- a/src/Common.ClientLib.iOS/Common.ClientLib.iOS.csproj +++ b/src/Common.ClientLib.iOS/Common.ClientLib.iOS.csproj @@ -22,4 +22,8 @@ + + + + diff --git a/src/Common.ClientLib/Application/Essentials/DeviceInfo2.cs b/src/Common.ClientLib/Application/Essentials/DeviceInfo2.cs index 57c912e7f..620348685 100644 --- a/src/Common.ClientLib/Application/Essentials/DeviceInfo2.cs +++ b/src/Common.ClientLib/Application/Essentials/DeviceInfo2.cs @@ -9,6 +9,7 @@ namespace System.Application public static class DeviceInfo2 { static readonly Lazy @interface = new(DI.Get_Nullable); + static IDeviceInfoPlatformService? Interface => @interface.Value; /// @@ -205,6 +206,7 @@ namespace System.Application } return default; }); + public static OSNames.Value OSNameValue => _OSNameValue.Value; /// diff --git a/src/Common.ClientLib/Application/Essentials/VersionTracking2.cs b/src/Common.ClientLib/Application/Essentials/VersionTracking2.cs index 21b98e939..09121d60c 100644 --- a/src/Common.ClientLib/Application/Essentials/VersionTracking2.cs +++ b/src/Common.ClientLib/Application/Essentials/VersionTracking2.cs @@ -94,6 +94,7 @@ namespace System.Application } static bool mIsFirstLaunchEver; + /// /// 获取一个值,该值指示此应用是否首次在此设备上启动。 /// @@ -110,6 +111,7 @@ namespace System.Application return mIsFirstLaunchEver; } } + private set { mIsFirstLaunchEver = value; @@ -117,6 +119,7 @@ namespace System.Application } static bool mIsFirstLaunchForCurrentVersion; + /// /// 获取一个值,该值指示这是否是当前版本号的应用程序的首次启动。 /// @@ -133,6 +136,7 @@ namespace System.Application return mIsFirstLaunchForCurrentVersion; } } + private set { mIsFirstLaunchForCurrentVersion = value; diff --git a/src/Common.ClientLib/Application/Services/IDeviceInfoPlatformService.cs b/src/Common.ClientLib/Application/Services/IDeviceInfoPlatformService.cs index fd4c55c69..a7baf5bca 100644 --- a/src/Common.ClientLib/Application/Services/IDeviceInfoPlatformService.cs +++ b/src/Common.ClientLib/Application/Services/IDeviceInfoPlatformService.cs @@ -18,7 +18,6 @@ namespace System.Application.Services } } - namespace System.Application.Services.Implementation { public abstract class DeviceInfoPlatformServiceImpl : IDeviceInfoPlatformService diff --git a/src/Common.ClientLib/Application/Services/Implementation/LocalDataProtectionProviderBase.cs b/src/Common.ClientLib/Application/Services/Implementation/LocalDataProtectionProviderBase.cs index e35dd8209..8ef47284d 100644 --- a/src/Common.ClientLib/Application/Services/Implementation/LocalDataProtectionProviderBase.cs +++ b/src/Common.ClientLib/Application/Services/Implementation/LocalDataProtectionProviderBase.cs @@ -9,10 +9,16 @@ namespace System.Application.Services.Implementation /// public abstract class LocalDataProtectionProviderBase : ILocalDataProtectionProvider { - readonly Lazy _aes; #pragma warning disable IDE1006 // 命名样式 +#pragma warning disable SA1309 // Field names should not begin with underscore + readonly Lazy _aes; + +#pragma warning disable SA1300 // Element should begin with upper-case letter protected Aes aes => _aes.Value; +#pragma warning restore SA1300 // Element should begin with upper-case letter +#pragma warning restore SA1309 // Field names should not begin with underscore #pragma warning restore IDE1006 // 命名样式 + protected readonly LocalDataProtectionType defaultELocalDataProtectionType; protected readonly IProtectedData protectedData; protected readonly IDataProtectionProvider dataProtectionProvider; diff --git a/src/Common.ClientLib/Application/Services/Implementation/PreferencesPlatformServiceImpl.cs b/src/Common.ClientLib/Application/Services/Implementation/PreferencesPlatformServiceImpl.cs index c89b5b7b8..a93c11f4c 100644 --- a/src/Common.ClientLib/Application/Services/Implementation/PreferencesPlatformServiceImpl.cs +++ b/src/Common.ClientLib/Application/Services/Implementation/PreferencesPlatformServiceImpl.cs @@ -24,6 +24,7 @@ namespace System.Application.Services.Implementation if (sharedName == null) return GetId(key); return $"{key}_{sharedName}_S"; } + public void PlatformClear(string? sharedName) { conn.Execute(Sql_Delete_Where_SharedName_Equals, sharedName ?? string.Empty); diff --git a/src/Common.ClientLib/Application/Services/Implementation/ToastBaseImpl.cs b/src/Common.ClientLib/Application/Services/Implementation/ToastBaseImpl.cs index c1f695a14..35824b81d 100644 --- a/src/Common.ClientLib/Application/Services/Implementation/ToastBaseImpl.cs +++ b/src/Common.ClientLib/Application/Services/Implementation/ToastBaseImpl.cs @@ -47,8 +47,8 @@ namespace System.Application.Services.Implementation void Show_() { if (intercept.OnShowExecuting(text)) return; - var _duration = duration ?? CalcDurationByStringLength(text.Length); - PlatformShow(text, _duration); + var duration_ = duration ?? CalcDurationByStringLength(text.Length); + PlatformShow(text, duration_); } } catch (Exception e) diff --git a/src/Common.ClientLib/Application/UI/ViewModels/IdTitleIconViewModel.cs b/src/Common.ClientLib/Application/UI/ViewModels/IdTitleIconViewModel.cs index c7cd2a611..b8c2b7ea7 100644 --- a/src/Common.ClientLib/Application/UI/ViewModels/IdTitleIconViewModel.cs +++ b/src/Common.ClientLib/Application/UI/ViewModels/IdTitleIconViewModel.cs @@ -7,6 +7,7 @@ namespace System.Application.UI.ViewModels protected virtual bool IgnoreIcon { get; } protected TId? id; + /// /// 唯一键 /// @@ -28,6 +29,7 @@ namespace System.Application.UI.ViewModels } protected string title = string.Empty; + /// /// 标题文本 /// @@ -38,6 +40,7 @@ namespace System.Application.UI.ViewModels } protected TIcon? icon; + /// /// 图标 /// diff --git a/src/Common.ClientLib/Common.ClientLib.csproj b/src/Common.ClientLib/Common.ClientLib.csproj index 5d1334bc8..ad5e5a62c 100644 --- a/src/Common.ClientLib/Common.ClientLib.csproj +++ b/src/Common.ClientLib/Common.ClientLib.csproj @@ -31,4 +31,8 @@ + + + + \ No newline at end of file diff --git a/src/Common.CoreLib/Application/Models/PagedModel.cs b/src/Common.CoreLib/Application/Models/PagedModel.cs index c38e94896..d55a08892 100644 --- a/src/Common.CoreLib/Application/Models/PagedModel.cs +++ b/src/Common.CoreLib/Application/Models/PagedModel.cs @@ -28,10 +28,8 @@ namespace System.Application.Models if (mDataSource == null) mDataSource = new List(); return mDataSource; } - set - { - mDataSource = value; - } + + set => mDataSource = value; } [MPKey(1)] diff --git a/src/Common.CoreLib/Application/PhoneNumberHelper.cs b/src/Common.CoreLib/Application/PhoneNumberHelper.cs index b6a98e84f..46e253c6d 100644 --- a/src/Common.CoreLib/Application/PhoneNumberHelper.cs +++ b/src/Common.CoreLib/Application/PhoneNumberHelper.cs @@ -120,7 +120,8 @@ namespace System.Application /// /// 黑名单 /// - public static readonly byte[] Blacklist = new byte[] { + public static readonly byte[] Blacklist = new byte[] + { 148, 149, 146, // 物联网号段 }; } diff --git a/src/Common.CoreLib/Application/Settings/SerializableProperty.cs b/src/Common.CoreLib/Application/Settings/SerializableProperty.cs index 282d5832a..6cb6ebadb 100644 --- a/src/Common.CoreLib/Application/Settings/SerializableProperty.cs +++ b/src/Common.CoreLib/Application/Settings/SerializableProperty.cs @@ -41,6 +41,7 @@ namespace System.Application.Settings return _cached ? _value : Default; } + set { if (_cached && Equals(_value, value)) return; @@ -181,6 +182,7 @@ namespace System.Application.Settings if (value == null) return; ValueChanged += _handlers[value] = (sender, args) => value(sender, new PropertyChangedEventArgs(nameof(Value))); } + remove { if (value == null) return; diff --git a/src/Common.CoreLib/Application/Settings/SettingsHost.cs b/src/Common.CoreLib/Application/Settings/SettingsHost.cs index 907215121..0121a53f5 100644 --- a/src/Common.CoreLib/Application/Settings/SettingsHost.cs +++ b/src/Common.CoreLib/Application/Settings/SettingsHost.cs @@ -22,6 +22,7 @@ namespace System.Application.Settings protected static string GetLocalFilePath(string configName) => Path.Combine(IOPath.AppDataDirectory, configName); static readonly Lazy _LocalFilePath = new(() => GetLocalFilePath(ConfigName)); + public static string LocalFilePath => _LocalFilePath.Value; public static ISerializationProvider Local { get; } = new FileSettingsProvider(LocalFilePath); @@ -81,6 +82,7 @@ namespace System.Application.Settings } static readonly Lazy _CategoryName = new(() => typeof(TSettings).Name); + public static new string CategoryName => _CategoryName.Value; static string GetKey(string propertyName) => $"{CategoryName}.{propertyName}"; diff --git a/src/Common.CoreLib/Application/Settings/ValueChangedEventArgs.cs b/src/Common.CoreLib/Application/Settings/ValueChangedEventArgs.cs index 5ee3f4b4b..65d994535 100644 --- a/src/Common.CoreLib/Application/Settings/ValueChangedEventArgs.cs +++ b/src/Common.CoreLib/Application/Settings/ValueChangedEventArgs.cs @@ -3,6 +3,7 @@ namespace System.Application.Settings public sealed class ValueChangedEventArgs : EventArgs where T : notnull { public T? OldValue { get; } + public T? NewValue { get; } public ValueChangedEventArgs(T? oldValue, T? newValue) diff --git a/src/Common.CoreLib/Common.CoreLib.csproj b/src/Common.CoreLib/Common.CoreLib.csproj index d5a99d7ee..b3314b3a0 100644 --- a/src/Common.CoreLib/Common.CoreLib.csproj +++ b/src/Common.CoreLib/Common.CoreLib.csproj @@ -54,4 +54,8 @@ + + + + \ No newline at end of file diff --git a/src/Common.CoreLib/Extensions/ByteArrayExtensions.cs b/src/Common.CoreLib/Extensions/ByteArrayExtensions.cs index 616dbc855..1b3c2f46e 100644 --- a/src/Common.CoreLib/Extensions/ByteArrayExtensions.cs +++ b/src/Common.CoreLib/Extensions/ByteArrayExtensions.cs @@ -10,8 +10,8 @@ namespace System { public static sbyte[] ToSByteArray(this byte[] buffer) { - ReadOnlySpan _buffer = buffer; - return _buffer.ToSByteArray(); + ReadOnlySpan buffer_ = buffer; + return buffer_.ToSByteArray(); } public static sbyte[] ToSByteArray(this ReadOnlySpan buffer) @@ -19,8 +19,8 @@ namespace System public static byte[] ToByteArray(this sbyte[] buffer) { - ReadOnlySpan _buffer = buffer; - return _buffer.ToByteArray(); + ReadOnlySpan buffer_ = buffer; + return buffer_.ToByteArray(); } public static byte[] ToByteArray(this ReadOnlySpan buffer) diff --git a/src/Common.CoreLib/Extensions/StringExtensions.cs b/src/Common.CoreLib/Extensions/StringExtensions.cs index 4cb764c56..56a626647 100644 --- a/src/Common.CoreLib/Extensions/StringExtensions.cs +++ b/src/Common.CoreLib/Extensions/StringExtensions.cs @@ -37,7 +37,7 @@ namespace System yield break; } } - if (isDian || item >= '0' && item <= '9') + if (isDian || (item >= '0' && item <= '9')) { findChar = true; yield return item; @@ -52,12 +52,14 @@ namespace System } #region TryParse + /// /// 尝试将数字的字符串表示形式转换为 双精度浮点型 /// /// /// public static decimal? TryParseDecimal(this string value) => decimal.TryParse(value, out var temp) ? temp : null; + /// /// 尝试将数字的字符串表示形式转换为 双精度浮点型 /// diff --git a/src/Common.CoreLib/Extensions/TaskExtensions.cs b/src/Common.CoreLib/Extensions/TaskExtensions.cs index 85741f79c..0423eab13 100644 --- a/src/Common.CoreLib/Extensions/TaskExtensions.cs +++ b/src/Common.CoreLib/Extensions/TaskExtensions.cs @@ -106,7 +106,6 @@ namespace System Exception = exception; } - public static readonly EventHandler Occured = (sender, e) => { const string format = @"Unhandled Exception occured from Task.Forget() diff --git a/src/Common.CoreLib/IO/FileFormats/VideoFormat.cs b/src/Common.CoreLib/IO/FileFormats/VideoFormat.cs index 91714595d..ab72766ed 100644 --- a/src/Common.CoreLib/IO/FileFormats/VideoFormat.cs +++ b/src/Common.CoreLib/IO/FileFormats/VideoFormat.cs @@ -19,7 +19,7 @@ namespace System /// public static partial class VideoFormatEnumExtensions { - static readonly Lazy> _enum_mime = new(() => + static readonly Lazy> mEnumMime = new(() => { var value = new Dictionary() { @@ -28,31 +28,33 @@ namespace System }; return value; }); - static readonly Lazy> _mime_enum = new(() => + + static readonly Lazy> mMimeEnum = new(() => { - var value = enum_mime.ToDictionary(x => x.Value, x => x.Key, StringComparer.OrdinalIgnoreCase); + var value = EnumMime.ToDictionary(x => x.Value, x => x.Key, StringComparer.OrdinalIgnoreCase); return value; }); - static IReadOnlyDictionary enum_mime => _enum_mime.Value; - static IReadOnlyDictionary mime_enum => _mime_enum.Value; + static IReadOnlyDictionary EnumMime => mEnumMime.Value; + + static IReadOnlyDictionary MimeEnum => mMimeEnum.Value; /// /// 获取MIME /// - /// + /// /// /// public static string GetMIME(this VideoFormat videoFormat) { - if (enum_mime.ContainsKey(videoFormat)) return enum_mime[videoFormat]; + if (EnumMime.ContainsKey(videoFormat)) return EnumMime[videoFormat]; throw new ArgumentOutOfRangeException(nameof(videoFormat), videoFormat, null); } public static VideoFormat? GetFormat(string? mime) { if (mime == null) return null; - if (mime_enum.ContainsKey(mime)) return mime_enum[mime]; + if (MimeEnum.ContainsKey(mime)) return MimeEnum[mime]; return null; } } diff --git a/src/Common.CoreLib/Net/Http/GeneralHttpClientFactory.WebProxy.cs b/src/Common.CoreLib/Net/Http/GeneralHttpClientFactory.WebProxy.cs index 3c04cf93a..738aabd8a 100644 --- a/src/Common.CoreLib/Net/Http/GeneralHttpClientFactory.WebProxy.cs +++ b/src/Common.CoreLib/Net/Http/GeneralHttpClientFactory.WebProxy.cs @@ -25,6 +25,7 @@ namespace System.Net.Http #endif return UseWebProxy(proxy) ? proxy : null; } + set { #if NETSTANDARD @@ -62,9 +63,13 @@ namespace System.Net.Http sealed class HttpNoProxy : IWebProxy { public static readonly HttpNoProxy Instance = new(); + private HttpNoProxy() { } + public ICredentials? Credentials { get; set; } + public Uri? GetProxy(Uri destination) => null; + public bool IsBypassed(Uri host) => true; } @@ -75,14 +80,13 @@ namespace System.Net.Http { try { - -#if !NETSTANDARD - if (handler is SocketsHttpHandler s) - { - s.Proxy = proxy; - if (useProxy && s.UseProxy != useProxy) s.UseProxy = useProxy; // 仅启用代理时修改开关 - } - else +#if NETCOREAPP2_1_OR_GREATER + if (handler is SocketsHttpHandler s) + { + s.Proxy = proxy; + if (useProxy && s.UseProxy != useProxy) s.UseProxy = useProxy; // 仅启用代理时修改开关 + return; + } #endif if (handler is HttpClientHandler h) { diff --git a/src/Common.CoreLib/Net/Sockets/SocketHelper.cs b/src/Common.CoreLib/Net/Sockets/SocketHelper.cs index 34f90735e..8da16a42d 100644 --- a/src/Common.CoreLib/Net/Sockets/SocketHelper.cs +++ b/src/Common.CoreLib/Net/Sockets/SocketHelper.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; @@ -134,12 +133,16 @@ namespace System.Net.Sockets tcpTableRecords.Add(new TcpProcessRecord( new IPAddress(tcpRow.localAddr), new IPAddress(tcpRow.remoteAddr), - BitConverter.ToUInt16(new byte[2] { + BitConverter.ToUInt16(new byte[2] + { tcpRow.localPort[1], - tcpRow.localPort[0] }, 0), - BitConverter.ToUInt16(new byte[2] { + tcpRow.localPort[0] + }, 0), + BitConverter.ToUInt16(new byte[2] + { tcpRow.remotePort[1], - tcpRow.remotePort[0] }, 0), + tcpRow.remotePort[0] + }, 0), tcpRow.owningPid, tcpRow.state)); tableRowPtr = (IntPtr)((long)tableRowPtr + Marshal.SizeOf(tcpRow)); } @@ -235,6 +238,7 @@ namespace System.Net.Sockets public MibTcpState State { get; set; } int _ProcessId; + [DisplayName("Process ID")] public int ProcessId { @@ -258,6 +262,7 @@ namespace System.Net.Sockets } Lazy? _Process; + [DisplayName("Process")] public Process? Process => _Process?.Value; diff --git a/src/Common.CoreLib/Properties/ThisAssembly.DynamicVersion.cs b/src/Common.CoreLib/Properties/ThisAssembly.DynamicVersion.cs index a28ac209b..8b1e637d4 100644 --- a/src/Common.CoreLib/Properties/ThisAssembly.DynamicVersion.cs +++ b/src/Common.CoreLib/Properties/ThisAssembly.DynamicVersion.cs @@ -26,9 +26,11 @@ namespace System.Properties #if NETSTANDARD2_1 || NETCOREAPP2_1_OR_GREATER static readonly Lazy mIsBetaRelease = new(() => DynamicVersion.Contains(beta, StringComparison.Ordinal)); + public static bool IsBetaRelease => mIsBetaRelease.Value; static readonly Lazy mIsAlphaRelease = new(() => DynamicVersion.Contains(alpha, StringComparison.Ordinal)); + public static bool IsAlphaRelease => mIsAlphaRelease.Value; static readonly Lazy mVersionDisplay = new(() => @@ -36,6 +38,7 @@ namespace System.Properties Version version = new(Version); return $"{version.ToString(3)}{(IsAlphaRelease ? " α" : (IsBetaRelease ? " β" : ""))}{(version.Revision <= 0 ? "" : " rev." + version.Revision)}"; }); + public static string VersionDisplay => mVersionDisplay.Value; #endif } diff --git a/src/Common.CoreLib/Security/Cryptography/AESUtils.cs b/src/Common.CoreLib/Security/Cryptography/AESUtils.cs index 9d1ef12a0..806f38494 100644 --- a/src/Common.CoreLib/Security/Cryptography/AESUtils.cs +++ b/src/Common.CoreLib/Security/Cryptography/AESUtils.cs @@ -560,9 +560,9 @@ namespace System.Security.Cryptography { var uint16 = BitConverter.ToUInt16(data, 0); var flags = (Flags)uint16; - var IVByteArray = data.Skip(2).Take(16).ToArray(); - var KeyByteArray = data.Skip(18).Reverse().ToArray(); - return new Parameters(KeyByteArray, IVByteArray, flags); + var mIVByteArray = data.Skip(2).Take(16).ToArray(); + var mKeyByteArray = data.Skip(18).Reverse().ToArray(); + return new Parameters(mKeyByteArray, mIVByteArray, flags); } public static Parameters Create(string data) diff --git a/src/Common.CoreLib/Serializable.cs b/src/Common.CoreLib/Serializable.cs index 4a2791993..9b182570f 100644 --- a/src/Common.CoreLib/Serializable.cs +++ b/src/Common.CoreLib/Serializable.cs @@ -126,8 +126,9 @@ namespace System var formatting = writeIndented ? Formatting.Indented : Formatting.None; var settings = ignoreNullValues ? new JsonSerializerSettings { - NullValueHandling = NullValueHandling.Ignore - } : null; + NullValueHandling = NullValueHandling.Ignore, + } + : null; return SerializeObject(value, inputType, formatting, settings); #endif } diff --git a/src/Common.CoreLib/ShortGuid.cs b/src/Common.CoreLib/ShortGuid.cs index 4d93b4c20..7ef5873a8 100644 --- a/src/Common.CoreLib/ShortGuid.cs +++ b/src/Common.CoreLib/ShortGuid.cs @@ -350,8 +350,8 @@ namespace System /// public static bool operator ==(ShortGuid x, ShortGuid y) { - if (ReferenceEquals(x, null)) - return ReferenceEquals(y, null); + //if (ReferenceEquals(x, null)) + // return ReferenceEquals(y, null); return x.underlyingGuid == y.underlyingGuid; } @@ -361,8 +361,8 @@ namespace System /// public static bool operator ==(ShortGuid x, Guid y) { - if (ReferenceEquals(x, null)) - return ReferenceEquals(y, null); + //if (ReferenceEquals(x, null)) + // return ReferenceEquals(y, null); return x.underlyingGuid == y; } diff --git a/src/Common.PinyinLib.CFStringTransform/Common.PinyinLib.CFStringTransform.csproj b/src/Common.PinyinLib.CFStringTransform/Common.PinyinLib.CFStringTransform.csproj index 71301e643..4d0c83747 100644 --- a/src/Common.PinyinLib.CFStringTransform/Common.PinyinLib.CFStringTransform.csproj +++ b/src/Common.PinyinLib.CFStringTransform/Common.PinyinLib.CFStringTransform.csproj @@ -22,4 +22,8 @@ + + + + diff --git a/src/Common.PinyinLib.CFStringTransform/PinyinImpl.cs b/src/Common.PinyinLib.CFStringTransform/PinyinImpl.cs index 50e32c8ac..3f0f5fb21 100644 --- a/src/Common.PinyinLib.CFStringTransform/PinyinImpl.cs +++ b/src/Common.PinyinLib.CFStringTransform/PinyinImpl.cs @@ -43,7 +43,6 @@ namespace System.Application.Services.Implementation return Array.Empty(); } - bool IPinyin.IsChinese(char c) => TransformMandarinLatin(c.ToString(), out var _); } } \ No newline at end of file diff --git a/src/Common.PinyinLib.ChnCharInfo/Common.PinyinLib.ChnCharInfo.csproj b/src/Common.PinyinLib.ChnCharInfo/Common.PinyinLib.ChnCharInfo.csproj index c34bd04e9..3346b9744 100644 --- a/src/Common.PinyinLib.ChnCharInfo/Common.PinyinLib.ChnCharInfo.csproj +++ b/src/Common.PinyinLib.ChnCharInfo/Common.PinyinLib.ChnCharInfo.csproj @@ -25,4 +25,8 @@ + + + + diff --git a/src/Common.PinyinLib.TinyPinyin/Common.PinyinLib.TinyPinyin.csproj b/src/Common.PinyinLib.TinyPinyin/Common.PinyinLib.TinyPinyin.csproj index 53e4b9f6b..75ab15b7b 100644 --- a/src/Common.PinyinLib.TinyPinyin/Common.PinyinLib.TinyPinyin.csproj +++ b/src/Common.PinyinLib.TinyPinyin/Common.PinyinLib.TinyPinyin.csproj @@ -52,4 +52,8 @@ --> + + + + diff --git a/src/Common.PinyinLib/Common.PinyinLib.csproj b/src/Common.PinyinLib/Common.PinyinLib.csproj index 4d0059a66..69d5efcd6 100644 --- a/src/Common.PinyinLib/Common.PinyinLib.csproj +++ b/src/Common.PinyinLib/Common.PinyinLib.csproj @@ -22,4 +22,8 @@ + + + + diff --git a/src/Common.ServerLib/Application/Repositories/Implementation/AuthMessageRecordRepository.cs b/src/Common.ServerLib/Application/Repositories/Implementation/AuthMessageRecordRepository.cs index fb515eb9a..5cce87df8 100644 --- a/src/Common.ServerLib/Application/Repositories/Implementation/AuthMessageRecordRepository.cs +++ b/src/Common.ServerLib/Application/Repositories/Implementation/AuthMessageRecordRepository.cs @@ -30,9 +30,9 @@ namespace System.Application.Repositories.Implementation public async Task GetMostRecentVerificationCodeWithoutChecksumAndMoDiscard(TAuthMessageType type, string phoneNumberOrEmail, TSendSmsRequestType useType) { - var _30_minutes_before = DateTimeOffset.Now.AddSeconds(-SMS.SmsSendPeriodValidity); // 30分钟之前 + var m30_minutes_before = DateTimeOffset.Now.AddSeconds(-SMS.SmsSendPeriodValidity); // 30分钟之前 var query = Entity.OrderByDescending(x => x.CreationTime) // 时间倒排序 - .Where(x => x.RequestType.Equals(useType) && x.CreationTime >= _30_minutes_before && !x.Abandoned && !x.CheckSuccess && x.Type.Equals(type)); + .Where(x => x.RequestType.Equals(useType) && x.CreationTime >= m30_minutes_before && !x.Abandoned && !x.CheckSuccess && x.Type.Equals(type)); // 过滤条件 30分钟之前创建的短信 没有废弃的(!Abandoned) 并且是 没有成功的(!CheckSuccess) TAuthMessageRecord? item = default; diff --git a/src/Repositories.EFCore/QueryableExtensions.cs b/src/Repositories.EFCore/QueryableExtensions.cs index fb31258f2..e8ec72567 100644 --- a/src/Repositories.EFCore/QueryableExtensions.cs +++ b/src/Repositories.EFCore/QueryableExtensions.cs @@ -29,8 +29,8 @@ namespace System /// public static IQueryable WhereOr(this IQueryable source, params Expression>[] predicates) { - IReadOnlyList>> _predicates = predicates; - return source.WhereOr(_predicates); + IReadOnlyList>> predicates_ = predicates; + return source.WhereOr(predicates_); } #endregion diff --git a/src/Repositories.sqlite-net-pcl/Application.Repositories/Repository.cs b/src/Repositories.sqlite-net-pcl/Application.Repositories/Repository.cs index be7e4de7a..7dc5d94b0 100644 --- a/src/Repositories.sqlite-net-pcl/Application.Repositories/Repository.cs +++ b/src/Repositories.sqlite-net-pcl/Application.Repositories/Repository.cs @@ -29,6 +29,7 @@ namespace System.Application.Repositories if (string.IsNullOrWhiteSpace(mDataBaseDirectory)) mDataBaseDirectory = IOPath.AppDataDirectory; return mDataBaseDirectory; } + set { mDataBaseDirectory = value; @@ -36,6 +37,7 @@ namespace System.Application.Repositories } static SQLiteConnection? connectionSync; + static SQLiteConnection ConnectionSync { get diff --git a/src/Repositories.sqlite-net-pcl/AsyncTableQueryExtensions.cs b/src/Repositories.sqlite-net-pcl/AsyncTableQueryExtensions.cs index a9b750767..95b4b2c50 100644 --- a/src/Repositories.sqlite-net-pcl/AsyncTableQueryExtensions.cs +++ b/src/Repositories.sqlite-net-pcl/AsyncTableQueryExtensions.cs @@ -25,8 +25,8 @@ namespace System /// public static AsyncTableQuery WhereOr(this AsyncTableQuery source, params Expression>[] predicates) where T : new() { - IReadOnlyList>> _predicates = predicates; - return source.WhereOr(_predicates); + IReadOnlyList>> predicates_ = predicates; + return source.WhereOr(predicates_); } #endregion diff --git a/src/Repositories.sqlite-net-pcl/Repositories.sqlite-net-pcl.csproj b/src/Repositories.sqlite-net-pcl/Repositories.sqlite-net-pcl.csproj index b9b09d61e..ab2a60f3b 100644 --- a/src/Repositories.sqlite-net-pcl/Repositories.sqlite-net-pcl.csproj +++ b/src/Repositories.sqlite-net-pcl/Repositories.sqlite-net-pcl.csproj @@ -27,4 +27,8 @@ + + + + \ No newline at end of file diff --git a/src/ST.Client.Android.App.Modern/ST.Client.Android.App.Modern.csproj b/src/ST.Client.Android.App.Modern/ST.Client.Android.App.Modern.csproj index 68a752a0e..d6e640566 100644 --- a/src/ST.Client.Android.App.Modern/ST.Client.Android.App.Modern.csproj +++ b/src/ST.Client.Android.App.Modern/ST.Client.Android.App.Modern.csproj @@ -856,5 +856,9 @@ + + + + \ No newline at end of file diff --git a/src/ST.Client.Android.ResSecrets/ST.Client.Android.ResSecrets.csproj b/src/ST.Client.Android.ResSecrets/ST.Client.Android.ResSecrets.csproj index 2983a4e10..c69e5220e 100644 --- a/src/ST.Client.Android.ResSecrets/ST.Client.Android.ResSecrets.csproj +++ b/src/ST.Client.Android.ResSecrets/ST.Client.Android.ResSecrets.csproj @@ -31,4 +31,8 @@ + + + + diff --git a/src/ST.Client.Android/GoToPlatformPages.cs b/src/ST.Client.Android/GoToPlatformPages.cs index 6226cd629..604f71771 100644 --- a/src/ST.Client.Android/GoToPlatformPages.cs +++ b/src/ST.Client.Android/GoToPlatformPages.cs @@ -55,6 +55,7 @@ namespace System.Application => StartActivity(fragment, typeof(TActivity)); const string KEY_ViewModel = "ByteArrayViewModel"; + static void StartActivity(this Activity activity, Type activityType, byte[] viewModel) { var intent = new Intent(activity, activityType); diff --git a/src/ST.Client.Android/ST.Client.Android.csproj b/src/ST.Client.Android/ST.Client.Android.csproj index f17d9667e..5f14ccc08 100644 --- a/src/ST.Client.Android/ST.Client.Android.csproj +++ b/src/ST.Client.Android/ST.Client.Android.csproj @@ -795,4 +795,8 @@ Resources\xml\local_auth_appwidget_info.xml + + + + \ No newline at end of file diff --git a/src/ST.Client.Android/Services/Implementation/AndroidDeviceInfoPlatformServiceImpl.cs b/src/ST.Client.Android/Services/Implementation/AndroidDeviceInfoPlatformServiceImpl.cs index d1bfb69ad..c93d3558a 100644 --- a/src/ST.Client.Android/Services/Implementation/AndroidDeviceInfoPlatformServiceImpl.cs +++ b/src/ST.Client.Android/Services/Implementation/AndroidDeviceInfoPlatformServiceImpl.cs @@ -15,6 +15,8 @@ namespace System.Application.Services.Implementation { // 参考 https://github.com/gingo/android-emulator-detector/blob/master/EmulatorDetectorProject/EmulatorDetector/src/main/java/net/skoumal/emulatordetector/EmulatorDetector.java return DeviceInfo.DeviceType == DeviceType.Virtual || _(); +#pragma warning disable SA1312 // Variable names should begin with lower-case letter +#pragma warning disable SA1300 // Element should begin with upper-case letter static bool contains(string l, string r) { return l.Contains(r, StringComparison.OrdinalIgnoreCase); @@ -158,6 +160,8 @@ namespace System.Application.Services.Implementation } return rating > 3; } +#pragma warning restore SA1300 // Element should begin with upper-case letter +#pragma warning restore SA1312 // Variable names should begin with lower-case letter } /// @@ -194,6 +198,7 @@ namespace System.Application.Services.Implementation return false; } } + static readonly Lazy mIsChromeOS = new(GetIsChromeOS); } } diff --git a/src/ST.Client.Android/Services/Implementation/AndroidNotificationServiceImpl.cs b/src/ST.Client.Android/Services/Implementation/AndroidNotificationServiceImpl.cs index a51728a3b..bcd617770 100644 --- a/src/ST.Client.Android/Services/Implementation/AndroidNotificationServiceImpl.cs +++ b/src/ST.Client.Android/Services/Implementation/AndroidNotificationServiceImpl.cs @@ -21,6 +21,7 @@ namespace System.Application.Services.Implementation readonly IAndroidApplication app; readonly NotificationManagerCompat manager; + public AndroidNotificationServiceImpl(IAndroidApplication app) { this.app = app; @@ -281,7 +282,9 @@ namespace System.Application.Services.Implementation // 平台层采用 int 整型作为进度值,范围从0~10000,转换需要 乘 100 const int unit_convert_multiple = 100; // 从float到int转换单位倍数 const float PROGRESS_MAX = CC.MaxProgress * unit_convert_multiple; // 进度条满值 +#pragma warning disable SA1312 // Variable names should begin with lower-case letter int PROGRESS_MAX_INT32 = PROGRESS_MAX.ToInt32(); +#pragma warning restore SA1312 // Variable names should begin with lower-case letter // 发出零进度的初始通知 // Issue the initial notification with zero progress builder.SetProgress(PROGRESS_MAX_INT32, 0, false); diff --git a/src/ST.Client.Android/Services/Implementation/AndroidWindowManagerImpl.cs b/src/ST.Client.Android/Services/Implementation/AndroidWindowManagerImpl.cs index 8dd764a37..8b3c50b1b 100644 --- a/src/ST.Client.Android/Services/Implementation/AndroidWindowManagerImpl.cs +++ b/src/ST.Client.Android/Services/Implementation/AndroidWindowManagerImpl.cs @@ -30,7 +30,9 @@ namespace System.Application.Services.Implementation */ protected static string PositiveButtonText => AppResources.Confirm; + protected static string NegativeButtonText => AppResources.Cancel; + protected static string NeutralButtonText => AppResources.RememberChooseNotToAskAgain; protected async Task PlatformShowWindow(CustomWindow customWindow, PageViewModel? viewModel = null, string title = "") diff --git a/src/ST.Client.Android/Services/Native/ProxyForegroundService.JNI.tun2http.cs b/src/ST.Client.Android/Services/Native/ProxyForegroundService.JNI.tun2http.cs index 7eba27801..e910ec5d5 100644 --- a/src/ST.Client.Android/Services/Native/ProxyForegroundService.JNI.tun2http.cs +++ b/src/ST.Client.Android/Services/Native/ProxyForegroundService.JNI.tun2http.cs @@ -12,24 +12,30 @@ namespace System.Application.Services.Native [DllImport(tun2http, EntryPoint = "Java_tun_proxy_service_Tun2HttpVpnService_jni_1init")] static extern void jni_init(IntPtr env, IntPtr thiz); + [DllImport(tun2http, EntryPoint = "Java_tun_proxy_service_Tun2HttpVpnService_jni_1start")] static extern void jni_start(IntPtr env, IntPtr thiz, IntPtr tun, IntPtr fwd53, IntPtr rcode, IntPtr proxyIp, IntPtr proxyPort); + [DllImport(tun2http, EntryPoint = "Java_tun_proxy_service_Tun2HttpVpnService_jni_1stop")] static extern void jni_stop(IntPtr env, IntPtr thiz, IntPtr tun); + [DllImport(tun2http, EntryPoint = "Java_tun_proxy_service_Tun2HttpVpnService_jni_1get_1mtu")] static extern int jni_get_mtu(IntPtr env, IntPtr thiz); + [DllImport(tun2http, EntryPoint = "Java_tun_proxy_service_Tun2HttpVpnService_jni_1done")] static extern void jni_done(IntPtr env, IntPtr thiz); + [DllImport(tun2http, EntryPoint = "Java_tun_utils_Util_jni_1getprop")] static extern string jni_getprop(IntPtr env, IntPtr thiz, IntPtr name); #pragma warning disable IDE1006 // 命名样式 void jni_init() => jni_init(JNIEnv.Handle, Handle); + void jni_start(int tun, bool fwd53, int rcode, string proxyIp, int proxyPort) { var tun_ = new Java.Lang.Integer(tun); @@ -39,13 +45,17 @@ namespace System.Application.Services.Native var proxyPort_ = new Java.Lang.Integer(proxyPort); jni_start(JNIEnv.Handle, Handle, tun_.Handle, fwd53_.Handle, rcode_.Handle, proxyIp_.Handle, proxyPort_.Handle); } + void jni_stop(int tun) { var tun_ = new Java.Lang.Integer(tun); jni_stop(JNIEnv.Handle, Handle, tun_.Handle); } + int jni_get_mtu() => jni_get_mtu(JNIEnv.Handle, Handle); + void jni_done() => jni_init(JNIEnv.Handle, Handle); + string jni_getprop(string name) { var name_ = new Java.Lang.String(name); diff --git a/src/ST.Client.Android/Services/Native/ProxyForegroundService.cs b/src/ST.Client.Android/Services/Native/ProxyForegroundService.cs index 016d5caf5..00bc7590f 100644 --- a/src/ST.Client.Android/Services/Native/ProxyForegroundService.cs +++ b/src/ST.Client.Android/Services/Native/ProxyForegroundService.cs @@ -245,8 +245,10 @@ namespace System.Application.Services.Native const NotificationType notificationType = NotificationType.ProxyForegroundService; + static string NotificationText => AppResources.ProxyForegroundService_NotificationText; + static string? NotificationEntranceAction => nameof(TabItemViewModel.TabItemId.CommunityProxy); diff --git a/src/ST.Client.Android/Services/Shadowsocks/VpnService.cs b/src/ST.Client.Android/Services/Shadowsocks/VpnService.cs index 025ba6a8c..46c2d3c25 100644 --- a/src/ST.Client.Android/Services/Shadowsocks/VpnService.cs +++ b/src/ST.Client.Android/Services/Shadowsocks/VpnService.cs @@ -18,6 +18,7 @@ namespace System.Application.Services.Native int notifyId; NotificationCompat.Builder? builder; NotificationManagerCompat? mNotificationManager; + NotificationManagerCompat NotificationManager { get diff --git a/src/ST.Client.Android/UI/Activities/GuideCACertActivity.cs b/src/ST.Client.Android/UI/Activities/GuideCACertActivity.cs index 050117f3f..86fc4a08a 100644 --- a/src/ST.Client.Android/UI/Activities/GuideCACertActivity.cs +++ b/src/ST.Client.Android/UI/Activities/GuideCACertActivity.cs @@ -60,6 +60,7 @@ namespace System.Application.UI.Activities } bool canInstalledCACert; + public override void OnCreateView(View view) { base.OnCreateView(view); diff --git a/src/ST.Client.Android/UI/Activities/LocalAuthPage/ExportAuthActivity.cs b/src/ST.Client.Android/UI/Activities/LocalAuthPage/ExportAuthActivity.cs index 69f6178f3..7f8fef329 100644 --- a/src/ST.Client.Android/UI/Activities/LocalAuthPage/ExportAuthActivity.cs +++ b/src/ST.Client.Android/UI/Activities/LocalAuthPage/ExportAuthActivity.cs @@ -40,7 +40,6 @@ namespace System.Application.UI.Activities this.SetSupportActionBarWithNavigationClick(binding!.toolbar, true); - R.Subscribe(() => { Title = ViewModel!.Title; diff --git a/src/ST.Client.Android/UI/Activities/LocalAuthPage/SteamAuthTradeActivity.cs b/src/ST.Client.Android/UI/Activities/LocalAuthPage/SteamAuthTradeActivity.cs index 540f92162..eb236709c 100644 --- a/src/ST.Client.Android/UI/Activities/LocalAuthPage/SteamAuthTradeActivity.cs +++ b/src/ST.Client.Android/UI/Activities/LocalAuthPage/SteamAuthTradeActivity.cs @@ -297,6 +297,7 @@ namespace System.Application.UI.Activities } MenuBuilder? menuBuilder; + public override bool OnCreateOptionsMenu(IMenu? menu) { MenuInflater.Inflate(Resource.Menu.auth_trade_toolbar_menu, menu); diff --git a/src/ST.Client.Android/UI/Activities/MainActivity3.cs b/src/ST.Client.Android/UI/Activities/MainActivity3.cs index e1d26f18d..c17097d5b 100644 --- a/src/ST.Client.Android/UI/Activities/MainActivity3.cs +++ b/src/ST.Client.Android/UI/Activities/MainActivity3.cs @@ -47,6 +47,7 @@ namespace System.Application.UI.Activities } static MainActivity? mainActivity; + public static MainActivity Instance => mainActivity ?? throw new ArgumentNullException(nameof(mainActivity)); (Type fragmentType, Func getTitle, int menuId, TabItemViewModel.TabItemId tabItemId)[]? fragments; diff --git a/src/ST.Client.Android/UI/Activities/ProxySettingsActivity.cs b/src/ST.Client.Android/UI/Activities/ProxySettingsActivity.cs index 3217b0fa5..277e44414 100644 --- a/src/ST.Client.Android/UI/Activities/ProxySettingsActivity.cs +++ b/src/ST.Client.Android/UI/Activities/ProxySettingsActivity.cs @@ -185,9 +185,13 @@ namespace System.Application.UI.Activities } void SetProgramStartupRunProxy() => binding!.swProgramStartupRunProxy.Checked = ProgramStartupRunProxy.Value; + void SetOnlyEnableProxyScript() => binding!.swOnlyEnableProxyScript.Checked = OnlyEnableProxyScript.Value; + void SetProxySettingsSocks5() => binding!.swProxySettingsSocks5.Checked = Socks5ProxyEnable.Value; + void SetProxySettingsTwoLevelAgent() => binding!.swProxySettingsTwoLevelAgent.Checked = TwoLevelAgentEnable.Value; + void SetIsVpnMode() => binding!.swIsVpnMode.Checked = ProxyModeValue == ProxyMode.VPN; } } diff --git a/src/ST.Client.Android/UI/Activities/UserProfile/UserProfileActivity.cs b/src/ST.Client.Android/UI/Activities/UserProfile/UserProfileActivity.cs index 7e4040eb2..be2590f47 100644 --- a/src/ST.Client.Android/UI/Activities/UserProfile/UserProfileActivity.cs +++ b/src/ST.Client.Android/UI/Activities/UserProfile/UserProfileActivity.cs @@ -73,6 +73,7 @@ namespace System.Application.UI.Activities } const int pageCount = 3; + public static void StartActivity(Activity activity, SubPageType position = 0) { if (position.IsDefined()) diff --git a/src/ST.Client.Android/UI/Adapters/AccelerateProjectGroupAdapter.cs b/src/ST.Client.Android/UI/Adapters/AccelerateProjectGroupAdapter.cs index 6f47957f7..50275508b 100644 --- a/src/ST.Client.Android/UI/Adapters/AccelerateProjectGroupAdapter.cs +++ b/src/ST.Client.Android/UI/Adapters/AccelerateProjectGroupAdapter.cs @@ -48,6 +48,7 @@ namespace System.Application.UI.Adapters } bool mIsOpen; + /// /// 设置或获取折叠块展开状态,设置展开会使用动画 /// diff --git a/src/ST.Client.Android/UI/Base/BaseActivity.cs b/src/ST.Client.Android/UI/Base/BaseActivity.cs index 93221e94f..b44cd045f 100644 --- a/src/ST.Client.Android/UI/Base/BaseActivity.cs +++ b/src/ST.Client.Android/UI/Base/BaseActivity.cs @@ -79,6 +79,7 @@ namespace System.Application.UI.Activities where TViewBinding : class { readonly CompositeDisposable disposables = new(); + ICollection IDisposableHolder.CompositeDisposable => disposables; protected override void OnCreate2(Bundle? savedInstanceState) @@ -111,6 +112,7 @@ namespace System.Application.UI.Activities where TViewModel : ViewModelBase { readonly CompositeDisposable disposables = new(); + ICollection IDisposableHolder.CompositeDisposable => disposables; protected sealed override void OnCreate(Bundle? savedInstanceState) diff --git a/src/ST.Client.Android/UI/Base/BaseFragment.cs b/src/ST.Client.Android/UI/Base/BaseFragment.cs index 920cb9cc1..6291073ec 100644 --- a/src/ST.Client.Android/UI/Base/BaseFragment.cs +++ b/src/ST.Client.Android/UI/Base/BaseFragment.cs @@ -82,6 +82,7 @@ namespace System.Application.UI.Fragments where TViewModel : ViewModelBase { readonly CompositeDisposable disposables = new(); + ICollection IDisposableHolder.CompositeDisposable => disposables; protected virtual TViewModel? OnCreateViewModel() diff --git a/src/ST.Client.Android/UI/Base/BaseViewHolder.cs b/src/ST.Client.Android/UI/Base/BaseViewHolder.cs index 1142920dd..f813bc16d 100644 --- a/src/ST.Client.Android/UI/Base/BaseViewHolder.cs +++ b/src/ST.Client.Android/UI/Base/BaseViewHolder.cs @@ -57,6 +57,7 @@ namespace System.Application.UI.Adapters where TViewModel : class, IReactiveObject { CompositeDisposable? disposables; + ICollection IDisposableHolder.CompositeDisposable => disposables!; public BaseReactiveViewHolder(View itemView) : base(itemView) diff --git a/src/ST.Client.Android/UI/Base/ControllerBase.cs b/src/ST.Client.Android/UI/Base/ControllerBase.cs index e98c66389..34cb01a6c 100644 --- a/src/ST.Client.Android/UI/Base/ControllerBase.cs +++ b/src/ST.Client.Android/UI/Base/ControllerBase.cs @@ -99,6 +99,7 @@ namespace System.Application.UI.Activities { TController? mController; + public TController Controller => mController.ThrowIsNull(nameof(mController)); void ControllerBase.IHost.SetOnClickListener(params View[] views) => SetOnClickListener(views); @@ -156,7 +157,6 @@ namespace System.Application.UI.Fragments public TController Controller => mController.ThrowIsNull(nameof(mController)); - void ControllerBase.IHost.SetOnClickListener(params View[] views) => SetOnClickListener(views); void ControllerBase.IHost.SetOnClickListener(IEnumerable views) => SetOnClickListener(views); diff --git a/src/ST.Client.Android/UI/Base/Features/ItemClick.cs b/src/ST.Client.Android/UI/Base/Features/ItemClick.cs index 67f72624b..37e9c07f1 100644 --- a/src/ST.Client.Android/UI/Base/Features/ItemClick.cs +++ b/src/ST.Client.Android/UI/Base/Features/ItemClick.cs @@ -33,6 +33,7 @@ namespace System.Application.UI.Adapters protected virtual ItemClickEventArgs? GetItemClickEventArgs(View view, TViewHolder holder, View.LongClickEventArgs? longClickEventArgs = null) => IItemClickViewAdapter.GetItemClickEventArgs(view, holder, longClickEventArgs, TryGetViewModelByPosition); + ItemClickEventArgs? IItemClickViewAdapter.GetItemClickEventArgs(View view, TViewHolder holder, View.LongClickEventArgs? longClickEventArgs) => GetItemClickEventArgs(view, holder, longClickEventArgs); @@ -55,6 +56,7 @@ namespace System.Application.UI.Adapters protected virtual ItemClickEventArgs? GetItemClickEventArgs(View view, TViewHolder holder, View.LongClickEventArgs? longClickEventArgs = null) => IItemClickViewAdapter.GetItemClickEventArgs(view, holder, longClickEventArgs); + ItemClickEventArgs? IItemClickViewAdapter.GetItemClickEventArgs(View view, TViewHolder holder, View.LongClickEventArgs? longClickEventArgs) => GetItemClickEventArgs(view, holder, longClickEventArgs); @@ -243,10 +245,7 @@ namespace System.Application.UI.Adapters.Internals public bool Handled { - get - { - return longClickEventArgs?.Handled ?? default; - } + get => longClickEventArgs?.Handled ?? default; set { if (longClickEventArgs != null) longClickEventArgs.Handled = value; diff --git a/src/ST.Client.Android/UI/Base/Features/OnClick.cs b/src/ST.Client.Android/UI/Base/Features/OnClick.cs index a7e572ca8..b85f2ceb8 100644 --- a/src/ST.Client.Android/UI/Base/Features/OnClick.cs +++ b/src/ST.Client.Android/UI/Base/Features/OnClick.cs @@ -49,8 +49,11 @@ namespace System.Application.UI.Activities } List? clickViews; + protected void SetOnClickListener(IEnumerable views) => SetOnClickListener(this, clickViews, views); + protected void SetOnClickListener(params View[] views) => SetOnClickListener(views.AsEnumerable()); + void ClearOnClickListener() => ClearOnClickListener(ref clickViews); } @@ -71,8 +74,11 @@ namespace System.Application.UI.Activities } List? clickViews; + protected void SetOnClickListener(IEnumerable views) => BaseActivity.SetOnClickListener(this, clickViews, views); + protected void SetOnClickListener(params View[] views) => SetOnClickListener(views.AsEnumerable()); + void ClearOnClickListener() => BaseActivity.ClearOnClickListener(ref clickViews); } } @@ -107,8 +113,11 @@ namespace System.Application.UI.Fragments } List? clickViews; + protected void SetOnClickListener(IEnumerable views) => BaseActivity.SetOnClickListener(this, clickViews, views); + protected void SetOnClickListener(params View[] views) => SetOnClickListener(views.AsEnumerable()); + void ClearOnClickListener() => BaseActivity.ClearOnClickListener(ref clickViews); } @@ -130,8 +139,11 @@ namespace System.Application.UI.Fragments } List? clickViews; + protected void SetOnClickListener(IEnumerable views) => BaseActivity.SetOnClickListener(this, clickViews, views); + protected void SetOnClickListener(params View[] views) => SetOnClickListener(views.AsEnumerable()); + void ClearOnClickListener() => BaseActivity.ClearOnClickListener(ref clickViews); } } \ No newline at end of file diff --git a/src/ST.Client.Android/UI/ComboBoxHelper.cs b/src/ST.Client.Android/UI/ComboBoxHelper.cs index 0a44e57bf..7c2010759 100644 --- a/src/ST.Client.Android/UI/ComboBoxHelper.cs +++ b/src/ST.Client.Android/UI/ComboBoxHelper.cs @@ -58,7 +58,6 @@ namespace System.Application.UI return wrapper; } - public sealed class ListPopupWindowWrapper : Java.Lang.Object, AdapterView.IOnItemClickListener { public ListPopupWindow Window { get; } @@ -66,6 +65,7 @@ namespace System.Application.UI public ArrayAdapter Adapter { get; } IEnumerable items; + public IEnumerable Items { get => items; diff --git a/src/ST.Client.Android/UI/Controllers/SettingsController.cs b/src/ST.Client.Android/UI/Controllers/SettingsController.cs index 041d6de8d..871faea59 100644 --- a/src/ST.Client.Android/UI/Controllers/SettingsController.cs +++ b/src/ST.Client.Android/UI/Controllers/SettingsController.cs @@ -30,7 +30,9 @@ namespace System.Application.UI.Controllers readonly Dictionary> comboBoxs = new(); void SetIsAutoCheckUpdateChecked() => binding.swGeneralSettingsIsAutoCheckUpdate.Checked = GeneralSettings.IsAutoCheckUpdate.Value; + void SetUpdateChannelText() => binding.tvGeneralSettingsUpdateChannelValue.Text = GeneralSettings.UpdateChannel.Value.ToString(); + void SetThemeText() => binding.tvUISettingsThemeValue.Text = ((AppTheme)UISettings.Theme.Value).ToString3(); void SetCaptureScreenChecked() => binding.swGeneralSettingsCaptureScreen.Checked = GeneralSettings.CaptureScreen.Value; diff --git a/src/ST.Client.Android/UI/Fragments/ArchiSteamFarmPlus/ASFPlusFragment.cs b/src/ST.Client.Android/UI/Fragments/ArchiSteamFarmPlus/ASFPlusFragment.cs index 6902d2a1b..14be0b3a2 100644 --- a/src/ST.Client.Android/UI/Fragments/ArchiSteamFarmPlus/ASFPlusFragment.cs +++ b/src/ST.Client.Android/UI/Fragments/ArchiSteamFarmPlus/ASFPlusFragment.cs @@ -56,6 +56,7 @@ namespace System.Application.UI.Fragments } MenuBuilder? menuBuilder; + public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater) { inflater.Inflate(Resource.Menu.asf_plus_toolbar_menu, menu); diff --git a/src/ST.Client.Android/UI/Fragments/CommunityFixFragment.cs b/src/ST.Client.Android/UI/Fragments/CommunityFixFragment.cs index a7fb11d3c..041a23a2f 100644 --- a/src/ST.Client.Android/UI/Fragments/CommunityFixFragment.cs +++ b/src/ST.Client.Android/UI/Fragments/CommunityFixFragment.cs @@ -261,6 +261,7 @@ namespace System.Application.UI.Fragments } MenuBuilder? menuBuilder; + public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater) { inflater.Inflate(Resource.Menu.community_fix_toolbar_menu, menu); diff --git a/src/ST.Client.Android/UI/Fragments/LocalAuthPage/LocalAuthFragment.cs b/src/ST.Client.Android/UI/Fragments/LocalAuthPage/LocalAuthFragment.cs index 01bcc61d6..d0a979dad 100644 --- a/src/ST.Client.Android/UI/Fragments/LocalAuthPage/LocalAuthFragment.cs +++ b/src/ST.Client.Android/UI/Fragments/LocalAuthPage/LocalAuthFragment.cs @@ -34,6 +34,7 @@ namespace System.Application.UI.Fragments } MenuBuilder? menuBuilder; + public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater) { inflater.Inflate(Resource.Menu.local_auth_toolbar_menu, menu); diff --git a/src/ST.Client.Android/UI/Fragments/UserProfile/UserBasicInfoFragment.cs b/src/ST.Client.Android/UI/Fragments/UserProfile/UserBasicInfoFragment.cs index b4d7542a2..441d38880 100644 --- a/src/ST.Client.Android/UI/Fragments/UserProfile/UserBasicInfoFragment.cs +++ b/src/ST.Client.Android/UI/Fragments/UserProfile/UserBasicInfoFragment.cs @@ -190,6 +190,7 @@ namespace System.Application.UI.Fragments } Gender gender; + /// /// 设置或获取当前 UI 上的性别 Radio /// @@ -212,6 +213,7 @@ namespace System.Application.UI.Fragments //} //return Gender.Unknown; } + set { if (gender == value) return; diff --git a/src/ST.Client.Android/UI/ImageLoader.cs b/src/ST.Client.Android/UI/ImageLoader.cs index 590ebdf39..5aef380c5 100644 --- a/src/ST.Client.Android/UI/ImageLoader.cs +++ b/src/ST.Client.Android/UI/ImageLoader.cs @@ -23,6 +23,7 @@ namespace System.Application.UI const string TAG = nameof(ImageLoader); static readonly Lazy _Picasso = new(GetPicasso); + static Picasso GetPicasso() { Picasso.Builder picassoBuilder = new(AndroidApplication.Context); diff --git a/src/ST.Client.Android/UI/MainApplication.cs b/src/ST.Client.Android/UI/MainApplication.cs index d77a8299b..5b09e5993 100644 --- a/src/ST.Client.Android/UI/MainApplication.cs +++ b/src/ST.Client.Android/UI/MainApplication.cs @@ -210,6 +210,7 @@ namespace System.Application.UI } static readonly HashSet activities = new(); + public static IReadOnlyCollection Activities => activities; void OnActivityStateChanged(object? sender, ActivityStateChangedEventArgs e) @@ -249,6 +250,7 @@ namespace System.Application.UI public static bool IsMainProcess { get; private set; } const AppTheme _DefaultActualTheme = AppTheme.Light; + AppTheme IApplication.DefaultActualTheme => _DefaultActualTheme; //public bool IsRuntimeSwitchXFAppTheme { get; set; } = true; @@ -337,10 +339,13 @@ namespace System.Application.UI object IApplication.CurrentPlatformUIHost => XEPlatform.CurrentActivity; readonly Dictionary _NotifyIconMenus = new(); + IReadOnlyDictionary IApplication.NotifyIconMenus => _NotifyIconMenus; readonly CompositeDisposable compositeDisposable = new(); + CompositeDisposable IApplication.CompositeDisposable => compositeDisposable; + ICollection IDisposableHolder.CompositeDisposable => compositeDisposable; #endregion diff --git a/src/ST.Client.Desktop.Avalonia.App.Bridge/Steam++.csproj b/src/ST.Client.Desktop.Avalonia.App.Bridge/Steam++.csproj index 871962120..3e014b2f8 100644 --- a/src/ST.Client.Desktop.Avalonia.App.Bridge/Steam++.csproj +++ b/src/ST.Client.Desktop.Avalonia.App.Bridge/Steam++.csproj @@ -114,4 +114,8 @@ + + + + diff --git a/src/ST.Client.Desktop.Avalonia.App/App.axaml.cs b/src/ST.Client.Desktop.Avalonia.App/App.axaml.cs index ae3412520..f405547c8 100644 --- a/src/ST.Client.Desktop.Avalonia.App/App.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia.App/App.axaml.cs @@ -32,6 +32,7 @@ using WindowState = Avalonia.Controls.WindowState; #endif [assembly: Guid("82cda250-48a2-48ad-ab03-5cda873ef80c")] + namespace System.Application.UI { public partial class App : AvaloniaApplication, IDisposableHolder, IApplication, IAvaloniaApplication, IClipboardPlatformService @@ -41,15 +42,14 @@ namespace System.Application.UI //public static DirectoryInfo RootDirectory => new(IOPath.BaseDirectory); const AppTheme _DefaultActualTheme = AppTheme.Dark; + AppTheme IApplication.DefaultActualTheme => _DefaultActualTheme; AppTheme mTheme = _DefaultActualTheme; + public AppTheme Theme { - get - { - return mTheme; - } + get => mTheme; set { if (value == mTheme) return; @@ -551,7 +551,9 @@ namespace System.Application.UI #region IDisposable members readonly CompositeDisposable compositeDisposable = new(); + CompositeDisposable IApplication.CompositeDisposable => compositeDisposable; + ICollection IDisposableHolder.CompositeDisposable => compositeDisposable; void IDisposable.Dispose() diff --git a/src/ST.Client.Desktop.Avalonia.App/NotifyIconHelper.cs b/src/ST.Client.Desktop.Avalonia.App/NotifyIconHelper.cs index 90c6a854d..b91df2983 100644 --- a/src/ST.Client.Desktop.Avalonia.App/NotifyIconHelper.cs +++ b/src/ST.Client.Desktop.Avalonia.App/NotifyIconHelper.cs @@ -230,6 +230,7 @@ namespace System.Application.UI // } static NativeMenuItem? exitMenuItem; static Dictionary? tabItems; + static IDisposable? InitMenuItems(NativeMenu menu) { #if !TRAY_INDEPENDENT_PROGRAM diff --git a/src/ST.Client.Desktop.Avalonia.App/Program.cs b/src/ST.Client.Desktop.Avalonia.App/Program.cs index 779b3b936..dea77aa87 100644 --- a/src/ST.Client.Desktop.Avalonia.App/Program.cs +++ b/src/ST.Client.Desktop.Avalonia.App/Program.cs @@ -1,3 +1,4 @@ +#pragma warning disable SA1516 // Elements should be separated by blank line using NLog; using System.Linq; using System.Net; @@ -16,6 +17,7 @@ using WinFormsMessageBox = System.Windows.Forms.MessageBox; #elif WINDOWS [assembly: SupportedOSPlatform("Windows7.0")] #endif +#pragma warning restore SA1516 // Elements should be separated by blank line namespace System.Application.UI { diff --git a/src/ST.Client.Desktop.Avalonia.App/ST.Client.Avalonia.App.csproj b/src/ST.Client.Desktop.Avalonia.App/ST.Client.Avalonia.App.csproj index e128d04f5..833732b15 100644 --- a/src/ST.Client.Desktop.Avalonia.App/ST.Client.Avalonia.App.csproj +++ b/src/ST.Client.Desktop.Avalonia.App/ST.Client.Avalonia.App.csproj @@ -203,4 +203,8 @@ PreserveNewest + + + + \ No newline at end of file diff --git a/src/ST.Client.Desktop.Avalonia/Application/Converters/StringFormatConverter.cs b/src/ST.Client.Desktop.Avalonia/Application/Converters/StringFormatConverter.cs index c82c17e5c..4bbd50bf2 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/Converters/StringFormatConverter.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/Converters/StringFormatConverter.cs @@ -56,7 +56,6 @@ namespace System.Application.Converters return str; } - public object? Convert(object? value, Type? targetType, object? parameter, CultureInfo? culture) { return Format(value, parameter, culture); diff --git a/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaApplicationUpdateServiceImpl.cs b/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaApplicationUpdateServiceImpl.cs index b5cc53898..492321b95 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaApplicationUpdateServiceImpl.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaApplicationUpdateServiceImpl.cs @@ -11,6 +11,7 @@ namespace System.Application.Services.Implementation { readonly IAvaloniaApplication app; readonly IWindowManager windowManager; + public AvaloniaApplicationUpdateServiceImpl( IAvaloniaApplication app, INotificationService notificationService, diff --git a/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaWin32WindowingPlatformImpl.cs b/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaWin32WindowingPlatformImpl.cs index b8189fcb3..3a9c87e8c 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaWin32WindowingPlatformImpl.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaWin32WindowingPlatformImpl.cs @@ -56,6 +56,7 @@ namespace System.Application.Services.Implementation } static readonly Lazy _Win32Platform = new(GetWin32Platform); + public static Win32Platform Win32Platform => _Win32Platform.Value; [SupportedOSPlatform("Windows10.0.10240.0")] @@ -256,7 +257,7 @@ namespace System.Application.Services.Implementation Win32Interop.AdjustWindowRectExForDpi(ref frame, (int)style, false, 0, (int)(RenderScaling * 96)); - marg.topHeight = -frame.top + (_isWindows11 ? 0 : -1); + marg.topHeight = -frame.top + (OperatingSystem2.IsWindows11AtLeast ? 0 : -1); Win32Interop.DwmExtendFrameIntoClientArea(Handle.Handle, ref marg); } @@ -300,7 +301,7 @@ namespace System.Application.Services.Implementation if (_owner!.HitTestCaptionButtons(point)) { - if (_isWindows11) + if (OperatingSystem2.IsWindows11AtLeast) { var result = _owner.HitTestMaximizeButton(point); @@ -354,7 +355,6 @@ namespace System.Application.Services.Implementation private bool _wasFakeMaximizeDown; private bool _fakingMaximizeButton; //private bool _isWindows11 = false; - private bool _isWindows11 => OperatingSystem2.IsWindows11AtLeast; private ICoreWindow? _owner; //private Win32Interop.OSVERSIONINFOEX _version; } diff --git a/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaWindowManagerImpl.cs b/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaWindowManagerImpl.cs index d02094b95..a952f843c 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaWindowManagerImpl.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/Services/Implementation/AvaloniaWindowManagerImpl.cs @@ -218,7 +218,6 @@ namespace System.Application.Services.Implementation bool isDialog = true) => Show(GetWindowViewModelType(customWindow), isDialog, customWindow, title, viewModel, resizeMode); - public void CloseWindow(WindowViewModel vm) { try diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/ConsoleShell.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/ConsoleShell.axaml.cs index 34e6c0e0a..8052da93e 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/ConsoleShell.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/ConsoleShell.axaml.cs @@ -61,6 +61,7 @@ namespace System.Application.UI.Views.Controls } private CommandEventArgs? _commandSubmitArgs; + /// /// 输入命令后按下回车触发 /// diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/ItemsSelector.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/ItemsSelector.axaml.cs index b754e16c0..70fe5180f 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/ItemsSelector.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/ItemsSelector.axaml.cs @@ -62,7 +62,6 @@ namespace System.Application.UI.Views.Controls { InitializeComponent(); - var items = this.FindControl("SelectItems"); this.GetObservable(SelectItemsProperty) diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/WallpaperControl.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/WallpaperControl.cs index d12bbfba9..94d8ab64f 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/WallpaperControl.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/WallpaperControl.cs @@ -2,7 +2,6 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Markup.Xaml; -using System; using System.Application.Services; using System.Application.Settings; @@ -16,6 +15,7 @@ namespace System.Application.UI.Views.Controls Window? ParentWindow; IntPtr _Handle; IntPtr _DwmHandle; + public WallpaperControl() { //this.InitializeComponent(); diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/MainView.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/MainView.axaml.cs index bfa56a9b4..762650744 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/MainView.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/MainView.axaml.cs @@ -94,7 +94,6 @@ namespace System.Application.UI.Views avatar.Margin = new Thickness(10, 0); } - if (avatar.Clip is EllipseGeometry ellipse) { ellipse.Rect = new Rect(0, 0, avatar.Width, avatar.Height); diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/ArchiSteamFarmPlus/ASF_BotPage.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/ArchiSteamFarmPlus/ASF_BotPage.axaml.cs index cc1e36fd0..39205d329 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/ArchiSteamFarmPlus/ASF_BotPage.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/ArchiSteamFarmPlus/ASF_BotPage.axaml.cs @@ -87,7 +87,6 @@ namespace System.Application.UI.Views.Pages { ASFService.Current.RefreshBots(); - base.OnAttachedToVisualTree(e); } } diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/GameRelated/GameRelated_BorderlessPage.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/GameRelated/GameRelated_BorderlessPage.axaml.cs index 45e3b5e20..d81d0c040 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/GameRelated/GameRelated_BorderlessPage.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/GameRelated/GameRelated_BorderlessPage.axaml.cs @@ -19,6 +19,5 @@ namespace System.Application.UI.Views.Pages AvaloniaXamlLoader.Load(this); } - } } \ No newline at end of file diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/Settings/Settings_General.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/Settings/Settings_General.axaml.cs index b582abda2..a6509cc77 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/Settings/Settings_General.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/Settings/Settings_General.axaml.cs @@ -10,6 +10,7 @@ namespace System.Application.UI.Views.Pages { readonly TextBlock? cacheSize; readonly TextBlock? logSize; + public Settings_General() { InitializeComponent(); diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/Settings/Settings_UI.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/Settings/Settings_UI.axaml.cs index 03a688fdf..c58b81b27 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/Settings/Settings_UI.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/Settings/Settings_UI.axaml.cs @@ -17,6 +17,5 @@ namespace System.Application.UI.Views.Pages AvaloniaXamlLoader.Load(this); } - } } \ No newline at end of file diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/DebugWindow.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/DebugWindow.axaml.cs index 0bff8cad1..1d135bcf9 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/DebugWindow.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/DebugWindow.axaml.cs @@ -11,14 +11,13 @@ namespace System.Application.UI.Views.Windows public DebugWindow() { InitializeComponent(); - + ExtendClientAreaToDecorationsHint = false; ExtendClientAreaTitleBarHeightHint = -1; TransparencyLevelHint = WindowTransparencyLevel.Mica; SystemDecorations = SystemDecorations.Full; ExtendClientAreaChromeHints = Avalonia.Platform.ExtendClientAreaChromeHints.Default; - //if (OperatingSystem2.IsWindows11AtLeast) //{ // AvaloniaLocator.Current.GetService().ForceNativeTitleBarToTheme(this, "Dark"); diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/GameListPage/EditAppInfoWindow.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/GameListPage/EditAppInfoWindow.axaml.cs index b3f56062a..16eb74c56 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/GameListPage/EditAppInfoWindow.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/GameListPage/EditAppInfoWindow.axaml.cs @@ -37,7 +37,6 @@ namespace System.Application.UI.Views.Windows } } - private void InitializeComponent() { AvaloniaXamlLoader.Load(this); diff --git a/src/ST.Client.Desktop.Avalonia/ST.Client.Avalonia.csproj b/src/ST.Client.Desktop.Avalonia/ST.Client.Avalonia.csproj index 38ce5087a..0986eabdd 100644 --- a/src/ST.Client.Desktop.Avalonia/ST.Client.Avalonia.csproj +++ b/src/ST.Client.Desktop.Avalonia/ST.Client.Avalonia.csproj @@ -117,4 +117,8 @@ + + + + \ No newline at end of file diff --git a/src/ST.Client.Desktop.Linux/ST.Client.Linux.csproj b/src/ST.Client.Desktop.Linux/ST.Client.Linux.csproj index c1d01c166..ceb267c80 100644 --- a/src/ST.Client.Desktop.Linux/ST.Client.Linux.csproj +++ b/src/ST.Client.Desktop.Linux/ST.Client.Linux.csproj @@ -68,4 +68,8 @@ SR.Designer.cs + + + + \ No newline at end of file diff --git a/src/ST.Client.Desktop.Linux/Services/Implementation/LinuxPlatformServiceImpl.cs b/src/ST.Client.Desktop.Linux/Services/Implementation/LinuxPlatformServiceImpl.cs index ee1b4d89f..c20d863f8 100644 --- a/src/ST.Client.Desktop.Linux/Services/Implementation/LinuxPlatformServiceImpl.cs +++ b/src/ST.Client.Desktop.Linux/Services/Implementation/LinuxPlatformServiceImpl.cs @@ -16,10 +16,12 @@ namespace System.Application.Services.Implementation public const string xdg = "xdg-open"; public const string vi = "vi"; public const string VSC = "code"; + /// /// 临时 保存用户系统密码 /// public string SystemUserPassword { get; set; } = string.Empty; + public LinuxPlatformServiceImpl() { // 平台服务依赖关系过于复杂,在构造函数中不得注入任何服务,由函数中延时加载调用服务 @@ -80,7 +82,7 @@ namespace System.Application.Services.Implementation var value = string.Format( "{1}{0}.steam{0}registry.vdf", Path.DirectorySeparatorChar, - Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); return value; } @@ -91,7 +93,7 @@ namespace System.Application.Services.Implementation var registryVdfPath = GetRegistryVdfPath(); if (!string.IsNullOrWhiteSpace(registryVdfPath) && File.Exists(registryVdfPath)) { - dynamic v = VdfHelper.Read(registryVdfPath); + dynamic v = VdfHelper.Read(registryVdfPath); if (v.Value.HKCU.Software.Valve.Steam.AutoLoginUser != null) { v.Value.HKCU.Software.Valve.Steam.AutoLoginUser = userName; diff --git a/src/ST.Client.Desktop.Mac/Internals/UnixHelper.RunShellAsync.cs b/src/ST.Client.Desktop.Mac/Internals/UnixHelper.RunShellAsync.cs index 068be04cb..84543dbc0 100644 --- a/src/ST.Client.Desktop.Mac/Internals/UnixHelper.RunShellAsync.cs +++ b/src/ST.Client.Desktop.Mac/Internals/UnixHelper.RunShellAsync.cs @@ -12,6 +12,7 @@ static partial class UnixHelper const string TAG = nameof(UnixHelper); static readonly Lazy _bin_bash = new(() => string.Format("{0}bin{0}bash", Path.DirectorySeparatorChar)); + /// /// /bin/bash /// @@ -42,7 +43,7 @@ static partial class UnixHelper scriptContent.AppendLine(script); var msg = RunShell(scriptContent.ToString()); if (!string.IsNullOrWhiteSpace(msg)) - Toast.Show(msg); + Toast.Show(msg); } /// diff --git a/src/ST.Client.Desktop.Mac/ST.Client.Mac.csproj b/src/ST.Client.Desktop.Mac/ST.Client.Mac.csproj index 33cdbd61c..6ae7ad2f4 100644 --- a/src/ST.Client.Desktop.Mac/ST.Client.Mac.csproj +++ b/src/ST.Client.Desktop.Mac/ST.Client.Mac.csproj @@ -63,4 +63,8 @@ + + + + \ No newline at end of file diff --git a/src/ST.Client.Desktop.Mac/Services/Implementation/MacPlatformServiceImpl.cs b/src/ST.Client.Desktop.Mac/Services/Implementation/MacPlatformServiceImpl.cs index 49c9b32d9..87b4b85b9 100644 --- a/src/ST.Client.Desktop.Mac/Services/Implementation/MacPlatformServiceImpl.cs +++ b/src/ST.Client.Desktop.Mac/Services/Implementation/MacPlatformServiceImpl.cs @@ -53,6 +53,7 @@ namespace System.Application.Services.Implementation p.Kill(); return ret.Split("\n"); } + internal static bool IsCertificateInstalled(X509Certificate2 certificate2) { @@ -85,9 +86,11 @@ namespace System.Application.Services.Implementation #endif } + bool IPlatformService.IsCertificateInstalled(X509Certificate2 certificate2) => IsCertificateInstalled(certificate2); ValueTask IPlatformService.RunShellAsync(string script, bool admin) => RunShellAsync(script, admin); + /// /// 尝试删除证书 /// @@ -207,6 +210,7 @@ namespace System.Application.Services.Implementation } public string GetLastSteamLoginUserName() => string.Empty; + public string? GetRegistryVdfPath() { var value = string.Format( @@ -215,6 +219,7 @@ namespace System.Application.Services.Implementation Environment.UserName); return value; } + public void SetCurrentUser(string userName) { try @@ -222,7 +227,7 @@ namespace System.Application.Services.Implementation var registryVdfPath = GetRegistryVdfPath(); if (!string.IsNullOrWhiteSpace(registryVdfPath) && File.Exists(registryVdfPath)) { - dynamic v = VdfHelper.Read(registryVdfPath); + dynamic v = VdfHelper.Read(registryVdfPath); if (v.Value.HKCU.Software.Valve.Steam.AutoLoginUser != null) { v.Value.HKCU.Software.Valve.Steam.AutoLoginUser = userName; @@ -355,7 +360,7 @@ namespace System.Application.Services.Implementation } } } - ((IPlatformService)this).RunShell(shellContent.ToString(), false); + ((IPlatformService)this).RunShell(shellContent.ToString(), false); return true; } diff --git a/src/ST.Client.Desktop.Mac/UI/AppDelegate.cs b/src/ST.Client.Desktop.Mac/UI/AppDelegate.cs index 9b796ac5c..108b02cec 100644 --- a/src/ST.Client.Desktop.Mac/UI/AppDelegate.cs +++ b/src/ST.Client.Desktop.Mac/UI/AppDelegate.cs @@ -74,6 +74,7 @@ namespace System.Application.UI } static bool isInitialized; + internal static AppDelegate? Instance { get; private set; } public static void Init(/*string[] args*/) diff --git a/src/ST.Client.Desktop.Windows/Internals/DWMApi.cs b/src/ST.Client.Desktop.Windows/Internals/DWMApi.cs index bc1e75eee..03b907dd4 100644 --- a/src/ST.Client.Desktop.Windows/Internals/DWMApi.cs +++ b/src/ST.Client.Desktop.Windows/Internals/DWMApi.cs @@ -8,6 +8,7 @@ static class DWMApi DWM_TNP_RECTDESTINATION = 0x1; const string DllName = "dwmapi"; + [DllImport(DllName, CharSet = CharSet.Auto)] public static extern int DwmRegisterThumbnail(IntPtr dest, IntPtr src, out IntPtr thumb); diff --git a/src/ST.Client.Desktop.Windows/Internals/MouseHook.cs b/src/ST.Client.Desktop.Windows/Internals/MouseHook.cs index 655b1174c..296cc37a5 100644 --- a/src/ST.Client.Desktop.Windows/Internals/MouseHook.cs +++ b/src/ST.Client.Desktop.Windows/Internals/MouseHook.cs @@ -21,6 +21,7 @@ static class MouseHook Subscribe(); MouseUp += value; } + remove { MouseUp -= value; @@ -147,6 +148,7 @@ static class MouseHook SPI_GETFONTSMOOTHINGORIENTATION = 8210, SPI_SETFONTSMOOTHINGORIENTATION = 8211 } + [Flags] public enum SystemParamtersInfoFlags : uint { diff --git a/src/ST.Client.Desktop.Windows/Internals/NativeMethods.cs b/src/ST.Client.Desktop.Windows/Internals/NativeMethods.cs index 762eda16c..8178a04b1 100644 --- a/src/ST.Client.Desktop.Windows/Internals/NativeMethods.cs +++ b/src/ST.Client.Desktop.Windows/Internals/NativeMethods.cs @@ -23,8 +23,8 @@ static partial class NativeMethods public static extern IntPtr OpenProcess( uint processAccess, bool bInheritHandle, - int processId - ); + int processId); + public static IntPtr OpenProcess(Process proc, ProcessAccessFlags flags) { return OpenProcess((uint)flags, false, proc.Id); @@ -62,7 +62,6 @@ static partial class NativeMethods [ResourceExposure(ResourceScope.None)] public static extern int GetACP(); - [DllImport("Powrprof.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern bool SetSuspendState(bool hiberate, bool forceCritical, bool disableWakeEvent); } \ No newline at end of file diff --git a/src/ST.Client.Desktop.Windows/Internals/UnmanagedMethods.cs b/src/ST.Client.Desktop.Windows/Internals/UnmanagedMethods.cs index 5b20e5102..0b79c6173 100644 --- a/src/ST.Client.Desktop.Windows/Internals/UnmanagedMethods.cs +++ b/src/ST.Client.Desktop.Windows/Internals/UnmanagedMethods.cs @@ -125,6 +125,7 @@ internal static class UnmanagedMethods public string? szTip; public int dwState = 0; public int dwStateMask = 0; + /// /// String with the text for a balloon ToolTip. It can have a maximum of 255 characters. /// To remove the ToolTip, set the NIF_INFO flag in uFlags and set szInfo to an empty string. @@ -132,6 +133,7 @@ internal static class UnmanagedMethods [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string? szInfo; public int uTimeoutOrVersion; + /// /// String containing a title for a balloon ToolTip. This title appears in boldface /// above the text. It can have a maximum of 63 characters. @@ -178,6 +180,7 @@ internal static class UnmanagedMethods public MENUITEMINFO() { } + public MENUITEMINFO(MIIM pfMask) { fMask = pfMask; @@ -1587,18 +1590,22 @@ internal static class UnmanagedMethods /// Text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data. Use this format for ANSI text. /// CF_TEXT = 1, + /// /// A handle to a bitmap /// CF_BITMAP = 2, + /// /// A memory object containing a BITMAPINFO structure followed by the bitmap bits. /// CF_DIB = 3, + /// /// Unicode text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data. /// CF_UNICODETEXT = 13, + /// /// A handle to type HDROP that identifies a list of files. /// @@ -2136,10 +2143,13 @@ internal interface IDropTarget { [PreserveSig] UnmanagedMethods.HRESULT DragEnter([MarshalAs(UnmanagedType.Interface)][In] IOleDataObject pDataObj, [MarshalAs(UnmanagedType.U4)][In] int grfKeyState, [MarshalAs(UnmanagedType.U8)][In] long pt, [In][Out] ref DropEffect pdwEffect); + [PreserveSig] UnmanagedMethods.HRESULT DragOver([MarshalAs(UnmanagedType.U4)][In] int grfKeyState, [MarshalAs(UnmanagedType.U8)][In] long pt, [In][Out] ref DropEffect pdwEffect); + [PreserveSig] UnmanagedMethods.HRESULT DragLeave(); + [PreserveSig] UnmanagedMethods.HRESULT Drop([MarshalAs(UnmanagedType.Interface)][In] IOleDataObject pDataObj, [MarshalAs(UnmanagedType.U4)][In] int grfKeyState, [MarshalAs(UnmanagedType.U8)][In] long pt, [In][Out] ref DropEffect pdwEffect); } @@ -2151,6 +2161,7 @@ internal interface IDropSource { [PreserveSig] int QueryContinueDrag(int fEscapePressed, [MarshalAs(UnmanagedType.U4)][In] int grfKeyState); + [PreserveSig] int GiveFeedback([MarshalAs(UnmanagedType.U4)][In] int dwEffect); } @@ -2161,16 +2172,24 @@ internal interface IDropSource internal interface IOleDataObject { void GetData([In] ref FORMATETC format, out STGMEDIUM medium); + void GetDataHere([In] ref FORMATETC format, ref STGMEDIUM medium); + [PreserveSig] int QueryGetData([In] ref FORMATETC format); + [PreserveSig] int GetCanonicalFormatEtc([In] ref FORMATETC formatIn, out FORMATETC formatOut); + void SetData([In] ref FORMATETC formatIn, [In] ref STGMEDIUM medium, [MarshalAs(UnmanagedType.Bool)] bool release); + IEnumFORMATETC EnumFormatEtc(DATADIR direction); + [PreserveSig] int DAdvise([In] ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection); + void DUnadvise(int connection); + [PreserveSig] int EnumDAdvise(out IEnumSTATDATA enumAdvise); } \ No newline at end of file diff --git a/src/ST.Client.Desktop.Windows/Internals/User32Window.cs b/src/ST.Client.Desktop.Windows/Internals/User32Window.cs index a07837b10..01545b75d 100644 --- a/src/ST.Client.Desktop.Windows/Internals/User32Window.cs +++ b/src/ST.Client.Desktop.Windows/Internals/User32Window.cs @@ -155,7 +155,7 @@ internal static class User32Window public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport(LibraryName, CharSet = CharSet.Unicode)] - public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); + public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string? lpszWindow); [DllImport(LibraryName, CharSet = CharSet.Auto)] public static extern IntPtr SendMessage(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam); diff --git a/src/ST.Client.Desktop.Windows/Internals/WinInet.cs b/src/ST.Client.Desktop.Windows/Internals/WinInet.cs index 0112c125d..bce77769d 100644 --- a/src/ST.Client.Desktop.Windows/Internals/WinInet.cs +++ b/src/ST.Client.Desktop.Windows/Internals/WinInet.cs @@ -74,7 +74,7 @@ internal static class WinInet [DllImport("wininet.dll", SetLastError = true, -CharSet = CharSet.Unicode, + CharSet = CharSet.Unicode, EntryPoint = "InternetGetCookieEx", CallingConvention = CallingConvention.StdCall)] public static extern bool InternetGetCookieEx( diff --git a/src/ST.Client.Desktop.Windows/ST.Client.Windows.csproj b/src/ST.Client.Desktop.Windows/ST.Client.Windows.csproj index 8d1964653..4cff9d405 100644 --- a/src/ST.Client.Desktop.Windows/ST.Client.Windows.csproj +++ b/src/ST.Client.Desktop.Windows/ST.Client.Windows.csproj @@ -75,4 +75,8 @@ SR.Designer.cs + + + + diff --git a/src/ST.Client.Desktop.Windows/Services/Implementation/NativeWindowApiServiceImpl.cs b/src/ST.Client.Desktop.Windows/Services/Implementation/NativeWindowApiServiceImpl.cs index 768fce19c..acc054cd5 100644 --- a/src/ST.Client.Desktop.Windows/Services/Implementation/NativeWindowApiServiceImpl.cs +++ b/src/ST.Client.Desktop.Windows/Services/Implementation/NativeWindowApiServiceImpl.cs @@ -130,7 +130,7 @@ namespace System.Application.Services.Implementation IntPtr result = User32Window.SendMessage(progman, 0x052C, new IntPtr(0), IntPtr.Zero); IntPtr workerw = IntPtr.Zero; - User32Window.EnumWindows(((tophandle, topparamhandle) => + User32Window.EnumWindows((tophandle, topparamhandle) => { IntPtr p = User32Window.FindWindowEx(tophandle, IntPtr.Zero, @@ -145,10 +145,9 @@ namespace System.Application.Services.Implementation null); } return true; - }), IntPtr.Zero); + }, IntPtr.Zero); SetParentWindow(window.Handle, workerw); - int p1 = User32Window.GetWindowLongA(window.Handle, (int)WindowLongFlags.GWL_STYLE); p1 &= ~13500416; User32Window.SetWindowLong(window.Handle, (int)WindowLongFlags.GWL_STYLE, p1); diff --git a/src/ST.Client.Desktop.Windows/Services/Implementation/SteamServiceImpl.cs b/src/ST.Client.Desktop.Windows/Services/Implementation/SteamServiceImpl.cs index 425d177ff..0b300e475 100644 --- a/src/ST.Client.Desktop.Windows/Services/Implementation/SteamServiceImpl.cs +++ b/src/ST.Client.Desktop.Windows/Services/Implementation/SteamServiceImpl.cs @@ -54,9 +54,10 @@ namespace System.Application.Services.Implementation readonly string? mRegistryVdfPath; readonly string[] steamProcess = new[] { "steam", "steam_osx", "steamservice", "steamwebhelper" }; readonly Lazy _http = new(() => DI.Get()); - IHttpService Http => _http.Value; List? steamDownloadingWatchers; + IHttpService Http => _http.Value; + public SteamServiceImpl(IPlatformService platformService) { this.platformService = platformService; @@ -76,6 +77,7 @@ namespace System.Application.Services.Implementation } public string? SteamDirPath => mSteamDirPath; + public string? RegistryVdfPath => mRegistryVdfPath; public string? SteamProgramPath => mSteamProgramPath; @@ -457,7 +459,7 @@ namespace System.Application.Services.Implementation { throw new Exception("Steam Dir Path is null or empty."); } - + var fsw = new FileSystemWatcher(Path.Combine(SteamDirPath, "config"), "loginusers.vdf") { NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.CreationTime, diff --git a/src/ST.Client.Desktop.Windows/Services/Implementation/WindowsPlatformServiceImpl.UnelevatedProcessStarter.cs b/src/ST.Client.Desktop.Windows/Services/Implementation/WindowsPlatformServiceImpl.UnelevatedProcessStarter.cs index dc0f8ba6b..49b146eeb 100644 --- a/src/ST.Client.Desktop.Windows/Services/Implementation/WindowsPlatformServiceImpl.UnelevatedProcessStarter.cs +++ b/src/ST.Client.Desktop.Windows/Services/Implementation/WindowsPlatformServiceImpl.UnelevatedProcessStarter.cs @@ -67,19 +67,24 @@ namespace System.Application.Services.Implementation { [DllImport("user32.dll")] public static extern IntPtr GetShellWindow(); + [DllImport("user32.dll", SetLastError = true)] public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); + [DllImport("kernel32.dll", SetLastError = true)] public static extern IntPtr OpenProcess(int processAccess, bool bInheritHandle, int processId); + [DllImport("advapi32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool OpenProcessToken(IntPtr processHandle, uint desiredAccess, out IntPtr tokenHandle); + [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool DuplicateTokenEx(IntPtr hExistingToken, uint dwDesiredAccess, ref SecurityAttributes lpTokenAttributes, int impersonationLevel, int tokenType, out IntPtr phNewToken); + [DllImport("advapi32", SetLastError = true, CharSet = CharSet.Unicode)] public static extern bool CreateProcessWithTokenW( IntPtr hToken, int dwLogonFlags, diff --git a/src/ST.Client.Desktop.Windows/Services/Implementation/WindowsPlatformServiceImpl.cs b/src/ST.Client.Desktop.Windows/Services/Implementation/WindowsPlatformServiceImpl.cs index c328f91b0..a8e63a66a 100644 --- a/src/ST.Client.Desktop.Windows/Services/Implementation/WindowsPlatformServiceImpl.cs +++ b/src/ST.Client.Desktop.Windows/Services/Implementation/WindowsPlatformServiceImpl.cs @@ -27,7 +27,6 @@ namespace System.Application.Services.Implementation const string TAG = "WindowsPlatformS"; const string SteamRegistryPath = @"SOFTWARE\Valve\Steam"; - public string? GetRegistryVdfPath() { return null; } public string GetCommandLineArgs(Process process) @@ -78,6 +77,7 @@ namespace System.Application.Services.Implementation } const string explorer = "explorer.exe"; + static string Explorer => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), explorer); public void OpenFolderByDirectoryPath(DirectoryInfo info) @@ -261,6 +261,7 @@ namespace System.Application.Services.Implementation //} const string explorer_exe = "explorer.exe"; + static Process? StartAsInvokerByExplorer(string fileName, string? arguments = null) { if (string.IsNullOrEmpty(arguments)) @@ -385,8 +386,10 @@ namespace System.Application.Services.Implementation var value = reg32.Read(@"SOFTWARE\Steam++", "InstPath").TrimEnd(Path.DirectorySeparatorChar); return string.Equals(IOPath.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar), value, StringComparison.OrdinalIgnoreCase); }); + /// public static bool IsInstall => _IsInstall.Value; + bool IPlatformService.IsInstall => IsInstall; #endregion diff --git a/src/ST.Client.Desktop.Windows/VdfHelper.cs b/src/ST.Client.Desktop.Windows/VdfHelper.cs index cd90c53ab..c48c43be4 100644 --- a/src/ST.Client.Desktop.Windows/VdfHelper.cs +++ b/src/ST.Client.Desktop.Windows/VdfHelper.cs @@ -20,6 +20,7 @@ namespace System.Application var text = File.ReadAllText(filePath, Encoding.UTF8); return VdfConvert.Deserialize(text); } + public static void Write(string filePath, VProperty content) { try @@ -31,7 +32,7 @@ namespace System.Application Log.Error(nameof(VdfHelper), e, "Write Vdf Error"); } } - + } #if DEBUG diff --git a/src/ST.Client.Desktop.Windows/VisualStudioAppCenterSDK.cs b/src/ST.Client.Desktop.Windows/VisualStudioAppCenterSDK.cs index 45e7840f5..116c48b74 100644 --- a/src/ST.Client.Desktop.Windows/VisualStudioAppCenterSDK.cs +++ b/src/ST.Client.Desktop.Windows/VisualStudioAppCenterSDK.cs @@ -37,8 +37,8 @@ namespace System.Application if (TryGetAppSecret(out var appSecret)) { #if WINDOWS - var _applicationSettingsFactory = typeof(AppCenter).GetField("_applicationSettingsFactory", BindingFlags.NonPublic | BindingFlags.Static); - _applicationSettingsFactory.ThrowIsNull(nameof(_applicationSettingsFactory)).SetValue(null, DI.Get()); + var applicationSettingsFactory_ = typeof(AppCenter).GetField("_applicationSettingsFactory", BindingFlags.NonPublic | BindingFlags.Static); + applicationSettingsFactory_.ThrowIsNull(nameof(applicationSettingsFactory_)).SetValue(null, DI.Get()); #endif AppCenter.Start(appSecret, typeof(Analytics), typeof(Crashes)); } @@ -147,6 +147,7 @@ namespace Microsoft.AppCenter.Utils internal sealed class TestAppCenter : ITestAppCenter { readonly IApplicationSettings settings; + public TestAppCenter(IApplicationSettings settings) { this.settings = settings; diff --git a/src/ST.Client.Desktop.Windows/Windows/Generated/Point.cs b/src/ST.Client.Desktop.Windows/Windows/Generated/Point.cs index dafe23038..e3bcb1d82 100644 --- a/src/ST.Client.Desktop.Windows/Windows/Generated/Point.cs +++ b/src/ST.Client.Desktop.Windows/Windows/Generated/Point.cs @@ -7,7 +7,6 @@ // This file was generated, please do not edit it directly. // // Please see MilCodeGen.html for more information. -// namespace System.Windows { @@ -22,9 +21,6 @@ namespace System.Windows #region Public Methods - - - /// /// Compares two Point instances for exact equality. /// Note that double values can acquire error when operated upon, such that @@ -57,6 +53,7 @@ namespace System.Windows { return !(point1 == point2); } + /// /// Compares two Point instances for object equality. In this equality /// Double.NaN is equal to itself, unlike in numeric equality. @@ -88,7 +85,7 @@ namespace System.Windows /// The object to compare to "this" public override bool Equals(object? o) { - if ((null == o) || o is not Point) + if (o is null or not Point) { return false; } @@ -112,6 +109,7 @@ namespace System.Windows { return Point.Equals(this, value); } + /// /// Returns the HashCode for this Point /// @@ -133,9 +131,6 @@ namespace System.Windows // //------------------------------------------------------ - - - #region Public Properties /// @@ -180,10 +175,6 @@ namespace System.Windows #region Protected Methods - - - - #endregion ProtectedMethods //------------------------------------------------------ @@ -194,14 +185,6 @@ namespace System.Windows #region Internal Methods - - - - - - - - #endregion Internal Methods //------------------------------------------------------ @@ -212,7 +195,6 @@ namespace System.Windows #region Internal Properties - /// /// Creates a string representation of this object based on the current culture. /// @@ -273,8 +255,6 @@ namespace System.Windows _y); } - - #endregion Internal Properties //------------------------------------------------------ @@ -285,8 +265,6 @@ namespace System.Windows #region Dependency Properties - - #endregion Dependency Properties //------------------------------------------------------ @@ -297,14 +275,11 @@ namespace System.Windows #region Internal Fields - internal double _x; internal double _y; #endregion Internal Fields - - #region Constructors //------------------------------------------------------ @@ -313,9 +288,6 @@ namespace System.Windows // //------------------------------------------------------ - - - #endregion Constructors } } \ No newline at end of file diff --git a/src/ST.Client.Mac.ResSecrets/ST.Client.Mac.ResSecrets.csproj b/src/ST.Client.Mac.ResSecrets/ST.Client.Mac.ResSecrets.csproj index 6a9519811..5ae281523 100644 --- a/src/ST.Client.Mac.ResSecrets/ST.Client.Mac.ResSecrets.csproj +++ b/src/ST.Client.Mac.ResSecrets/ST.Client.Mac.ResSecrets.csproj @@ -32,4 +32,8 @@ + + + + diff --git a/src/ST.Client.Mobile.Droid.App/ST.Client.Android.App.csproj b/src/ST.Client.Mobile.Droid.App/ST.Client.Android.App.csproj index 5616b9b14..01288e3b4 100644 --- a/src/ST.Client.Mobile.Droid.App/ST.Client.Android.App.csproj +++ b/src/ST.Client.Mobile.Droid.App/ST.Client.Android.App.csproj @@ -1,4 +1,4 @@ - + Debug @@ -145,7 +145,7 @@ - + \ No newline at end of file diff --git a/src/ST.Client.ResSecrets/ST.Client.ResSecrets.csproj b/src/ST.Client.ResSecrets/ST.Client.ResSecrets.csproj index b10066220..4c3bb9011 100644 --- a/src/ST.Client.ResSecrets/ST.Client.ResSecrets.csproj +++ b/src/ST.Client.ResSecrets/ST.Client.ResSecrets.csproj @@ -39,4 +39,8 @@ + + + + diff --git a/src/ST.Client.Windows.ResSecrets/ST.Client.Windows.ResSecrets.csproj b/src/ST.Client.Windows.ResSecrets/ST.Client.Windows.ResSecrets.csproj index b995983ce..ffe02cb54 100644 --- a/src/ST.Client.Windows.ResSecrets/ST.Client.Windows.ResSecrets.csproj +++ b/src/ST.Client.Windows.ResSecrets/ST.Client.Windows.ResSecrets.csproj @@ -32,4 +32,8 @@ + + + + diff --git a/src/ST.Client.XamarinForms/ST.Client.XamarinForms.csproj b/src/ST.Client.XamarinForms/ST.Client.XamarinForms.csproj index 0f3dc82a3..c24a27be3 100644 --- a/src/ST.Client.XamarinForms/ST.Client.XamarinForms.csproj +++ b/src/ST.Client.XamarinForms/ST.Client.XamarinForms.csproj @@ -43,4 +43,8 @@ + + + + diff --git a/src/ST.Client.XamarinForms/UI/App.xaml.cs b/src/ST.Client.XamarinForms/UI/App.xaml.cs index f1eda649e..a2aecaa25 100644 --- a/src/ST.Client.XamarinForms/UI/App.xaml.cs +++ b/src/ST.Client.XamarinForms/UI/App.xaml.cs @@ -21,6 +21,7 @@ namespace System.Application.UI } OSAppTheme _AppTheme = OSAppTheme.Light; + public OSAppTheme AppTheme { get => _AppTheme; diff --git a/src/ST.Client.XamarinForms/UI/AppShell.xaml.cs b/src/ST.Client.XamarinForms/UI/AppShell.xaml.cs index a2d827ae4..90eef8702 100644 --- a/src/ST.Client.XamarinForms/UI/AppShell.xaml.cs +++ b/src/ST.Client.XamarinForms/UI/AppShell.xaml.cs @@ -21,6 +21,7 @@ namespace System.Application.UI public static bool IsUseBottomNav { get; private set; } readonly IPlatformPageRouteService? pageRouteService = IPlatformPageRouteService.Instance; + public AppShell() { InitializeComponent(); @@ -33,7 +34,6 @@ namespace System.Application.UI // InitTabItems(mainWindow, TabItemId.LocalAuth, TabItemId.ArchiSteamFarmPlus); - // AddPage(MyPageViewModel.Instance, isVisible: false); //#if DEBUG // AddPage(new LoginOrRegisterWindowViewModel()); diff --git a/src/ST.Client.XamarinForms/UI/Controls/CardButton.cs b/src/ST.Client.XamarinForms/UI/Controls/CardButton.cs index 9d74e703e..df0122685 100644 --- a/src/ST.Client.XamarinForms/UI/Controls/CardButton.cs +++ b/src/ST.Client.XamarinForms/UI/Controls/CardButton.cs @@ -21,6 +21,7 @@ namespace System.Application.UI.Views.Controls get { return (ICommand)GetValue(CommandProperty); } set { SetValue(CommandProperty, value); } } + public object CommandParameter { get { return GetValue(CommandParameterProperty); } @@ -33,6 +34,7 @@ namespace System.Application.UI.Views.Controls public bool IsPressed => (bool)GetValue(IsPressedProperty); public event EventHandler? Clicked; + public event EventHandler? Pressed; public event EventHandler? Released; diff --git a/src/ST.Client.iOS.ResSecrets/ST.Client.iOS.ResSecrets.csproj b/src/ST.Client.iOS.ResSecrets/ST.Client.iOS.ResSecrets.csproj index 86fdbea59..bb2d52db4 100644 --- a/src/ST.Client.iOS.ResSecrets/ST.Client.iOS.ResSecrets.csproj +++ b/src/ST.Client.iOS.ResSecrets/ST.Client.iOS.ResSecrets.csproj @@ -32,4 +32,8 @@ + + + + diff --git a/src/ST.Client.iOS/ST.Client.iOS.csproj b/src/ST.Client.iOS/ST.Client.iOS.csproj index deb88ed29..a373305eb 100644 --- a/src/ST.Client.iOS/ST.Client.iOS.csproj +++ b/src/ST.Client.iOS/ST.Client.iOS.csproj @@ -42,4 +42,8 @@ + + + + diff --git a/src/ST.Client/Entities/Script.cs b/src/ST.Client/Entities/Script.cs index c6e2e6346..5f844cfda 100644 --- a/src/ST.Client/Entities/Script.cs +++ b/src/ST.Client/Entities/Script.cs @@ -19,6 +19,7 @@ namespace System.Application.Entities public const string TableName = "1B2D820C"; public const string ColumnName_Id = "E386BC36"; public const string ColumnName_Enable = "6DB11594"; + string DebuggerDisplay() => $"{Name}, {Id}"; [Column(ColumnName_Id)] @@ -28,6 +29,7 @@ namespace System.Application.Entities [Column("8061969F")] public int Order { get; set; } = 10; + /// /// 显示名称 /// @@ -54,7 +56,6 @@ namespace System.Application.Entities [Column("F1DDBF5B")] public Guid? Pid { get; set; } - /// /// 文件地址 /// @@ -129,7 +130,6 @@ namespace System.Application.Entities [Column("5C02E4AA")] public string? RequiredJs { get; set; } - /// /// 哈希值(MD5) /// @@ -142,7 +142,6 @@ namespace System.Application.Entities [Column("C5645EF3")] public string SHA512 { get; set; } - [Column("58FF2FF5")] public DateTime CreationTime { get; set; } = DateTime.Now; @@ -151,9 +150,6 @@ namespace System.Application.Entities /// [Column("8B9C94E5")] public bool IsBuild { get; set; } = true; - - - } } #pragma warning restore CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。 \ No newline at end of file diff --git a/src/ST.Client/Models/AuthorizedDevice.cs b/src/ST.Client/Models/AuthorizedDevice.cs index 1c00f115f..16555e4cc 100644 --- a/src/ST.Client/Models/AuthorizedDevice.cs +++ b/src/ST.Client/Models/AuthorizedDevice.cs @@ -1,24 +1,24 @@ using ReactiveUI; using System.Threading.Tasks; using static System.Application.SteamApiUrls; - using MPKey = MessagePack.KeyAttribute; using MPObj = MessagePack.MessagePackObjectAttribute; + namespace System.Application.Models { public class AuthorizedDevice : ReactiveObject { public const long UndefinedId = 76561197960265728; - public AuthorizedDevice() - { - } + public AuthorizedDevice() { } public AuthorizedDevice(string vdfString) : this() { OriginVdfString = vdfString; } + public bool Disable { get; set; } + public string ProfileUrl => string.Format(STEAM_PROFILES_URL, SteamId64_Int); public bool First { get; set; } @@ -32,6 +32,7 @@ namespace System.Application.Models public long SteamId64_Int => UndefinedId + SteamId3_Int; string? _OnlineState; + public string? OnlineState { get => _OnlineState; @@ -39,6 +40,7 @@ namespace System.Application.Models } string? _Remark; + /// /// 备注 /// @@ -74,6 +76,7 @@ namespace System.Application.Models public string? AvatarMedium { get; set; } Task? _AvatarStream; + public Task? AvatarStream { get => _AvatarStream; @@ -88,15 +91,19 @@ namespace System.Application.Models "\t\t\t\"description\"\t\t\"" + Description + "\"\n" + "\t\t\t\"tokenid\"\t\t\"" + Tokenid + "\"\n\t\t}"; } + [MPObj] public class DisableAuthorizedDevice { [MPKey(0)] public long SteamId3_Int { get; set; } + [MPKey(1)] public long Timeused { get; set; } + [MPKey(2)] public string? Description { get; set; } + [MPKey(3)] public string? Tokenid { get; set; } } diff --git a/src/ST.Client/Models/CurrentUser.cs b/src/ST.Client/Models/CurrentUser.cs index b95057569..7cb671ec3 100644 --- a/src/ST.Client/Models/CurrentUser.cs +++ b/src/ST.Client/Models/CurrentUser.cs @@ -1,4 +1,4 @@ -using System.Application.Columns; +using System.Application.Columns; using MPKey = MessagePack.KeyAttribute; using MPObj = MessagePack.MessagePackObjectAttribute; using N_JsonProperty = Newtonsoft.Json.JsonPropertyAttribute; diff --git a/src/ST.Client/Models/Enums/EnumModel.cs b/src/ST.Client/Models/Enums/EnumModel.cs index 070c503b3..10a60ad49 100644 --- a/src/ST.Client/Models/Enums/EnumModel.cs +++ b/src/ST.Client/Models/Enums/EnumModel.cs @@ -1,5 +1,4 @@ using ReactiveUI; -using System; using System.Application.UI.Resx; using System.Collections.Generic; using System.Text; @@ -30,6 +29,7 @@ namespace System.Application.Models } private string? _Name; + public string? Name { get => _Name; @@ -49,6 +49,7 @@ namespace System.Application.Models } T _Value; + public T Value { get => _Value; @@ -56,6 +57,7 @@ namespace System.Application.Models } bool _Enable; + public bool Enable { get => _Enable; @@ -63,6 +65,7 @@ namespace System.Application.Models } int _Count; + /// /// 枚举作为 type 时统计集合数量 /// diff --git a/src/ST.Client/Models/MyAuthenticator.Mobile.cs b/src/ST.Client/Models/MyAuthenticator.Mobile.cs index 0b0605a23..b4b3d15da 100644 --- a/src/ST.Client/Models/MyAuthenticator.Mobile.cs +++ b/src/ST.Client/Models/MyAuthenticator.Mobile.cs @@ -31,6 +31,7 @@ namespace System.Application.Models } int _AutoRefreshCodeTimingCurrent = -1; + /// /// 当前自动刷新倒计时值 /// diff --git a/src/ST.Client/Models/MyAuthenticator.cs b/src/ST.Client/Models/MyAuthenticator.cs index a817fab33..b687b3b3a 100644 --- a/src/ST.Client/Models/MyAuthenticator.cs +++ b/src/ST.Client/Models/MyAuthenticator.cs @@ -34,10 +34,7 @@ namespace System.Application.Models public ushort Id { - get - { - return AuthenticatorData.Id; - } + get => AuthenticatorData.Id; set { AuthenticatorData.Id = value; @@ -46,12 +43,10 @@ namespace System.Application.Models } public string OriginName; + public string Name { - get - { - return AuthenticatorData.Name; - } + get => AuthenticatorData.Name; set { AuthenticatorData.Name = value; @@ -61,10 +56,7 @@ namespace System.Application.Models public int Index { - get - { - return AuthenticatorData.Index; - } + get => AuthenticatorData.Index; set { AuthenticatorData.Index = value; @@ -74,10 +66,7 @@ namespace System.Application.Models public DateTimeOffset Create { - get - { - return AuthenticatorData.Created; - } + get => AuthenticatorData.Created; set { AuthenticatorData.Created = value; @@ -87,10 +76,7 @@ namespace System.Application.Models public int Period { - get - { - return AuthenticatorData.Value.Period; - } + get => AuthenticatorData.Value.Period; set { AuthenticatorData.Value.Period = value; @@ -100,12 +86,10 @@ namespace System.Application.Models public const int CodeCountdownMax = 100; private int _CodeCountdown = CodeCountdownMax; + public int CodeCountdown { - get - { - return _CodeCountdown; - } + get => _CodeCountdown; set { _CodeCountdown = value; @@ -146,10 +130,7 @@ namespace System.Application.Models return r; } } - set - { - this.RaiseAndSetIfChanged(ref _CurrentCode, value); - } + set => this.RaiseAndSetIfChanged(ref _CurrentCode, value); } public string CurrentCodeCache @@ -317,12 +298,10 @@ namespace System.Application.Models } private bool _IsShowCode; + public bool IsShowCode { - get - { - return _IsShowCode; - } + get => _IsShowCode; set { _IsShowCode = value; diff --git a/src/ST.Client/Models/SizePosition.cs b/src/ST.Client/Models/SizePosition.cs index d71da35aa..f3e9e9b49 100644 --- a/src/ST.Client/Models/SizePosition.cs +++ b/src/ST.Client/Models/SizePosition.cs @@ -1,5 +1,4 @@ using ReactiveUI; -using System; using System.Collections.Generic; using System.Text; using MPKey = MessagePack.KeyAttribute; @@ -11,6 +10,7 @@ namespace System.Application.Models public sealed class SizePosition : ReactiveObject { int _X; + [MPKey(0)] public int X { @@ -19,6 +19,7 @@ namespace System.Application.Models } int _Y; + [MPKey(1)] public int Y { @@ -27,6 +28,7 @@ namespace System.Application.Models } double _Height; + [MPKey(2)] public double Height { @@ -35,6 +37,7 @@ namespace System.Application.Models } double _Width; + [MPKey(3)] public double Width { diff --git a/src/ST.Client/Models/Steam/AchievementInfo.cs b/src/ST.Client/Models/Steam/AchievementInfo.cs index ecdb0b8ea..5e8249a37 100644 --- a/src/ST.Client/Models/Steam/AchievementInfo.cs +++ b/src/ST.Client/Models/Steam/AchievementInfo.cs @@ -27,6 +27,7 @@ namespace System.Application.Models public bool IsAchieved { get; set; } private bool _IsChecked; + public bool IsChecked { get => _IsChecked; diff --git a/src/ST.Client/Models/Steam/FloatStatInfo.cs b/src/ST.Client/Models/Steam/FloatStatInfo.cs index 02a4a3e30..d54d93584 100644 --- a/src/ST.Client/Models/Steam/FloatStatInfo.cs +++ b/src/ST.Client/Models/Steam/FloatStatInfo.cs @@ -18,7 +18,7 @@ public override object Value { - get { return FloatValue; } + get => FloatValue; set { var b = float.TryParse((string)value, out float f); @@ -36,9 +36,6 @@ } } - public override bool IsModified - { - get { return FloatValue.Equals(OriginalValue) == false; } - } + public override bool IsModified => !FloatValue.Equals(OriginalValue); } } \ No newline at end of file diff --git a/src/ST.Client/Models/Steam/IntStatInfo.cs b/src/ST.Client/Models/Steam/IntStatInfo.cs index cce802e19..448ec58ee 100644 --- a/src/ST.Client/Models/Steam/IntStatInfo.cs +++ b/src/ST.Client/Models/Steam/IntStatInfo.cs @@ -1,4 +1,4 @@ -namespace System.Application.Models +namespace System.Application.Models { public class IntStatInfo : StatInfo { @@ -18,7 +18,7 @@ public override object Value { - get { return IntValue; } + get => IntValue; set { var b = int.TryParse((string)value, out int i); @@ -36,9 +36,6 @@ } } - public override bool IsModified - { - get { return IntValue != OriginalValue; } - } + public override bool IsModified => IntValue != OriginalValue; } } \ No newline at end of file diff --git a/src/ST.Client/Models/Steam/KeyValue.cs b/src/ST.Client/Models/Steam/KeyValue.cs index b7dc93b85..2747d4c7f 100644 --- a/src/ST.Client/Models/Steam/KeyValue.cs +++ b/src/ST.Client/Models/Steam/KeyValue.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -16,6 +15,7 @@ namespace System.Application.Models Achievements = 4, GroupAchievements = 5, } + public class KeyValue { private static readonly KeyValue _Invalid = new(); diff --git a/src/ST.Client/Models/Steam/ModifiedApp.cs b/src/ST.Client/Models/Steam/ModifiedApp.cs index 958e6db03..05428d4df 100644 --- a/src/ST.Client/Models/Steam/ModifiedApp.cs +++ b/src/ST.Client/Models/Steam/ModifiedApp.cs @@ -36,10 +36,12 @@ namespace System.Application.Models public uint AppId { get; set; } private byte[]? originalData; + [MPKey(1)] public byte[]? OriginalData { get => originalData; set => originalData = value; } private byte[]? changesData; + [MPKey(2)] public byte[]? ChangesData { get => changesData; set => changesData = value; } diff --git a/src/ST.Client/Models/Steam/SteamApp.cs b/src/ST.Client/Models/Steam/SteamApp.cs index ba60c5280..7d5a69047 100644 --- a/src/ST.Client/Models/Steam/SteamApp.cs +++ b/src/ST.Client/Models/Steam/SteamApp.cs @@ -47,7 +47,6 @@ namespace System.Application.Models private const string NodeLaunch = "launch"; - public SteamApp() { } public SteamApp(uint appid) @@ -76,9 +75,10 @@ namespace System.Application.Models public string? BaseName { get; set; } string? _Name; + public string? Name { - get { return _Name; } + get => _Name; set { if (_Name != value) @@ -91,9 +91,10 @@ namespace System.Application.Models } string? _SortAs; + public string? SortAs { - get { return _SortAs; } + get => _SortAs; set { if (_SortAs != value) @@ -308,6 +309,7 @@ namespace System.Application.Models } private bool _IsEdited; + public bool IsEdited { get => _IsEdited; @@ -317,9 +319,10 @@ namespace System.Application.Models public string DisplayName => string.IsNullOrEmpty(Name) ? AppId.ToString() : Name; string? _baseDLSSVersion; + public string? BaseDLSSVersion { - get { return _baseDLSSVersion; } + get => _baseDLSSVersion; set { if (_baseDLSSVersion != value) @@ -331,9 +334,10 @@ namespace System.Application.Models } string? _currentDLSSVersion; + public string? CurrentDLSSVersion { - get { return _currentDLSSVersion; } + get => _currentDLSSVersion; set { if (_currentDLSSVersion != value) @@ -343,6 +347,7 @@ namespace System.Application.Models } } } + public bool HasDLSS { get; set; } public string? Logo { get; set; } @@ -379,6 +384,7 @@ namespace System.Application.Models public DateTime LastUpdated { get; set; } private long _SizeOnDi; + /// /// 占用硬盘字节大小 /// @@ -413,6 +419,7 @@ namespace System.Application.Models public IList ChildApp { get; set; } = new List(); private ObservableCollection? _LaunchItems; + public ObservableCollection? LaunchItems { get => _LaunchItems; @@ -420,6 +427,7 @@ namespace System.Application.Models } private ObservableCollection? _SaveFiles; + public ObservableCollection? SaveFiles { get => _SaveFiles; @@ -430,9 +438,11 @@ namespace System.Application.Models string.Format(STEAMAPP_LOGO_URL, AppId, Logo); public string LibraryGridUrl => string.Format(STEAMAPP_LIBRARY_URL, AppId); + public Task LibraryGridStream => ISteamService.Instance.GetAppImageAsync(this, LibCacheType.Library_Grid); private Stream? _EditLibraryGridStream; + public Stream? EditLibraryGridStream { get => _EditLibraryGridStream; @@ -440,9 +450,11 @@ namespace System.Application.Models } public string LibraryHeroUrl => string.Format(STEAMAPP_LIBRARYHERO_URL, AppId); + public Task LibraryHeroStream => ISteamService.Instance.GetAppImageAsync(this, LibCacheType.Library_Hero); private Stream? _EditLibraryHeroStream; + public Stream? EditLibraryHeroStream { get => _EditLibraryHeroStream; @@ -450,13 +462,15 @@ namespace System.Application.Models } public string LibraryHeroBlurUrl => string.Format(STEAMAPP_LIBRARYHEROBLUR_URL, AppId); + public Task LibraryHeroBlurStream => ISteamService.Instance.GetAppImageAsync(this, LibCacheType.Library_Hero_Blur); - public string LibraryLogoUrl => string.Format(STEAMAPP_LIBRARYLOGO_URL, AppId); + public Task LibraryLogoStream => ISteamService.Instance.GetAppImageAsync(this, LibCacheType.Logo); private Stream? _EditLibraryLogoStream; + public Stream? EditLibraryLogoStream { get => _EditLibraryLogoStream; @@ -464,13 +478,14 @@ namespace System.Application.Models } public string HeaderLogoUrl => string.Format(STEAMAPP_HEADIMAGE_URL, AppId); - public string CAPSULELogoUrl => string.Format(STEAMAPP_CAPSULE_URL, AppId); + public string CAPSULELogoUrl => string.Format(STEAMAPP_CAPSULE_URL, AppId); public string? IconUrl => string.IsNullOrEmpty(Icon) ? null : string.Format(STEAMAPP_LOGO_URL, AppId, Icon); private Process? _Process; + public Process? Process { get => _Process; @@ -478,6 +493,7 @@ namespace System.Application.Models } private bool _IsWatchDownloading; + public bool IsWatchDownloading { get => _IsWatchDownloading; @@ -500,9 +516,11 @@ namespace System.Application.Models private uint _changeNumber; private byte[] _originalData; + public byte[] OriginalData { get => _originalData; set => _originalData = value; } private SteamAppPropertyTable? _properties; + public SteamAppPropertyTable? ChangesData => _properties; //public event EventHandler? Modified; diff --git a/src/ST.Client/Models/Steam/SteamAppProperty.cs b/src/ST.Client/Models/Steam/SteamAppProperty.cs index 0477d8761..205a81ba9 100644 --- a/src/ST.Client/Models/Steam/SteamAppProperty.cs +++ b/src/ST.Client/Models/Steam/SteamAppProperty.cs @@ -7,7 +7,7 @@ namespace System.Application.Models { public class SteamAppProperty { - private static readonly Type[] _types = new Type[9] + private static readonly Type?[] _types = new Type?[9] { typeof(SteamAppPropertyTable), typeof(string), @@ -24,7 +24,7 @@ namespace System.Application.Models private SteamAppPropertyType _propType; - private object _value; + private object? _value; public SteamAppPropertyType PropertyType { @@ -32,6 +32,7 @@ namespace System.Application.Models { return _propType; } + internal set { if (_propType != value) @@ -42,14 +43,15 @@ namespace System.Application.Models } } - public Type ValueType => _types[(int)_propType]; + public Type? ValueType => _types[(int)_propType]; - internal object Value + internal object? Value { get { return _value; } + set { _value = null; @@ -84,23 +86,23 @@ namespace System.Application.Models } } - public T GetValue() + public T? GetValue() { TryGetValue(out var result); return result; } - public bool TryGetValue(out T result) + public bool TryGetValue(out T? result) { - result = default(T); + result = default; bool result2 = false; int propType = (int)_propType; if (propType >= 0 && propType < _types.Length) { - Type type = _types[propType]; + var type = _types[propType]; if (type != null && typeof(T).IsAssignableFrom(type)) { - result = (T)_value; + result = _value == null ? default : (T)_value; result2 = true; } } diff --git a/src/ST.Client/Models/Steam/SteamAppSaveFile.cs b/src/ST.Client/Models/Steam/SteamAppSaveFile.cs index 016bd6664..8449ff16f 100644 --- a/src/ST.Client/Models/Steam/SteamAppSaveFile.cs +++ b/src/ST.Client/Models/Steam/SteamAppSaveFile.cs @@ -27,6 +27,7 @@ namespace System.Application.Models public string? Pattern { get; set; } private string? _FormatDirPath; + public string? FormatDirPath { get => _FormatDirPath; @@ -34,6 +35,7 @@ namespace System.Application.Models } private string? _FormatFilePath; + public string? FormatFilePath { get => _FormatFilePath; @@ -44,7 +46,6 @@ namespace System.Application.Models public string? Platforms { get; set; } - public void FormatPathGenerate() { if (string.IsNullOrEmpty(Root) || string.IsNullOrEmpty(Path) || string.IsNullOrEmpty(Pattern)) @@ -66,15 +67,14 @@ namespace System.Application.Models { path = SteamConnectService.Current.SteamApps.Lookup(ParentAppId).Value?.InstalledDir; } - + if (string.IsNullOrEmpty(path)) return; - + path = FilePath.Combine(path, Path.Replace("{64BitSteamID}", SteamConnectService.Current.CurrentSteamUser?.SteamId64.ToString()) .Replace("{Steam3AccountID}", SteamConnectService.Current.CurrentSteamUser?.SteamId32.ToString())); - FormatDirPath = @FilePath.GetFullPath(path); FormatFilePath = @FilePath.GetFullPath(FilePath.Combine(path, Pattern)); diff --git a/src/ST.Client/Models/Steam/SteamUser.cs b/src/ST.Client/Models/Steam/SteamUser.cs index eeffc5244..113d72c57 100644 --- a/src/ST.Client/Models/Steam/SteamUser.cs +++ b/src/ST.Client/Models/Steam/SteamUser.cs @@ -37,6 +37,7 @@ namespace System.Application.Models public string UserdataPath => Path.Combine("userdata", SteamId32.ToString()); private string? _OnlineState; + /// /// 在线状态 /// @@ -48,6 +49,7 @@ namespace System.Application.Models } private int? _Level; + /// /// Steam等级 /// @@ -76,6 +78,7 @@ namespace System.Application.Models public string? AvatarMedium { get; set; } private Task? _AvatarStream; + [XmlIgnore] public Task? AvatarStream { @@ -152,6 +155,7 @@ namespace System.Application.Models public DateTime LastLoginTime { get; set; } private bool _MostRecent; + /// /// 最近登录 /// @@ -163,6 +167,7 @@ namespace System.Application.Models } private bool _WantsOfflineMode; + /// /// 离线模式 /// @@ -179,8 +184,8 @@ namespace System.Application.Models [XmlIgnore] public bool SkipOfflineModeWarning { get; set; } - private string? _Remark; + /// /// 备注 /// @@ -191,8 +196,8 @@ namespace System.Application.Models set => this.RaiseAndSetIfChanged(ref _Remark, value); } - private SteamMiniProfile? _MiniProfile; + public SteamMiniProfile? MiniProfile { get => _MiniProfile; diff --git a/src/ST.Client/Repositories/IScriptRepository.cs b/src/ST.Client/Repositories/IScriptRepository.cs index d72fa8046..f1af0108d 100644 --- a/src/ST.Client/Repositories/IScriptRepository.cs +++ b/src/ST.Client/Repositories/IScriptRepository.cs @@ -1,4 +1,3 @@ -using System; using System.Application.Entities; using System.Application.Models; using System.Collections.Generic; @@ -19,6 +18,7 @@ namespace System.Application.Repositories Task