├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.en.md │ ├── bug-report.md │ ├── question.en.md │ └── question.md └── workflows │ ├── CI.yml │ └── docfx_page.yml ├── .gitignore ├── .gitmodules ├── BD.SteamClient8.sln ├── LICENSE ├── README.md ├── api ├── .gitignore ├── index.md └── toc.yml ├── crowdin.yml ├── doc ├── Protobuf.md ├── index.md └── toc.yml ├── docfx.json ├── index.md ├── renovate.json ├── res ├── DocFXIcon.png └── i18n │ ├── BD.SteamClient8.Primitives.en.resx │ ├── BD.SteamClient8.Primitives.es.resx │ ├── BD.SteamClient8.Primitives.it.resx │ ├── BD.SteamClient8.Primitives.ja.resx │ ├── BD.SteamClient8.Primitives.ko.resx │ ├── BD.SteamClient8.Primitives.resx │ ├── BD.SteamClient8.Primitives.ru.resx │ └── BD.SteamClient8.Primitives.zh-Hant.resx ├── src ├── .editorconfig ├── BD.SteamClient8.Impl │ ├── BD.SteamClient8.Impl.csproj │ ├── Extensions │ │ ├── ServiceCollectionExtensions.cs │ │ └── SteamSessionExtensions.cs │ ├── README.md │ ├── Services │ │ ├── PInvoke │ │ │ ├── SteamServiceImpl.Abstract.cs │ │ │ ├── SteamServiceImpl.cs │ │ │ └── SteamworksLocalApiServiceImpl.cs │ │ └── WebApi │ │ │ ├── SteamAccountService.cs │ │ │ ├── SteamAuthenticatorServiceImpl.cs │ │ │ ├── SteamDbWebApiServiceImpl.cs │ │ │ ├── SteamGridDBWebApiServiceImpl.cs │ │ │ ├── SteamIdleCardServiceImpl.cs │ │ │ ├── SteamMarketService.cs │ │ │ ├── SteamSessionServiceImpl.cs │ │ │ ├── SteamTradeServiceImpl.cs │ │ │ └── SteamworksWebApiServiceImpl.cs │ └── WinAuth │ │ ├── BattleNetAuthenticatorNetServiceImpl.cs │ │ └── GoogleAuthenticatorNetServiceImpl.cs ├── BD.SteamClient8.Models │ ├── BD.SteamClient8.Models.csproj │ ├── Converters │ │ ├── SteamDataInt32Converter.cs │ │ ├── SteamDataInt64Converter.cs │ │ └── SteamDataStringConverter.cs │ ├── DefaultJsonSerializerContext.cs │ ├── Extensions │ │ ├── AuthenticatorExtensions.cs │ │ ├── BinaryReaderExtensions.SteamAppProperty.cs │ │ └── SteamAppExtensions.cs │ ├── PInvoke │ │ ├── AchievementAndUnlockTimeResult.cs │ │ ├── CloudArchiveQuotaResult.cs │ │ └── UserStatsReceivedResult.cs │ ├── Protobuf │ │ ├── Enums.cs │ │ ├── GoogleProtobufDescriptor.cs │ │ ├── SteamMessagesAuthSteamClient.cs │ │ ├── SteamMessagesBase.cs │ │ └── SteamMessagesUnifiedBaseSteamClient.cs │ ├── README.md │ ├── SteamIdConvert.cs │ ├── WebApi │ │ ├── AchievementInfo.cs │ │ ├── Authenticators │ │ │ ├── GenerateAccessTokenForAppResponse.cs │ │ │ ├── PhoneNumber │ │ │ │ ├── GetUserCountryResponse.cs │ │ │ │ ├── IsAccountWaitingForEmailConfirmationResponse.cs │ │ │ │ └── SteamAddPhoneNumberResponse.cs │ │ │ ├── RemoveAuthenticatorResponse.cs │ │ │ ├── SteamDoLoginJsonStruct.cs │ │ │ ├── SteamGetRsaKeyJsonStruct.cs │ │ │ ├── SteamMobileConfGetListJsonStruct.cs │ │ │ ├── SteamMobileDologinJsonStruct.cs │ │ │ └── SteamSyncStruct.cs │ │ ├── AuthorizedDevice.cs │ │ ├── CurrencyData.cs │ │ ├── CursorData.cs │ │ ├── DisableAuthorizedDevice.cs │ │ ├── FloatStatInfo.cs │ │ ├── Idles │ │ │ ├── AppCardsAvgPrice.cs │ │ │ ├── CardsMarketPrice.cs │ │ │ ├── IdleBadge.cs │ │ │ ├── SteamCard.cs │ │ │ ├── UserBadgesResponse.cs │ │ │ └── UserIdleInfo.cs │ │ ├── ImportedSDAEntry.cs │ │ ├── IntStatInfo.cs │ │ ├── LocalDlssDll.cs │ │ ├── Logins │ │ │ ├── DoLoginRespone.cs │ │ │ ├── FinalizeLoginStatus.cs │ │ │ ├── SteamLoginState.cs │ │ │ ├── SteamSession.cs │ │ │ ├── TransferInfo.cs │ │ │ ├── TransferInfoParams.cs │ │ │ └── TransferParameters.cs │ │ ├── Markets │ │ │ ├── MarketItemOrdersHistogramResponse.cs │ │ │ ├── MarketItemPriceOverviewResponse.cs │ │ │ ├── MarketListings.cs │ │ │ ├── MarketTradingHisotryRenderPageResponse.cs │ │ │ └── SellItemToMarketResponse.cs │ │ ├── PlayerSummaries.cs │ │ ├── PlayerSummariesResponse.cs │ │ ├── Profiles │ │ │ ├── HistoryParseResponse.cs │ │ │ ├── InventoryPageResponse.cs │ │ │ ├── InventoryTradingHistoryRenderPageResponse.cs │ │ │ ├── LoginHistoryItem.cs │ │ │ └── SendGiftHisotryItem.cs │ │ ├── RedeemWalletCodeResult.cs │ │ ├── RedeemWalletResponse.cs │ │ ├── StatInfo.cs │ │ ├── SteamApps │ │ │ ├── ModifiedApp.cs │ │ │ ├── SteamApp.cs │ │ │ ├── SteamAppInfo.cs │ │ │ ├── SteamAppLaunchItem.cs │ │ │ ├── SteamAppList.cs │ │ │ ├── SteamAppProperty.cs │ │ │ ├── SteamAppPropertyTable.cs │ │ │ ├── SteamAppSaveFile.cs │ │ │ └── SteamApps.cs │ │ ├── SteamGridDB │ │ │ ├── SteamGridApp.cs │ │ │ └── SteamGridItem.cs │ │ ├── SteamKeyValue.cs │ │ ├── SteamMiniProfile.cs │ │ ├── SteamMiniProfileBadge.cs │ │ ├── SteamMiniProfileGame.cs │ │ ├── SteamMiniProfileProfileBackground.cs │ │ ├── SteamRemoteFile.cs │ │ ├── SteamUser.cs │ │ └── Trades │ │ │ ├── TradeAsset.cs │ │ │ ├── TradeConfirmation.cs │ │ │ ├── TradeHistory.cs │ │ │ ├── TradeOffersInfo.cs │ │ │ ├── TradeOffersItem.cs │ │ │ └── TradeSummary.cs │ └── WinAuth │ │ ├── Abstractions │ │ ├── IAuthenticatorModel.cs │ │ └── IAuthenticatorValueModel.cs │ │ ├── AuthenticatorException.cs │ │ ├── AuthenticatorExportModel.cs │ │ ├── AuthenticatorModel.cs │ │ ├── AuthenticatorValueModel.cs │ │ ├── Base32.cs │ │ ├── BattleNetAuthenticator.IAuthenticatorNetService.cs │ │ ├── BattleNetAuthenticator.cs │ │ ├── GoogleAuthenticator.IAuthenticatorNetService.cs │ │ ├── GoogleAuthenticator.cs │ │ ├── HOTPAuthenticator.cs │ │ ├── MicrosoftAuthenticator.cs │ │ ├── SteamAuthenticator.IAuthenticatorNetService.cs │ │ ├── SteamAuthenticator.cs │ │ └── TOTPAuthenticator.cs ├── BD.SteamClient8.Primitives │ ├── BD.SteamClient8.Primitives.csproj │ ├── Columns │ │ └── Authenticators │ │ │ └── IOrderAuthenticator.cs │ ├── Constants │ │ ├── SteamApiUrls.cs │ │ └── SteamGridDBApiUrls.cs │ ├── Enums │ │ ├── Authenticators │ │ │ ├── AuthenticatorPlatform.cs │ │ │ └── HMACTypes.cs │ │ └── WebApi │ │ │ ├── Markets │ │ │ └── MarketTradingHisotryRowType.cs │ │ │ ├── PersonaState.cs │ │ │ ├── PurchaseResultDetail.cs │ │ │ ├── SteamApps │ │ │ ├── LibCacheType.cs │ │ │ ├── SteamAppPropertyType.cs │ │ │ ├── SteamAppRunType.cs │ │ │ └── SteamAppType.cs │ │ │ ├── SteamGridDB │ │ │ └── SteamGridItemType.cs │ │ │ ├── SteamResult.cs │ │ │ └── Trades │ │ │ ├── TradeOfferState.cs │ │ │ ├── TradeTag.cs │ │ │ └── TradeTaskEnum.cs │ ├── Extensions │ │ └── CurrencyCodeEnumExtensions.cs │ ├── README.md │ └── Resources │ │ └── Strings.ResXGeneratedCodeAttributes.cs ├── BD.SteamClient8.UnitTest │ ├── Abstractions │ │ └── ServiceTestBase.cs │ ├── AuthenticatorTest.cs │ ├── BD.SteamClient8.UnitTest.csproj │ ├── Extensions │ │ └── ServiceCollectionExtensions.TryAddHttpPlatformHelper.cs │ ├── Helpers │ │ ├── SteamAuthenticatorHelper.cs │ │ └── SteamLoginStateHelper.cs │ ├── PInvokeTest.cs │ ├── ProjectUtilsTest.cs │ ├── ResxTest.cs │ ├── SteamAccountServiceTest.cs │ ├── SteamDBWebApiTest.cs │ ├── SteamGridDBWebApiTest.cs │ ├── SteamIdleServiceTest.cs │ ├── SteamMarketServiceTest.cs │ ├── SteamTradeServiceTest.cs │ └── SteamworksWebApiTest.cs ├── BD.SteamClient8.ViewModels │ ├── AchievementInfoViewModel.cs │ ├── AuthorizedDeviceViewModel.cs │ ├── BD.SteamClient8.ViewModels.csproj │ ├── Expressions │ │ └── PropertySetExpression.cs │ ├── FodyWeavers.xml │ ├── SampleViewModel.cs │ ├── SteamAppLaunchItemViewModel.cs │ ├── SteamAppSaveFileViewModel.cs │ ├── SteamAppViewModel.cs │ ├── SteamRemoteFileViewModel.cs │ └── SteamUserViewModel.cs ├── BD.SteamClient8 │ ├── BD.SteamClient8.csproj │ ├── Extensions │ │ └── WinAuthExtensions.cs │ ├── FodyWeavers.xml │ ├── Helpers │ │ ├── CurrencyHelper.cs │ │ └── VdfHelper.cs │ ├── README.md │ └── Services │ │ └── Abstractions │ │ ├── PInvoke │ │ ├── ISteamService.Methods.cs │ │ ├── ISteamService.Properties.cs │ │ ├── ISteamService.cs │ │ └── ISteamworksLocalApiService.cs │ │ └── WebApi │ │ ├── ISteamAccountService.cs │ │ ├── ISteamAuthenticatorService.cs │ │ ├── ISteamDbWebApiService.cs │ │ ├── ISteamGridDBWebApiServiceImpl.cs │ │ ├── ISteamIdleCardService.cs │ │ ├── ISteamMarketService.cs │ │ ├── ISteamSessionService.cs │ │ ├── ISteamTradeService.cs │ │ └── ISteamworksWebApiService.cs ├── Directory.Build.props ├── Directory.Build.targets ├── Directory.Packages.props ├── Protobuf │ ├── enums.proto │ ├── google-protobuf-descriptor.proto │ ├── steammessages_auth.steamclient.proto │ ├── steammessages_base.proto │ └── steammessages_unified_base.steamclient.proto ├── SAM.API │ ├── Callback.cs │ ├── Callbacks │ │ ├── AppDataChanged.cs │ │ └── UserStatsReceived.cs │ ├── Client.cs │ ├── ClientInitializeException.cs │ ├── ClientInitializeFailure.cs │ ├── Helpers.cs │ ├── ICallback.cs │ ├── INativeWrapper.cs │ ├── Interfaces │ │ ├── ISteamApps001.cs │ │ ├── ISteamApps008.cs │ │ ├── ISteamClient018.cs │ │ ├── ISteamRemoteStorage014.cs │ │ ├── ISteamUGC015.cs │ │ ├── ISteamUser012.cs │ │ ├── ISteamUser019.cs │ │ ├── ISteamUserStats007.cs │ │ ├── ISteamUtils005.cs │ │ └── ISteamUtils009.cs │ ├── LICENSE.txt │ ├── NativeClass.cs │ ├── NativeStrings.cs │ ├── NativeWrapper.cs │ ├── Steam.cs │ ├── Types │ │ ├── AccountType.cs │ │ ├── AppDataChanged.cs │ │ ├── CallbackMessage.cs │ │ ├── ItemRequestResult.cs │ │ ├── RemoteStorageCommon.cs │ │ ├── UserItemsReceived.cs │ │ ├── UserStatType.cs │ │ ├── UserStatsReceived.cs │ │ └── UserStatsStored.cs │ └── Wrappers │ │ ├── SteamApps001.cs │ │ ├── SteamApps008.cs │ │ ├── SteamClient018.cs │ │ ├── SteamRemoteStorage014.cs │ │ ├── SteamUGC015.cs │ │ ├── SteamUser012.cs │ │ ├── SteamUser019.cs │ │ ├── SteamUserStats007.cs │ │ ├── SteamUtils005.cs │ │ └── SteamUtils009.cs ├── Sdk │ ├── BD.SteamClient8.Sdk.Lib.targets │ ├── BD.SteamClient8.Sdk.Ref.Link.targets │ ├── BD.SteamClient8.Sdk.Ref.Package.targets │ ├── BD.SteamClient8.Sdk.Ref.Project.targets │ ├── BD.SteamClient8.Sdk.csproj │ ├── BD.SteamClient8.Sdk.targets │ ├── GeneratePackage.props │ ├── Links │ │ ├── SteamAchievementManager.props │ │ └── ValveKeyValue.props │ ├── Projects │ │ ├── BD.SteamClient8.Impl.props │ │ ├── BD.SteamClient8.Models.props │ │ ├── BD.SteamClient8.Primitives.props │ │ └── BD.SteamClient8.props │ ├── TFM_NETX_WINDOWS.props │ ├── TFM_NETX_WITH_ALL.props │ ├── TFM_NETX_WITH_DESKTOP.props │ └── buildTransitive │ │ ├── BD.SteamClient8.Primitives.props │ │ └── BD.SteamClient8.Primitives.targets ├── Shared │ ├── GlobalUsings.BD.SteamClient8.Impl.props │ ├── GlobalUsings.BD.SteamClient8.Models.props │ ├── GlobalUsings.BD.SteamClient8.Primitives.props │ ├── GlobalUsings.BD.SteamClient8.UnitTest.props │ ├── GlobalUsings.BD.SteamClient8.props │ ├── GlobalUsings.BouncyCastle.props │ ├── GlobalUsings.SteamAchievementManager.props │ ├── GlobalUsings.ValveKeyValue.props │ └── InternalsVisibleTo.BD.SteamClient8.UnitTest.cs ├── TFM_NETX.props ├── TFM_NETX_SINGLE.props ├── TFM_NETX_WINDOWS.props ├── TFM_NETX_WITH_ALL.props ├── TFM_NETX_WITH_DESKTOP.props ├── TFM_NETX_WITH_WINDOWS.props ├── Tools.Build │ ├── Properties │ │ └── launchSettings.json │ └── Tools.Build.csproj ├── Tools.DocFX │ └── Tools.DocFX.csproj ├── Tools.Sort.PackageVersion │ └── Tools.Sort.PackageVersion.csproj ├── Version.props └── WinAuth │ ├── BD.WTTS │ ├── Columns │ │ └── IOrderAuthenticator.cs │ ├── Enums │ │ ├── AuthenticatorPlatform.cs │ │ └── HMACTypes.cs │ └── Models │ │ ├── Abstractions │ │ ├── IAuthenticatorDTO.cs │ │ └── IAuthenticatorValueDTO.cs │ │ ├── AuthenticatorDTO.cs │ │ ├── AuthenticatorExportDTO.cs │ │ └── AuthenticatorValueDTO.cs │ ├── Extensions │ └── AuthenticatorDTOExtensions.cs │ ├── FodyWeavers.xml │ ├── Services.Implementation │ ├── AuthenticatorNetService.BattleNet.cs │ ├── AuthenticatorNetService.Google.cs │ ├── AuthenticatorNetService.HOTP.cs │ ├── AuthenticatorNetService.Microsoft.cs │ └── AuthenticatorNetService.cs │ ├── Services │ ├── IAuthenticatorNetService.BattleNet.cs │ ├── IAuthenticatorNetService.Google.cs │ ├── IAuthenticatorNetService.HOTP.cs │ └── IAuthenticatorNetService.Microsoft.cs │ ├── WinAuth.csproj │ └── WinAuth │ ├── Authenticator.cs │ ├── AuthenticatorException.cs │ ├── Base32.cs │ ├── BattleNetAuthenticator.cs │ ├── GoogleAuthenticator.cs │ ├── HOTPAuthenticator.cs │ ├── IAuthenticator.cs │ ├── MicrosoftAuthenticator.cs │ ├── SteamAuthenticator.cs │ ├── SteamClient.cs │ ├── Strings.Designer.cs │ ├── Strings.en.resx │ ├── Strings.resx │ └── TOTPAuthenticator.cs ├── templates └── default │ └── layout │ └── _master.tmpl └── toc.yml /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ref/Common"] 2 | path = ref/Common 3 | url = https://github.com/BeyondDimension/Common.git 4 | [submodule "ref/ValveKeyValue"] 5 | path = ref/ValveKeyValue 6 | url = https://github.com/BeyondDimension/ValveKeyValue.git 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SteamClient [![Crowdin](https://badges.crowdin.net/bdsteamclient8/localized.svg)](https://crowdin.com/project/bdsteamclient8) [![NuGet](https://img.shields.io/nuget/v/BD.SteamClient8.svg)](https://www.nuget.org/packages/BD.SteamClient8) [![license](https://img.shields.io/github/license/beyonddimension/SteamClient)](https://github.com/BeyondDimension/SteamClient/blob/dev8/LICENSE) 2 | 3 | [次元超越 Steam 相关库文档](https://beyonddimension.github.io/SteamClient) 4 | 5 | ### BD.SteamClient8 6 | Steam 相关服务接口库,扩展函数、助手类 7 | 8 | ### BD.SteamClient8.Impl 9 | Steam 相关服务实现库 10 | 11 | ### BD.SteamClient8.Models 12 | Steam 相关模型库 13 | 14 | ### BD.SteamClient8.Primitives 15 | Steam 相关基本类库,枚举 16 | 17 | ### BD.SteamClient8.ViewModels 18 | Steam 相关调用视图模型库 19 | -------------------------------------------------------------------------------- /api/.gitignore: -------------------------------------------------------------------------------- 1 | ############### 2 | # temp file # 3 | ############### 4 | *.yml 5 | .manifest 6 | /* 7 | !/toc.yml 8 | -------------------------------------------------------------------------------- /api/index.md: -------------------------------------------------------------------------------- 1 | # PLACEHOLDER 2 | TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*! 3 | -------------------------------------------------------------------------------- /api/toc.yml: -------------------------------------------------------------------------------- 1 | items: 2 | - name: SharedLibrary 共享库 3 | items: 4 | - name: BD.SteamClient8 5 | href: BD.SteamClient8/toc.yml 6 | - name: BD.SteamClient8.Impl 7 | href: BD.SteamClient8.Impl/toc.yml 8 | - name: BD.SteamClient8.Models 9 | href: BD.SteamClient8.Models/toc.yml 10 | - name: BD.SteamClient8.Primitives 11 | href: BD.SteamClient8.Primitives/toc.yml 12 | - name: Tools 工具 13 | items: 14 | - name: Tools.Build 15 | - name: Tools.DocFX 16 | - name: Tools.Sort.PackageVersion 17 | - name: UnitTest 单元测试 18 | items: 19 | - name: BD.SteamClient8.UnitTest 20 | -------------------------------------------------------------------------------- /crowdin.yml: -------------------------------------------------------------------------------- 1 | files: 2 | - source: /res/i18n/BD.SteamClient8.Primitives.resx 3 | ignore: 4 | - '*.cs' 5 | translation: /res/i18n/BD.SteamClient8.Primitives.%two_letters_code%.resx 6 | -------------------------------------------------------------------------------- /doc/Protobuf.md: -------------------------------------------------------------------------------- 1 | ### 协议缓冲区 2 | [协议缓冲区基础知识:C#](https://protobuf.dev/getting-started/csharptutorial) 3 | 4 | https://github.com/protocolbuffers/protobuf/releases/tag/v25.0 5 | 6 | ## Proto files 7 | - https://github.com/SteamDatabase/Protobufs/blob/master/steam/enums.proto 8 | - https://github.com/SteamDatabase/Protobufs/blob/master/steam/steammessages_base.proto 9 | - https://github.com/SteamDatabase/Protobufs/blob/master/steam/steammessages_auth.steamclient.proto 10 | - https://github.com/SteamDatabase/Protobufs/blob/master/steam/steammessages_unified_base.steamclient.proto -------------------------------------------------------------------------------- /doc/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | redirect_url: "Protobuf.html" 3 | --- -------------------------------------------------------------------------------- /doc/toc.yml: -------------------------------------------------------------------------------- 1 | - name: 协议缓冲区 2 | href: Protobuf.md -------------------------------------------------------------------------------- /docfx.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": [ 3 | { 4 | "src": [{ "files": ["src/artifacts/bin/BD.SteamClient8/**/BD.SteamClient8.dll"]}], 5 | "dest": "api/BD.SteamClient8" 6 | }, 7 | { 8 | "src": [{ "files": ["src/artifacts/bin/BD.SteamClient8.Impl/**/BD.SteamClient8.Impl.dll"]}], 9 | "dest": "api/BD.SteamClient8.Impl" 10 | }, 11 | { 12 | "src": [{ "files": ["src/artifacts/bin/BD.SteamClient8.Models/**/BD.SteamClient8.Models.dll"]}], 13 | "dest": "api/BD.SteamClient8.Models" 14 | }, 15 | { 16 | "src": [{ "files": ["src/artifacts/bin/BD.SteamClient8.Primitives/**/BD.SteamClient8.Primitives.dll"]}], 17 | "dest": "api/BD.SteamClient8.Primitives" 18 | } 19 | ], 20 | "build": { 21 | "content": [ 22 | { 23 | "files": [ 24 | "**/*.{md,yml}", 25 | "toc.yml", 26 | "*.html", 27 | "*.md", 28 | "**/**/*.{md,yml}" 29 | ], 30 | "exclude": [ 31 | "_site/**", 32 | "ref/**" 33 | ] 34 | } 35 | ], 36 | "resource": [ 37 | { 38 | "files": [ 39 | "images/**", 40 | "res/DocFXIcon.png", 41 | "README.md" 42 | ] 43 | } 44 | ], 45 | "output": "_site", 46 | "template": [ 47 | "default", 48 | "modern", 49 | "templates/default" 50 | ], 51 | "globalMetadata": { 52 | "_appName": "SteamClient 文档", 53 | "_appTitle": "SteamClient", 54 | "_appLogoPath": "res/DocFXIcon.png", 55 | "_appFooter": "©️ 江苏蒸汽凡星科技有限公司. All rights reserved.", 56 | "_enableSearch": false 57 | }, 58 | "keepFileLink": false, 59 | "disableGitFeatures": false 60 | } 61 | } -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | --- 2 | redirect_url: "doc/Protobuf.html" 3 | --- -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended", 5 | ":disableDependencyDashboard", 6 | ":disableRateLimiting", 7 | ":automergeAll", 8 | ":label(🤖 Automatic)" 9 | ], 10 | "packageRules": [ 11 | { 12 | "matchManagers": [ 13 | "nuget", 14 | "github-actions" 15 | ], 16 | "enabled": false 17 | } 18 | ], 19 | "schedule": ["at any time"], 20 | "git-submodules": { 21 | "enabled": true 22 | } 23 | } -------------------------------------------------------------------------------- /res/DocFXIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeyondDimension/SteamClient/0a3cbf6624e3191016f72e0e68ec1fa981445fa1/res/DocFXIcon.png -------------------------------------------------------------------------------- /src/BD.SteamClient8.Impl/BD.SteamClient8.Impl.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | true 6 | SteamClient8 服务实现库 7 | BD.SteamClient8 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Impl/Extensions/SteamSessionExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Extensions; 2 | 3 | /// 4 | /// 扩展方法 5 | /// 6 | public static partial class SteamSessionExtensions 7 | { 8 | /// 9 | /// 空引用抛出异常,提示用户登录 10 | /// 11 | /// 12 | /// 13 | /// 14 | /// 15 | public static SteamSession ThrowIsNull(this SteamSession? steamSession, string steam_id) 16 | { 17 | if (steamSession is null) 18 | throw new NullReferenceException($"Unable to find session for {steam_id}, please login first"); 19 | return steamSession; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Impl/README.md: -------------------------------------------------------------------------------- 1 | ### BD.SteamClient8.Impl 2 | SteamClient8 服务实现库 3 | 4 | #### Extensions 5 | | 描述 | XmlnsDefinition | 关键字 | 6 | | ----------- | ----------- | ----------- | 7 | | 扩展函数 | ```false``` | ```public static partial class``` | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Impl/WinAuth/GoogleAuthenticatorNetServiceImpl.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.WinAuth; 2 | 3 | /// 4 | /// Initializes a new instance of the class. 5 | /// 6 | /// 7 | /// 8 | sealed class GoogleAuthenticatorNetServiceImpl(IServiceProvider serviceProvider, ILoggerFactory loggerFactory) : WebApiClientFactoryService(loggerFactory.CreateLogger(TAG), serviceProvider), GoogleAuthenticator.IAuthenticatorNetService 9 | { 10 | const string TAG = "GoogleAuthenticatorNetService"; 11 | 12 | /// 13 | protected override string ClientName => TAG; 14 | 15 | /// 16 | /// 用于同步时间的 URL 17 | /// 18 | const string TIME_SYNC_URL = "http://www.google.com"; 19 | 20 | /// 21 | public async Task> TimeSync(CancellationToken cancellationToken = default) 22 | { 23 | using var requestMessage = new HttpRequestMessage(HttpMethod.Get, TIME_SYNC_URL); 24 | using var client = new HttpClient(); 25 | client.Timeout = new TimeSpan(0, 0, 5); 26 | using var rsp = await client.SendAsync(requestMessage, cancellationToken); 27 | var date = rsp.Headers.GetValues("Date").First(); 28 | return (rsp.StatusCode, date); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/BD.SteamClient8.Models.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | SteamClient8 模型库 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/Converters/SteamDataInt32Converter.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.Converters; 2 | 3 | /// 4 | /// Steam API 数据 => 5 | /// 6 | public sealed class SteamDataInt32Converter : System.Text.Json.Serialization.JsonConverter 7 | { 8 | /// 9 | public override int Read(ref Utf8JsonReader reader, Type typeToConvert, SystemTextJsonSerializerOptions options) 10 | { 11 | if (reader.TokenType == JsonTokenType.String && int.TryParse(reader.GetString(), out int value)) 12 | { 13 | return value; 14 | } 15 | else if (reader.TokenType == JsonTokenType.Number) 16 | { 17 | return reader.GetInt32(); 18 | } 19 | 20 | return 0; // 返回默认值或其他自定义逻辑 21 | } 22 | 23 | /// 24 | public override void Write(Utf8JsonWriter writer, int value, SystemTextJsonSerializerOptions options) 25 | { 26 | writer.WriteNumberValue(value); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/Converters/SteamDataInt64Converter.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.Converters; 2 | 3 | /// 4 | /// Steam API 数据 => 5 | /// 6 | public sealed class SteamDataInt64Converter : System.Text.Json.Serialization.JsonConverter 7 | { 8 | /// 9 | public override long Read(ref Utf8JsonReader reader, Type typeToConvert, SystemTextJsonSerializerOptions options) 10 | { 11 | // 处理本就是数字的情况 12 | if (reader.TokenType == JsonTokenType.Number) 13 | { 14 | // 暂不处理无法转换为 Int64 的情况 15 | return reader.TryGetInt64(out long parseInt64) ? parseInt64 : default; 16 | } 17 | 18 | if (reader.TokenType == JsonTokenType.String && long.TryParse(reader.GetString(), out long value)) 19 | { 20 | return value; 21 | } 22 | 23 | return 0; // 返回默认值或其他自定义逻辑 24 | } 25 | 26 | /// 27 | public override void Write(Utf8JsonWriter writer, long value, SystemTextJsonSerializerOptions options) 28 | { 29 | writer.WriteNumberValue(value); 30 | } 31 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/Converters/SteamDataStringConverter.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.Converters; 2 | 3 | /// 4 | /// Steam API 数据 数字类型 => 5 | /// 6 | public sealed class SteamDataStringConverter : System.Text.Json.Serialization.JsonConverter 7 | { 8 | /// 9 | public override string Read(ref Utf8JsonReader reader, Type typeToConvert, SystemTextJsonSerializerOptions options) 10 | { 11 | if (reader.TokenType == JsonTokenType.Number && typeToConvert == typeof(string) && reader.TryGetDecimal(out var value)) 12 | { 13 | return value.ToString(); 14 | } 15 | 16 | return string.Empty; // 返回默认值或其他自定义逻辑 17 | } 18 | 19 | /// 20 | public override void Write(Utf8JsonWriter writer, string value, SystemTextJsonSerializerOptions options) 21 | { 22 | writer.WriteStringValue(value); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/PInvoke/AchievementAndUnlockTimeResult.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.PInvoke; 2 | 3 | /// 4 | /// 获取指定成就的完成状态和解锁时间结果 5 | /// 6 | public sealed record class AchievementAndUnlockTimeResult 7 | { 8 | /// 9 | /// 返回是否完成该成就 10 | /// 11 | public bool IsAchieved { get; set; } 12 | 13 | /// 14 | /// 返回解锁该成就的时间 15 | /// 16 | public long UnlockTime { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/PInvoke/CloudArchiveQuotaResult.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.PInvoke; 2 | 3 | /// 4 | /// 获得可用的字节数返回结果 5 | /// 6 | public sealed record class CloudArchiveQuotaResult 7 | { 8 | /// 9 | /// 返回用户可访问的字节总量 10 | /// 11 | public ulong TotalBytes { get; set; } 12 | 13 | /// 14 | /// 返回可用的字节数 15 | /// 16 | public ulong AvailableBytes { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/PInvoke/UserStatsReceivedResult.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.PInvoke; 2 | 3 | /// 4 | /// 接收用户统计信息模型 5 | /// 6 | public sealed record class UserStatsReceivedResult 7 | { 8 | /// 9 | /// 游戏 Id 10 | /// 11 | public ulong GameId { get; set; } 12 | 13 | /// 14 | /// 结果 15 | /// 16 | public int Result { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/README.md: -------------------------------------------------------------------------------- 1 | ### BD.SteamClient8.Models 2 | SteamClient8 模型库 3 | 4 | - Authenticators ```身份验证令牌``` 5 | - Idles ```挂机``` 6 | - Logins ```登录``` 7 | - Markets ```Steam 市场相关``` 8 | - Profiles ```个人资料``` 9 | - SteamApps ```Steam 游戏``` 10 | - SteamGridDB ```Steam 相关第三方数据平台``` 11 | - Trades ```Steam 交易``` 12 | 13 | #### Converters 14 | | 描述 | XmlnsDefinition | 关键字 | 15 | | ----------- | ----------- | ----------- | 16 | | Json 转换器 | ```false``` | ```public sealed``` | 17 | 18 | #### Extensions 19 | | 描述 | XmlnsDefinition | 关键字 | 20 | | ----------- | ----------- | ----------- | 21 | | 扩展函数 | ```false``` | ```public static partial class``` | 22 | 23 | #### Protobuf 24 | | 描述 | XmlnsDefinition | 关键字 | 25 | | ----------- | ----------- | ----------- | 26 | | 根据 .proto 文件生成 | ```false``` | | 27 | 28 | #### WebApi 29 | | 描述 | XmlnsDefinition | 关键字 | 30 | | ----------- | ----------- | ----------- | 31 | | 用于 WebApi 的模型 | ```false``` | | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Authenticators/GenerateAccessTokenForAppResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Authenticators; 2 | 3 | /// 4 | /// 刷新 AccessToken 接口返回模型类 5 | /// 6 | public class GenerateAccessTokenForAppResponse 7 | { 8 | /// 9 | /// Response 10 | /// 11 | [SystemTextJsonProperty("response")] 12 | public GenerateAccessTokenForAppResponseResponse? Response; 13 | } 14 | 15 | /// 16 | /// 模型类 17 | /// 18 | public class GenerateAccessTokenForAppResponseResponse 19 | { 20 | /// 21 | /// JWT AccessToken 22 | /// 23 | [SystemTextJsonProperty("access_token")] 24 | public string? AccessToken { get; set; } 25 | } 26 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Authenticators/PhoneNumber/GetUserCountryResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Authenticators.PhoneNumber; 2 | 3 | /// 4 | /// 获取用户国家或地区接口返回模型类 5 | /// 6 | public sealed class GetUserCountryOrRegionResponse 7 | { 8 | /// 9 | /// Response 10 | /// 11 | [SystemTextJsonProperty("response")] 12 | public GetUserCountryOrRegionResponseResponse? Response { get; set; } 13 | 14 | /// 15 | public override string ToString() => Response?.ToString()!; 16 | 17 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 18 | public static implicit operator string?(GetUserCountryOrRegionResponse? r) 19 | => r?.ToString(); 20 | } 21 | 22 | /// 23 | /// 详细信息 24 | /// 25 | public sealed class GetUserCountryOrRegionResponseResponse 26 | { 27 | /// 28 | /// 国家或地区 29 | /// 30 | [SystemTextJsonProperty("country")] 31 | public string? CountryOrRegion { get; set; } 32 | 33 | /// 34 | public override string ToString() => CountryOrRegion!; 35 | 36 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 37 | public static implicit operator string?(GetUserCountryOrRegionResponseResponse? r) 38 | => r?.ToString(); 39 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Authenticators/PhoneNumber/IsAccountWaitingForEmailConfirmationResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Authenticators.PhoneNumber; 2 | 3 | /// 4 | /// AccountWaitingForEmailConfirmation 接口返回模型类 5 | /// 6 | public class IsAccountWaitingForEmailConfirmationResponse 7 | { 8 | /// 9 | /// Response 10 | /// 11 | [SystemTextJsonProperty("response")] 12 | public IsAccountWaitingForEmailConfirmationResponseResponse? Response { get; set; } 13 | } 14 | 15 | /// 16 | /// 模型类 17 | /// 18 | public class IsAccountWaitingForEmailConfirmationResponseResponse 19 | { 20 | /// 21 | /// 是否等待邮箱确认 22 | /// 23 | [SystemTextJsonProperty("awaiting_email_confirmation")] 24 | public bool AwaitingEmailConfirmation { get; set; } 25 | 26 | /// 27 | /// 等待秒数 28 | /// 29 | [SystemTextJsonProperty("seconds_to_wait")] 30 | public int SecondsToWait { get; set; } 31 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Authenticators/PhoneNumber/SteamAddPhoneNumberResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Authenticators.PhoneNumber; 2 | 3 | /// 4 | /// AddPhoneNumberAsync 接口返回模型类 5 | /// 6 | public class SteamAddPhoneNumberResponse 7 | { 8 | /// 9 | /// Response 10 | /// 11 | [SystemTextJsonProperty("response")] 12 | public SteamAddPhoneNumberResponseResponse? Response { get; set; } 13 | } 14 | 15 | /// 16 | /// 模型类 17 | /// 18 | public class SteamAddPhoneNumberResponseResponse 19 | { 20 | /// 21 | /// 确认邮箱的地址 22 | /// 23 | [SystemTextJsonProperty("confirmation_email_address")] 24 | public string? ConfirmationEmailAddress { get; set; } 25 | 26 | /// 27 | /// 格式化后的手机号码 28 | /// 29 | [SystemTextJsonProperty("phone_number_formatted")] 30 | public string? PhoneNumberFormatted { get; set; } 31 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Authenticators/RemoveAuthenticatorResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Authenticators; 2 | 3 | /// 4 | /// RemoveAuthenticatorAsync 接口返回模型类 5 | /// 6 | public class RemoveAuthenticatorResponse 7 | { 8 | /// 9 | /// Response 10 | /// 11 | [SystemTextJsonProperty("response")] 12 | public RemoveAuthenticatorResponseResponse? Response { get; set; } 13 | } 14 | 15 | /// 16 | /// 模型类 17 | /// 18 | public class RemoveAuthenticatorResponseResponse 19 | { 20 | /// 21 | /// 是否成功 22 | /// 23 | [SystemTextJsonProperty("success")] 24 | public bool Success { get; set; } 25 | 26 | /// 27 | /// 剩余尝试次数 28 | /// 29 | [SystemTextJsonProperty("revocation_attempts_remaining")] 30 | public int RevocationAttemptsRemaining { get; set; } 31 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Authenticators/SteamGetRsaKeyJsonStruct.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Authenticators; 2 | 3 | /// 4 | /// SteamGetRsaKey 接口返回类型 5 | /// 6 | public sealed class SteamGetRsaKeyJsonStruct 7 | { 8 | /// 9 | /// 是否成功 10 | /// 11 | [SystemTextJsonProperty("success")] 12 | public bool Success { get; set; } 13 | 14 | /// 15 | /// 公钥 Mod 16 | /// 17 | [SystemTextJsonProperty("publickey_mod")] 18 | public string PublicKeyMod { get; set; } = string.Empty; 19 | 20 | /// 21 | /// 公钥 Exp 22 | /// 23 | [SystemTextJsonProperty("publickey_exp")] 24 | public string PublicKeyExp { get; set; } = string.Empty; 25 | 26 | /// 27 | /// 时间戳 28 | /// 29 | [SystemTextJsonProperty("timestamp")] 30 | public string TimeStamp { get; set; } = string.Empty; 31 | 32 | /// 33 | /// Token Id 34 | /// 35 | [SystemTextJsonProperty("token_gid")] 36 | public string TokenGId { get; set; } = string.Empty; 37 | } 38 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Authenticators/SteamMobileDologinJsonStruct.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Authenticators; 2 | 3 | /// 4 | /// 登录接口返回 5 | /// 6 | public class SteamMobileDologinJsonStruct 7 | { 8 | /// 9 | /// 是否成功 10 | /// 11 | [SystemTextJsonProperty("success")] 12 | public bool Success { get; set; } 13 | 14 | /// 15 | /// 是否需要 2FA 验证码 16 | /// 17 | [SystemTextJsonProperty("requires_twofactor")] 18 | public bool RequiresTwofactor { get; set; } 19 | 20 | /// 21 | /// 登录是否完成 22 | /// 23 | [SystemTextJsonProperty("login_complete")] 24 | public bool LoginComplete { get; set; } 25 | 26 | /// 27 | /// 跳转的地址列表 28 | /// 29 | [SystemTextJsonProperty("transfer_urls")] 30 | public string[]? TransferUrls { get; set; } 31 | 32 | /// 33 | /// 跳转的参数 34 | /// 35 | [SystemTextJsonProperty("transfer_parameters")] 36 | public Transfer_Parameters? TransferParameters { get; set; } 37 | } 38 | 39 | /// 40 | /// 跳转参数详情 41 | /// 42 | public class Transfer_Parameters 43 | { 44 | /// 45 | /// SteamId 46 | /// 47 | [SystemTextJsonProperty("steamid")] 48 | public string? Steamid { get; set; } 49 | 50 | /// 51 | /// 安全令牌 52 | /// 53 | [SystemTextJsonProperty("token_secure")] 54 | public string? TokenSecure { get; set; } 55 | 56 | /// 57 | /// JWT token 58 | /// 59 | [SystemTextJsonProperty("auth")] 60 | public string? Auth { get; set; } 61 | 62 | /// 63 | /// 是否记住登录 64 | /// 65 | [SystemTextJsonProperty("remember_login")] 66 | public bool RememberLogin { get; set; } 67 | 68 | /// 69 | /// 携带的 Cookie 信息 70 | /// 71 | [SystemTextJsonProperty("webcookie")] 72 | public string? WebCookie { get; set; } 73 | } 74 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/CurrencyData.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// 货币信息 5 | /// 6 | public sealed record class CurrencyData 7 | { 8 | /// 9 | /// 展示 10 | /// 11 | public string? Display { get; set; } 12 | 13 | /// 14 | /// 货币 ISO Code 15 | /// 16 | public string? CurrencyCode { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/CursorData.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// 钱包游标数据 5 | /// 6 | public sealed record class CursorData 7 | { 8 | /// 9 | /// 钱包唯一标识符 10 | /// 11 | [JsonPropertyName("wallet_txnid")] 12 | public string? WalletTxnid { get; set; } 13 | 14 | /// 15 | /// 最新时间戳 16 | /// 17 | [JsonPropertyName("timestamp_newest")] 18 | public long TimestampNewest { get; set; } 19 | 20 | /// 21 | /// 钱包余额 22 | /// 23 | [JsonPropertyName("balance")] 24 | public string? Balance { get; set; } 25 | 26 | /// 27 | /// 货币单位 28 | /// 29 | [JsonPropertyName("currency")] 30 | public int Currency { get; set; } 31 | } 32 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/DisableAuthorizedDevice.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | [MPObj, MP2Obj(MP2SerializeLayout.Explicit)] 4 | public sealed partial record class DisableAuthorizedDevice 5 | { 6 | /// 7 | /// Steam ID3 格式 Id 8 | /// 9 | [MPKey(0), MP2Key(0)] 10 | public long SteamId3_Int { get; set; } 11 | 12 | /// 13 | /// 使用时间 14 | /// 15 | [MPKey(1), MP2Key(1)] 16 | public long Timeused { get; set; } 17 | 18 | /// 19 | /// 描述 20 | /// 21 | [MPKey(2), MP2Key(2)] 22 | public string? Description { get; set; } 23 | 24 | /// 25 | /// Token唯一标识符 26 | /// 27 | [MPKey(3), MP2Key(3)] 28 | public string? Tokenid { get; set; } 29 | } 30 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/FloatStatInfo.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// 浮点类型统计 5 | /// 6 | public sealed record class FloatStatInfo : StatInfo 7 | { 8 | /// 9 | /// 原始数值 10 | /// 11 | public float OriginalValue { get; set; } 12 | 13 | /// 14 | /// 浮点数值 15 | /// 16 | public float FloatValue { get; set; } 17 | 18 | /// 19 | /// 最小数值 20 | /// 21 | public float MinValue { get; set; } 22 | 23 | /// 24 | /// 最大数值 25 | /// 26 | public float MaxValue { get; set; } 27 | 28 | /// 29 | /// 最大修改量 30 | /// 31 | public float MaxChange { get; set; } 32 | 33 | /// 34 | /// 仅允许增量 35 | /// 36 | public bool IncrementOnly { get; set; } 37 | 38 | /// 39 | /// 默认值 40 | /// 41 | public float DefaultValue { get; set; } 42 | 43 | /// 44 | /// 当前数值 45 | /// 46 | public override object Value 47 | { 48 | get => FloatValue; 49 | set 50 | { 51 | var b = float.TryParse((string)value, out float f); 52 | if (b) 53 | { 54 | if ((Permission & 2) != 0 && FloatValue != f) 55 | { 56 | //this.FloatValue = this.FloatValue; 57 | } 58 | else 59 | { 60 | FloatValue = f; 61 | } 62 | } 63 | } 64 | } 65 | 66 | /// 67 | /// 是否已修改 68 | /// 69 | public override bool IsModified => !FloatValue.Equals(OriginalValue); 70 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Idles/AppCardsAvgPrice.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Idles; 2 | 3 | /// 4 | /// Steam 游戏卡片平均价格 5 | /// https://github.com/IsThereAnyDeal/AugmentedSteam_Server/blob/master/src/Controllers/MarketController.php 6 | /// 7 | public sealed record class AppCardsAvgPrice 8 | { 9 | /// 10 | /// 游戏 AppId 11 | /// 12 | public uint AppId { get; set; } 13 | 14 | /// 15 | /// 常规卡片平均价格 16 | /// 17 | public decimal Regular { get; set; } 18 | 19 | /// 20 | /// 闪亮卡片平均价格 21 | /// 22 | public decimal Foil { get; set; } 23 | } 24 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Idles/CardsMarketPrice.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Idles; 2 | 3 | /// 4 | /// Steam 游戏卡片市场价格 5 | /// https://github.com/IsThereAnyDeal/AugmentedSteam_Server/blob/master/src/Controllers/MarketController.php 6 | /// 7 | public sealed record class CardsMarketPrice 8 | { 9 | /// 10 | /// 卡片名称 11 | /// 12 | public string CardName { get; set; } = string.Empty; 13 | 14 | /// 15 | /// 是否闪亮卡牌 16 | /// 17 | public bool IsFoil { get; set; } 18 | 19 | /// 20 | /// 市场上架 Url 21 | /// 22 | public string MarketUrl { get; set; } = string.Empty; 23 | 24 | /// 25 | /// 价格 26 | /// 27 | public decimal Price { get; set; } 28 | } 29 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Idles/IdleBadge.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Idles; 2 | 3 | /// 4 | /// 徽章 5 | /// 6 | public sealed record class IdleBadge 7 | { 8 | /// 9 | /// 徽章名称 10 | /// 11 | public string BadgeName { get; set; } = string.Empty; 12 | 13 | /// 14 | /// 徽章图片 Url 15 | /// 16 | public string BadgeImageUrl { get; set; } = string.Empty; 17 | 18 | /// 19 | /// 游戏 AppId 20 | /// 21 | public uint AppId { get; set; } 22 | 23 | /// 24 | /// 游戏名称 25 | /// 26 | public string AppName { get; set; } = string.Empty; 27 | 28 | /// 29 | /// 徽章等级 30 | /// 31 | public byte BadgeLevel { get; set; } 32 | 33 | /// 34 | /// 徽章当前经验 35 | /// 36 | public short BadgeCurrentExp { get; set; } 37 | 38 | /// 39 | /// 游戏时长(小时) 40 | /// 41 | public double HoursPlayed { get; set; } 42 | 43 | /// 44 | /// 剩余可掉落卡片数量 45 | /// 46 | public int CardsRemaining { get; set; } 47 | 48 | /// 49 | /// 已收集的卡片数量 50 | /// 51 | public int CardsCollected { get; set; } 52 | 53 | /// 54 | /// 集齐卡组所需卡片数量 55 | /// 56 | public int CardsGathering { get; set; } 57 | 58 | /// 59 | /// 常规卡片平均价格 60 | /// 61 | public decimal RegularAvgPrice { get; set; } 62 | 63 | /// 64 | /// 闪亮卡片平均价格 65 | /// 66 | public decimal FoilAvgPrice { get; set; } 67 | 68 | /// 69 | /// 徽章卡组 70 | /// 71 | public List? Cards { get; set; } 72 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Idles/SteamCard.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Idles; 2 | 3 | /// 4 | /// 卡片 5 | /// 6 | public sealed record class SteamCard 7 | { 8 | /// 9 | /// 卡片名称 10 | /// 11 | public string Name { get; set; } = string.Empty; 12 | 13 | /// 14 | /// 卡片图片 Url 15 | /// 16 | public string ImageUrl { get; set; } = string.Empty; 17 | 18 | /// 19 | /// 价格 20 | /// 21 | public decimal Price { get; set; } 22 | 23 | /// 24 | /// 是否已收集 25 | /// 26 | public bool IsCollected { get; set; } 27 | } 28 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Idles/UserBadgesResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Idles; 2 | 3 | /// 4 | /// 获取用户徽章信息响应返回 5 | /// 6 | public sealed record class UserBadgesResponse 7 | { 8 | /// 9 | /// 用户 Idle 信息 10 | /// 11 | public UserIdleInfo? UserIdleInfo { get; set; } 12 | 13 | /// 14 | /// 用户徽章信息列表 15 | /// 16 | public List Badges { get; set; } = []; 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// 22 | /// 23 | public UserBadgesResponse(UserIdleInfo? userIdleInfo, List badges) 24 | { 25 | UserIdleInfo = userIdleInfo; 26 | Badges = badges; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Idles/UserIdleInfo.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Idles; 2 | 3 | /// 4 | /// 用户 Idle 信息 5 | /// 6 | public sealed record class UserIdleInfo 7 | { 8 | /// 9 | /// 用户昵称 10 | /// 11 | public string? UserName { get; set; } 12 | 13 | /// 14 | /// 用户头像 15 | /// 16 | public string? AvatarUrl { get; set; } 17 | 18 | /// 19 | /// 用户等级 20 | /// 21 | public ushort UserLevel { get; set; } 22 | 23 | /// 24 | /// 用户下一等级 25 | /// 26 | public ushort NextLevel => (ushort)(UserLevel + 1); 27 | 28 | /// 29 | /// 用户下一等级所需经验百分比 30 | /// 31 | public short NextLevelExpPercentage { get; set; } 32 | 33 | /// 34 | /// 用户当前经验 35 | /// 36 | public int CurrentExp { get; set; } 37 | 38 | /// 39 | /// 升级所需经验 40 | /// 41 | public int UpExp { get; set; } 42 | } 43 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/ImportedSDAEntry.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// 导入 SDA 实体 5 | /// 6 | public sealed record class ImportedSDAEntry 7 | { 8 | /// 9 | /// PBKDF2_ITERATIONS 10 | /// 11 | public const int PBKDF2_ITERATIONS = 50000; 12 | 13 | /// 14 | /// SALT_LENGTH 15 | /// 16 | public const int SALT_LENGTH = 8; 17 | 18 | /// 19 | /// KEY_SIZE_BYTES 20 | /// 21 | public const int KEY_SIZE_BYTES = 32; 22 | 23 | /// 24 | /// IV_LENGTH 25 | /// 26 | public const int IV_LENGTH = 16; 27 | 28 | /// 29 | /// 用户名 30 | /// 31 | public string? Username; 32 | 33 | /// 34 | /// SteamId 35 | /// 36 | public string? SteamId; 37 | 38 | /// 39 | /// json text 40 | /// 41 | #pragma warning disable SA1307 // Accessible fields should begin with upper-case letter 42 | public string? json; 43 | #pragma warning restore SA1307 // Accessible fields should begin with upper-case letter 44 | 45 | /// 46 | /// ToString() 47 | /// 48 | /// 49 | public override string ToString() 50 | { 51 | return Username + " (" + SteamId + ")"; 52 | } 53 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/IntStatInfo.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// 整数类型统计 5 | /// 6 | public sealed record class IntStatInfo : StatInfo 7 | { 8 | /// 9 | /// 原始数值 10 | /// 11 | public int OriginalValue { get; set; } 12 | 13 | /// 14 | /// 整型数值 15 | /// 16 | public int IntValue { get; set; } 17 | 18 | /// 19 | /// 最小数值 20 | /// 21 | public int MinValue { get; set; } 22 | 23 | /// 24 | /// 最大数值 25 | /// 26 | public int MaxValue { get; set; } 27 | 28 | /// 29 | /// 最大修改量 30 | /// 31 | public int MaxChange { get; set; } 32 | 33 | /// 34 | /// 仅允许增量 35 | /// 36 | public bool IncrementOnly { get; set; } 37 | 38 | /// 39 | /// 默认值 40 | /// 41 | public int DefaultValue { get; set; } 42 | 43 | /// 44 | /// 当前数值 45 | /// 46 | public override object Value 47 | { 48 | get => IntValue; 49 | set 50 | { 51 | var b = int.TryParse((string)value, out int i); 52 | if (b) 53 | { 54 | if ((Permission & 2) != 0 && IntValue != i) 55 | { 56 | //this.IntValue = this.IntValue; 57 | } 58 | else 59 | { 60 | IntValue = i; 61 | } 62 | } 63 | } 64 | } 65 | 66 | /// 67 | /// 是否已修改 68 | /// 69 | public override bool IsModified => IntValue != OriginalValue; 70 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Logins/DoLoginRespone.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Logins; 2 | 3 | /// 4 | /// 登录返回 5 | /// 6 | public sealed class DoLoginResponse : JsonModel 7 | { 8 | /// 9 | /// 是否成功 10 | /// 11 | [SystemTextJsonProperty("success")] 12 | public bool Success { get; set; } 13 | 14 | /// 15 | /// 是否需要 2FA 验证码 16 | /// 17 | [SystemTextJsonProperty("requires_twofactor")] 18 | public bool RequiresTwofactor { get; set; } 19 | 20 | /// 21 | /// 是否登录完成 22 | /// 23 | [SystemTextJsonProperty("login_complete")] 24 | public bool LoginComplete { get; set; } 25 | 26 | /// 27 | /// 跳转 Urls 28 | /// 29 | [SystemTextJsonProperty("transfer_urls")] 30 | public List? TransferUrls { get; set; } 31 | 32 | /// 33 | /// 跳转参数 34 | /// 35 | [SystemTextJsonProperty("transfer_parameters")] 36 | public TransferParameters? TransferParameters { get; set; } 37 | } 38 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Logins/FinalizeLoginStatus.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Logins; 2 | 3 | /// 4 | /// 完成登录状态 5 | /// 6 | public sealed class FinalizeLoginStatus : JsonModel 7 | { 8 | /// 9 | /// SteamId 10 | /// 11 | [SystemTextJsonProperty("steamID")] 12 | public string? SteamId { get; set; } 13 | 14 | /// 15 | /// 重定向地址 16 | /// 17 | [SystemTextJsonProperty("redir")] 18 | public string? Redir { get; set; } 19 | 20 | /// 21 | /// 会话信息 22 | /// 23 | [SystemTextJsonProperty("transfer_info")] 24 | public List? TransferInfo { get; set; } 25 | 26 | /// 27 | /// 主要域名 28 | /// 29 | [SystemTextJsonProperty("primary_domain")] 30 | public string? PrimaryDomain { get; set; } 31 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Logins/TransferInfo.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Logins; 2 | 3 | /// 4 | /// 跳转信息 5 | /// 6 | public sealed class TransferInfo : JsonModel 7 | { 8 | /// 9 | /// 跳转域名地址 10 | /// 11 | [SystemTextJsonProperty("url")] 12 | public string? Url { get; set; } 13 | 14 | /// 15 | /// 跳转参数 16 | /// 17 | [SystemTextJsonProperty("params")] 18 | public TransferInfoParams? Params { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Logins/TransferInfoParams.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Logins; 2 | 3 | /// 4 | /// 完成登录接口跳转参数 5 | /// 6 | public sealed class TransferInfoParams : JsonModel 7 | { 8 | /// 9 | /// 随机数 10 | /// 11 | [SystemTextJsonProperty("nonce")] 12 | public string? Nonce { get; set; } 13 | 14 | /// 15 | /// 认证密钥 16 | /// 17 | [SystemTextJsonProperty("auth")] 18 | public string? Auth { get; set; } 19 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Logins/TransferParameters.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Logins; 2 | 3 | /// 4 | /// 登录接口返回跳转参数 5 | /// 6 | public sealed class TransferParameters : JsonModel 7 | { 8 | /// 9 | /// SteamId 10 | /// 11 | [SystemTextJsonProperty("steamid")] 12 | public string? Steamid { get; set; } 13 | 14 | /// 15 | /// 加密令牌 16 | /// 17 | [SystemTextJsonProperty("token_secure")] 18 | public string? TokenSecure { get; set; } 19 | 20 | /// 21 | /// 认证 Token 22 | /// 23 | [SystemTextJsonProperty("auth")] 24 | public string? Auth { get; set; } 25 | 26 | /// 27 | /// 是否记住登录状态 28 | /// 29 | [SystemTextJsonProperty("remember_login")] 30 | public bool RememberLogin { get; set; } 31 | 32 | /// 33 | /// 登录 Cookie 信息 34 | /// 35 | [SystemTextJsonProperty("webcookie")] 36 | public string? Webcookie { get; set; } 37 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Markets/MarketItemPriceOverviewResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Markets; 2 | 3 | /// 4 | /// 市场物品价格概述 5 | /// 6 | public sealed record class MarketItemPriceOverviewResponse 7 | { 8 | /// 9 | /// 是否成功 10 | /// 11 | [SystemTextJsonProperty("success")] 12 | public bool Success { get; set; } 13 | 14 | /// 15 | /// 最低价格 16 | /// 17 | [SystemTextJsonProperty("lowest_price")] 18 | public string LowestPrice { get; set; } = string.Empty; 19 | 20 | /// 21 | /// 价格中位数 22 | /// 23 | [SystemTextJsonProperty("median_price")] 24 | public string MedianPrice { get; set; } = string.Empty; 25 | 26 | /// 27 | /// 成交量 28 | /// 29 | [SystemTextJsonProperty("volume")] 30 | public string Volume { get; set; } = string.Empty; 31 | 32 | // { 33 | // "success": true, 34 | // "lowest_price": "¥ 1.01", 35 | // "volume": "2,606", 36 | // "median_price": "¥ 1.02" 37 | // } 38 | } 39 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Markets/SellItemToMarketResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Markets; 2 | 3 | /// 4 | /// 市场出售物品返回 5 | /// 6 | public sealed record class SellItemToMarketResponse 7 | { 8 | /// 9 | /// 需要手机确认 10 | /// 11 | [SystemTextJsonProperty("needs_mobile_confirmation")] 12 | public bool NeedsMobileConfirmation { get; set; } 13 | 14 | /// 15 | /// 需要邮箱确认 16 | /// 17 | [SystemTextJsonProperty("needs_email_confirmation")] 18 | public bool NeedsEmailConfirmationConfirmed { get; set; } 19 | 20 | /// 21 | /// 邮件域名 22 | /// 23 | [SystemTextJsonProperty("email_domain")] 24 | public string EmailDomain { get; set; } = string.Empty; 25 | 26 | /// 27 | /// 需要确认 28 | /// 29 | [SystemTextJsonProperty("requires_confirmation")] 30 | public int RequiresConfirmation { get; set; } 31 | 32 | /// 33 | /// 是否成功 34 | /// 35 | [SystemTextJsonProperty("success")] 36 | public bool Success { get; set; } 37 | 38 | /// 39 | /// 信息 40 | /// 41 | [SystemTextJsonProperty("message")] 42 | public string? Message { get; set; } 43 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/PlayerSummariesResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | public sealed record PlayerSummariesResponse 4 | { 5 | [NewtonsoftJsonProperty("response")] 6 | [SystemTextJsonProperty("response")] 7 | public required PlayerSummariesDetail Response { get; set; } 8 | 9 | public sealed record PlayerSummariesDetail 10 | { 11 | [NewtonsoftJsonProperty("players")] 12 | [SystemTextJsonProperty("players")] 13 | public required List Players { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Profiles/HistoryParseResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Profiles; 2 | 3 | /// 4 | /// 账户历史数据返回值 5 | /// 6 | public sealed record class HistoryParseResponse 7 | { 8 | /// 未知 9 | public int Unknown; 10 | 11 | /// 商店购买 12 | public int StorePurchase; 13 | 14 | /// 商店购买[余额] 15 | public int StorePurchaseWallet; 16 | 17 | /// 礼物购买 18 | public int GiftPurchase; 19 | 20 | /// 礼物购买[余额] 21 | public int GiftPurchaseWallet; 22 | 23 | /// 市场购买 24 | public int MarketPurchase; 25 | 26 | /// 市场出售 27 | public int MarketSelling; 28 | 29 | /// 游戏内购 30 | public int InGamePurchase; 31 | 32 | /// 退款 33 | public int RefundPurchase; 34 | 35 | /// 退款[余额] 36 | public int RefundPurchaseWallet; 37 | 38 | /// 购买余额 39 | public int WalletPurchase; 40 | 41 | /// 其他 42 | public int Other; 43 | 44 | public static HistoryParseResponse operator +(HistoryParseResponse a, HistoryParseResponse b) 45 | { 46 | HistoryParseResponse result = new() 47 | { 48 | Unknown = a.Unknown + b.Unknown, 49 | StorePurchase = a.StorePurchase + b.StorePurchase, 50 | StorePurchaseWallet = a.StorePurchaseWallet + b.StorePurchaseWallet, 51 | GiftPurchase = a.GiftPurchase + b.GiftPurchase, 52 | GiftPurchaseWallet = a.GiftPurchaseWallet + b.GiftPurchaseWallet, 53 | MarketPurchase = a.MarketPurchase + b.MarketPurchase, 54 | MarketSelling = a.MarketSelling + b.MarketSelling, 55 | InGamePurchase = a.InGamePurchase + b.InGamePurchase, 56 | RefundPurchase = a.RefundPurchase + b.RefundPurchase, 57 | RefundPurchaseWallet = a.RefundPurchaseWallet + b.RefundPurchaseWallet, 58 | WalletPurchase = a.WalletPurchase + b.WalletPurchase, 59 | Other = a.Other + b.Other, 60 | }; 61 | return result; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Profiles/LoginHistoryItem.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Profiles; 2 | 3 | /// 4 | /// 登录历史 5 | /// 6 | public sealed record class LoginHistoryItem 7 | { 8 | /// 9 | /// 登录时间 10 | /// 11 | public string LogInDateTime { get; set; } = string.Empty; 12 | 13 | /// 14 | /// 登出时间 15 | /// 16 | public string? LogOutDateTime { get; set; } 17 | 18 | /// 19 | /// 系统类型 20 | /// 21 | public int OsType { get; set; } 22 | 23 | /// 24 | /// 登录国家或地区 25 | /// 26 | public string CountryOrRegion { get; set; } = string.Empty; 27 | 28 | /// 29 | /// 城市 30 | /// 31 | public string City { get; set; } = string.Empty; 32 | 33 | /// 34 | /// 州或省 35 | /// 36 | public string State { get; set; } = string.Empty; 37 | } 38 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Profiles/SendGiftHisotryItem.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Profiles; 2 | 3 | /// 4 | /// 礼物发送记录 5 | /// 6 | public sealed record class SendGiftHistoryItem 7 | { 8 | /// 9 | /// 游戏名称 10 | /// 11 | public string Name { get; set; } = string.Empty; 12 | 13 | /// 14 | /// 游戏图片地址 15 | /// 16 | public string ImgUrl { get; set; } = string.Empty; 17 | 18 | /// 19 | /// 签收状态文本 20 | /// 21 | public string RedeemedGiftStatusText { get; set; } = string.Empty; 22 | 23 | /// 24 | /// 礼物状态文本 25 | /// 26 | public string GiftStatusText { get; set; } = string.Empty; 27 | } 28 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/RedeemWalletCodeResult.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | public sealed record class RedeemWalletCodeResult 4 | { 5 | public SteamResult Result { get; set; } 6 | 7 | public PurchaseResultDetail? Detail { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/RedeemWalletResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// 兑换钱包返回信息 5 | /// 6 | public sealed class RedeemWalletResponse : JsonModel 7 | { 8 | /// 9 | /// 成功结果 10 | /// 11 | [SystemTextJsonProperty("success")] 12 | public SteamResult Result { get; private set; } 13 | 14 | /// 15 | /// 详情 16 | /// 17 | [SystemTextJsonProperty("detail")] 18 | public PurchaseResultDetail Detail { get; set; } 19 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/StatInfo.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// 统计抽象类 5 | /// 6 | public abstract record class StatInfo 7 | { 8 | /// 9 | /// 是否已修改 10 | /// 11 | public abstract bool IsModified { get; } 12 | 13 | /// 14 | /// 唯一标识符 15 | /// 16 | public string? Id { get; set; } 17 | 18 | /// 19 | /// 展示名称 20 | /// 21 | public string? DisplayName { get; set; } 22 | 23 | /// 24 | /// 数值 25 | /// 26 | public abstract object Value { get; set; } 27 | 28 | /// 29 | /// 仅允许增量 30 | /// 31 | public bool IsIncrementOnly { get; set; } 32 | 33 | /// 34 | /// 许可 35 | /// 36 | public int Permission { get; set; } 37 | 38 | /// 39 | /// 提取统计类型 Flags 40 | /// 41 | public string Extra 42 | { 43 | get 44 | { 45 | var flags = StatFlags.None; 46 | flags |= IsIncrementOnly == false ? 0 : StatFlags.IncrementOnly; 47 | flags |= (Permission & 2) != 0 == false ? 0 : StatFlags.Protected; 48 | flags |= (Permission & ~2) != 0 == false ? 0 : StatFlags.UnknownPermission; 49 | return flags.ToString(); 50 | } 51 | } 52 | } 53 | 54 | /// 55 | /// 统计类型 Flags 枚举 56 | /// 57 | [Flags] 58 | public enum StatFlags 59 | { 60 | [Description("默认")] 61 | None = 0, 62 | 63 | [Description("仅增加")] 64 | IncrementOnly = 1 << 0, 65 | 66 | [Description("受保护")] 67 | Protected = 1 << 1, 68 | 69 | [Description("未知权限")] 70 | UnknownPermission = 1 << 2, 71 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamApps/SteamAppInfo.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.SteamApps; 2 | 3 | /// 4 | /// Detail 5 | /// 6 | public sealed class SteamAppInfo 7 | { 8 | public string? ClientIcon { get; set; } 9 | 10 | public string? ClientTga { get; set; } 11 | 12 | /// 13 | /// 名称 14 | /// 15 | public string? Name { get; set; } 16 | 17 | /// 18 | /// 支持语言 19 | /// 20 | public Dictionary? Languages { get; set; } 21 | 22 | /// 23 | /// 图片 Logo 24 | /// 25 | public string? Logo { get; set; } 26 | 27 | /// 28 | /// 图片 Logo (小) 29 | /// 30 | public string? Logo_Small { get; set; } 31 | 32 | /// 33 | /// 图标 34 | /// 35 | public string? Icon { get; set; } 36 | 37 | /// 38 | /// 系统列表 39 | /// 40 | public string? OsList { get; set; } 41 | 42 | /// 43 | /// App 类型 44 | /// 45 | public string? Type { get; set; } 46 | 47 | /// 48 | /// 评测机构名称 49 | /// 50 | public string? Metacritic_Name { get; set; } 51 | 52 | /// 53 | /// 压缩图片列表 54 | /// 55 | public Dictionary? Small_Capsule { get; set; } 56 | 57 | /// 58 | /// 图片资源 59 | /// 60 | public Dictionary? Header_Image { get; set; } 61 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamApps/SteamAppLaunchItem.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.SteamApps; 2 | 3 | /// 4 | /// 已启动的游戏项 5 | /// 6 | public sealed class SteamAppLaunchItem 7 | { 8 | /// 9 | /// 描述 10 | /// 11 | public string? Label { get; set; } 12 | 13 | /// 14 | /// 可执行 15 | /// 16 | public string? Executable { get; set; } 17 | 18 | /// 19 | /// 参数 20 | /// 21 | public string? Arguments { get; set; } 22 | 23 | /// 24 | /// 工作目录 25 | /// 26 | public string? WorkingDir { get; set; } 27 | 28 | /// 29 | /// 系统平台 30 | /// 31 | public string? Platform { get; set; } 32 | } 33 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamApps/SteamAppList.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.SteamApps; 2 | 3 | /// 4 | /// Collection Model 5 | /// 6 | public sealed class SteamAppList : JsonModel 7 | { 8 | /// 9 | /// Collection 10 | /// 11 | [SystemTextJsonProperty("apps")] 12 | public List? Apps { get; set; } 13 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamApps/SteamAppSaveFile.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.SteamApps; 2 | 3 | public sealed class SteamAppSaveFile 4 | { 5 | #if !(IOS || ANDROID) 6 | 7 | /// 8 | /// 构造 9 | /// 10 | /// 11 | /// 12 | /// 13 | /// 14 | public SteamAppSaveFile(uint appid, string? root, string? path, string? pattern) 15 | { 16 | ParentAppId = appid; 17 | Root = root; 18 | Path = path; 19 | Pattern = pattern; 20 | } 21 | 22 | [SystemTextJsonConstructor] 23 | public SteamAppSaveFile() 24 | { 25 | } 26 | 27 | /// 28 | /// 父级 AppId 29 | /// 30 | public uint ParentAppId { get; set; } 31 | 32 | /// 33 | /// 根路径 34 | /// 35 | public string? Root { get; set; } 36 | 37 | /// 38 | /// 路径 39 | /// 40 | public string? Path { get; set; } 41 | 42 | public string? Pattern { get; set; } 43 | 44 | /// 45 | /// 拼接后的文件夹路径 46 | /// 47 | public string? FormatDirPath { get; set; } 48 | 49 | /// 50 | /// 拼接后的文件路径 51 | /// 52 | public string? FormatFilePath { get; set; } 53 | 54 | public bool Recursive { get; set; } 55 | 56 | /// 57 | /// 系统平台 58 | /// 59 | public string? Platforms { get; set; } 60 | #endif 61 | } 62 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamApps/SteamApps.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.SteamApps; 2 | 3 | /// 4 | /// Model 5 | /// 6 | public sealed class SteamApps : JsonModel 7 | { 8 | /// 9 | /// Instance 10 | /// 11 | [SystemTextJsonProperty("applist")] 12 | public SteamAppList? AppList { get; set; } 13 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamGridDB/SteamGridApp.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.SteamGridDB; 2 | 3 | /// 4 | /// steamgriddb.com App 5 | /// 6 | public sealed record class SteamGridApp 7 | { 8 | /// 9 | /// 唯一标识符 10 | /// 11 | [SystemTextJsonProperty("id")] 12 | public int Id { get; set; } 13 | 14 | /// 15 | /// 名称 16 | /// 17 | [SystemTextJsonProperty("name")] 18 | public string Name { get; set; } = ""; 19 | 20 | /// 21 | /// 类型列表 22 | /// 23 | [SystemTextJsonProperty("types")] 24 | public List Types { get; set; } = []; 25 | 26 | /// 27 | /// 是否验证 28 | /// 29 | [SystemTextJsonProperty("verified")] 30 | public bool Verified { get; set; } 31 | } 32 | 33 | /// 34 | /// steamgriddb.com AppData 35 | /// 36 | public sealed class SteamGridAppData : JsonModel 37 | { 38 | /// 39 | /// 是否成功 40 | /// 41 | [SystemTextJsonProperty("success")] 42 | public bool Success { get; set; } 43 | 44 | /// 45 | /// 数据内容 46 | /// 47 | [SystemTextJsonProperty("data")] 48 | public SteamGridApp Data { get; set; } = new(); 49 | 50 | /// 51 | /// 错误列表 52 | /// 53 | [SystemTextJsonProperty("errors")] 54 | public List Errors { get; set; } = []; 55 | } 56 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamMiniProfile.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// Steam 小型用户个人资料 5 | /// 6 | [MP2Obj] 7 | public sealed partial record class SteamMiniProfile 8 | { 9 | /// 10 | /// Steam 等级 11 | /// 12 | [NewtonsoftJsonProperty("level")] 13 | [SystemTextJsonProperty("level")] 14 | public int Level { get; set; } 15 | 16 | /// 17 | /// LevelClass 18 | /// 19 | [NewtonsoftJsonProperty("level_class")] 20 | [SystemTextJsonProperty("level_class")] 21 | public string? LevelClass { get; set; } 22 | 23 | /// 24 | /// 静态头像链接 25 | /// 26 | [NewtonsoftJsonProperty("avatar_url")] 27 | [SystemTextJsonProperty("avatar_url")] 28 | public string? AvatarUrl { get; set; } 29 | 30 | /// 31 | /// Steam 昵称 32 | /// 33 | [NewtonsoftJsonProperty("persona_name")] 34 | [SystemTextJsonProperty("persona_name")] 35 | public string? PersonaName { get; set; } 36 | 37 | /// 38 | /// 收藏的徽章 39 | /// 40 | [NewtonsoftJsonProperty("favorite_badge")] 41 | [SystemTextJsonProperty("favorite_badge")] 42 | public SteamMiniProfileBadge? FavoriteBadge { get; set; } 43 | 44 | /// 45 | /// 进行中的游戏 46 | /// 47 | [NewtonsoftJsonProperty("in_game")] 48 | [SystemTextJsonProperty("in_game")] 49 | public SteamMiniProfileGame? InGame { get; set; } 50 | 51 | /// 52 | /// 背景 53 | /// 54 | [NewtonsoftJsonProperty("profile_background")] 55 | [SystemTextJsonProperty("profile_background")] 56 | public SteamMiniProfileProfileBackground? Background { get; set; } 57 | 58 | /// 59 | /// 头像框 Url 60 | /// 61 | [NewtonsoftJsonProperty("avatar_frame")] 62 | [SystemTextJsonProperty("avatar_frame")] 63 | public string? AvatarFrame { get; set; } 64 | 65 | /// 66 | /// 动态头像 Url 67 | /// 68 | [NewtonsoftJsonProperty("animated_avatar")] 69 | [SystemTextJsonProperty("animated_avatar")] 70 | public string? AnimatedAvatar { get; set; } 71 | } 72 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamMiniProfileBadge.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// Steam 小型用户个人资料徽章 5 | /// 6 | [MP2Obj] 7 | public sealed partial record class SteamMiniProfileBadge 8 | { 9 | /// 10 | /// 徽章名称 11 | /// 12 | [NewtonsoftJsonProperty("name")] 13 | [SystemTextJsonProperty("name")] 14 | public string? Name { get; set; } 15 | 16 | /// 17 | /// 经验值 18 | /// 19 | [NewtonsoftJsonProperty("xp")] 20 | [SystemTextJsonProperty("xp")] 21 | public string? Xp { get; set; } 22 | 23 | /// 24 | /// 等级 25 | /// 26 | [NewtonsoftJsonProperty("level")] 27 | [SystemTextJsonProperty("level")] 28 | public int Level { get; set; } 29 | 30 | /// 31 | /// 说明 32 | /// 33 | [NewtonsoftJsonProperty("description")] 34 | [SystemTextJsonProperty("description")] 35 | public string? Description { get; set; } 36 | 37 | /// 38 | /// 徽章图标 39 | /// 40 | [NewtonsoftJsonProperty("icon")] 41 | [SystemTextJsonProperty("icon")] 42 | public string? Icon { get; set; } 43 | } 44 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamMiniProfileGame.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// Steam 小型用户个人资料游戏 5 | /// 6 | [MP2Obj] 7 | public sealed partial record class SteamMiniProfileGame 8 | { 9 | /// 10 | /// 游戏名称 11 | /// 12 | [NewtonsoftJsonProperty("name")] 13 | [SystemTextJsonProperty("name")] 14 | public string? Name { get; set; } 15 | 16 | /// 17 | /// 非 Steam 游戏 18 | /// 19 | [NewtonsoftJsonProperty("is_non_steam")] 20 | [SystemTextJsonProperty("is_non_steam")] 21 | public bool IsNonSteam { get; set; } 22 | 23 | /// 24 | /// 游戏LOGO 25 | /// 26 | [NewtonsoftJsonProperty("logo")] 27 | [SystemTextJsonProperty("logo")] 28 | public string? Logo { get; set; } 29 | } 30 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamMiniProfileProfileBackground.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// Steam 小型用户个人资料视频 5 | /// 6 | [MP2Obj] 7 | public sealed partial record class SteamMiniProfileProfileBackground 8 | { 9 | /// 10 | /// Webm 格式 11 | /// 12 | [NewtonsoftJsonProperty("video/webm")] 13 | [SystemTextJsonProperty("video/webm")] 14 | public string? VideoWebm { get; set; } 15 | 16 | /// 17 | /// Mp4 格式 18 | /// 19 | [NewtonsoftJsonProperty("video/mp4")] 20 | [SystemTextJsonProperty("video/mp4")] 21 | public string? VideoMp4 { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/SteamRemoteFile.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi; 2 | 3 | /// 4 | /// Steam 同步文件 5 | /// 6 | [MP2Obj(MP2SerializeLayout.Sequential)] 7 | public sealed partial record class SteamRemoteFile 8 | { 9 | /// 10 | /// 名称 11 | /// 12 | public string Name { get; private set; } = ""; 13 | 14 | /// 15 | /// 是否已存在 16 | /// 17 | public bool Exists { get; } 18 | 19 | /// 20 | /// 是否持久化 21 | /// 22 | public bool IsPersisted { get; } 23 | 24 | /// 25 | /// 文件大小 26 | /// 27 | public long Size { get; } 28 | 29 | /// 30 | /// 文件时间戳 31 | /// 32 | public DateTimeOffset Timestamp { get; } 33 | 34 | #if !(IOS || ANDROID) 35 | 36 | /// 37 | /// 系统平台 38 | /// 39 | public SteamKit2ERemoteStoragePlatform SyncPlatforms { get; set; } 40 | 41 | #endif 42 | 43 | /// 44 | /// Initializes a new instance of the class. 45 | /// 46 | [MPConstructor, MP2Constructor, SystemTextJsonConstructor] 47 | public SteamRemoteFile() 48 | { 49 | } 50 | 51 | /// 52 | /// 通过名称构造 实例 53 | /// 54 | /// 55 | public SteamRemoteFile(string name) 56 | { 57 | Name = name; 58 | } 59 | 60 | /// 61 | /// 通过名称,文件大小,是否存在,是否持久化,文件时间戳来构造 实例 62 | /// 63 | /// 64 | /// 65 | /// 66 | /// 67 | /// 68 | public SteamRemoteFile(string name, long length, bool exists, bool isPersisted, long timestamp) 69 | { 70 | Name = name; 71 | Size = length; 72 | Exists = exists; 73 | IsPersisted = isPersisted; 74 | Timestamp = timestamp.ToDateTimeOffsetS(); 75 | } 76 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Trades/TradeAsset.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Trades; 2 | 3 | /// 4 | /// 库存资产 5 | /// 6 | public sealed record class TradeAsset 7 | { 8 | /// 9 | /// 游戏 AppId 10 | /// 11 | [JsonPropertyName("appid")] 12 | public int AppId { get; set; } 13 | 14 | /// 15 | /// 上下文 Id 16 | /// 17 | [JsonPropertyName("contextid")] 18 | public string ContextId { get; set; } = string.Empty; 19 | 20 | /// 21 | /// 数量 22 | /// 23 | [JsonPropertyName("amount")] 24 | public int Amount { get; set; } 25 | 26 | /// 27 | /// 资产 Id 28 | /// 29 | [JsonPropertyName("assetid")] 30 | public string AssetId { get; set; } = string.Empty; 31 | } 32 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Trades/TradeConfirmation.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Trades; 2 | 3 | /// 4 | /// 确认消息 5 | /// 6 | public sealed record class TradeConfirmation 7 | { 8 | /// 9 | /// 确认类型 10 | /// 11 | [JsonPropertyName("type")] 12 | public int Type { get; set; } 13 | 14 | /// 15 | /// 类型名称 16 | /// 17 | [JsonPropertyName("type_name")] 18 | public string TypeName { get; set; } = string.Empty; 19 | 20 | /// 21 | /// 确定消息 Id 22 | /// 23 | [JsonPropertyName("id")] 24 | public string Id { get; set; } = string.Empty; 25 | 26 | /// 27 | /// 创建 Id 28 | /// 29 | [JsonPropertyName("creator_id")] 30 | public string CreatorId { get; set; } = string.Empty; 31 | 32 | /// 33 | /// 随机数 34 | /// 35 | [JsonPropertyName("nonce")] 36 | public string Nonce { get; set; } = string.Empty; 37 | 38 | /// 39 | /// 创建时间 40 | /// 41 | [JsonPropertyName("creation_time")] 42 | public long CreationTime { get; set; } 43 | 44 | /// 45 | /// 取消 46 | /// 47 | [JsonPropertyName("cancel")] 48 | public string Cancel { get; set; } = string.Empty; 49 | 50 | /// 51 | /// 允许 52 | /// 53 | [JsonPropertyName("accept")] 54 | public string Accept { get; set; } = string.Empty; 55 | 56 | /// 57 | /// 图标 58 | /// 59 | [JsonPropertyName("icon")] 60 | public string Icon { get; set; } = string.Empty; 61 | 62 | /// 63 | /// 是否多个 64 | /// 65 | [JsonPropertyName("multi")] 66 | public bool Multi { get; set; } 67 | 68 | /// 69 | /// 令牌的标题或摘要 70 | /// 71 | [JsonPropertyName("headline")] 72 | public string Headline { get; set; } = string.Empty; 73 | 74 | /// 75 | /// 汇总 76 | /// 77 | [JsonPropertyName("summary")] 78 | public string[]? Summary { get; set; } 79 | 80 | /// 81 | /// 警告信息 82 | /// 83 | [JsonPropertyName("warn")] 84 | public string[]? Warn { get; set; } 85 | } 86 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WebApi/Trades/TradeOffersItem.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WebApi.Trades; 2 | 3 | /// 4 | /// 交易报价物品信息 5 | /// 6 | public sealed record class TradeOffersItem 7 | { 8 | /// 9 | /// 游戏 AppId 10 | /// 11 | [SystemTextJsonProperty("appid")] 12 | public int AppId { get; set; } 13 | 14 | /// 15 | /// 资产上下文 Id 16 | /// 17 | [SystemTextJsonProperty("contextid")] 18 | public string ContextId { get; set; } = string.Empty; 19 | 20 | /// 21 | /// 资产 Id 22 | /// 23 | [SystemTextJsonProperty("assetid")] 24 | public string AssetId { get; set; } = string.Empty; 25 | 26 | /// 27 | /// 资产类别 Id 28 | /// 29 | [SystemTextJsonProperty("classid")] 30 | public string ClassId { get; set; } = string.Empty; 31 | 32 | /// 33 | /// 资产实例 Id 34 | /// 35 | [SystemTextJsonProperty("instanceid")] 36 | public string InstanceId { get; set; } = string.Empty; 37 | 38 | /// 39 | /// 数量 40 | /// 41 | [SystemTextJsonProperty("amount")] 42 | public string Amount { get; set; } = string.Empty; 43 | 44 | /// 45 | /// 市场中找不到该物品 46 | /// 47 | [SystemTextJsonProperty("missing")] 48 | public bool Missing { get; set; } 49 | 50 | /// 51 | /// 预估的美元 52 | /// 53 | [SystemTextJsonProperty("est_usd")] 54 | public string EstUsd { get; set; } = string.Empty; 55 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WinAuth/Abstractions/IAuthenticatorModel.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WinAuth.Abstractions; 2 | 3 | /// 4 | /// 身份验证器(游戏平台令牌)模型 5 | /// 6 | public interface IAuthenticatorModel : IOrderAuthenticator, IExplicitHasValue 7 | { 8 | /// 9 | /// 名称最大长度 10 | /// 11 | const int MaxLength_Name = 32; 12 | 13 | /// 14 | /// 名称 15 | /// 16 | string Name { get; set; } 17 | 18 | /// 19 | /// 令牌平添 20 | /// 21 | AuthenticatorPlatform Platform { get; } 22 | 23 | /// 24 | /// 服务器唯一标识 25 | /// 26 | Guid? ServerId { get; set; } 27 | 28 | /// 29 | /// 创建时间 30 | /// 31 | public DateTimeOffset Created { get; set; } 32 | 33 | /// 34 | /// 最后更新时间 35 | /// 36 | public DateTimeOffset LastUpdate { get; set; } 37 | 38 | /// 39 | IAuthenticatorValueModel Value { get; set; } 40 | } 41 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WinAuth/AuthenticatorExportModel.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WinAuth; 2 | 3 | /// 4 | /// 身份验证器(游戏平台令牌)数据轻量化导出模型 5 | /// 6 | [MPObj, MP2Obj(MP2SerializeLayout.Explicit)] 7 | public sealed partial class AuthenticatorExportModel 8 | { 9 | /// 10 | /// 平台 11 | /// 12 | [MPKey(0), MP2Key(0)] 13 | public AuthenticatorPlatform Platform { get; set; } 14 | 15 | /// 16 | /// 颁发者 17 | /// 18 | [MPKey(1), MP2Key(1)] 19 | public string? Issuer { get; set; } 20 | 21 | /// 22 | /// HMAC 加密类型 23 | /// 24 | [MPKey(2), MP2Key(2)] 25 | public HMACTypes HMACType { get; set; } 26 | 27 | /// 28 | /// BattleNet(战网) 序列号 29 | /// 30 | [MPKey(3), MP2Key(3)] 31 | public string? Serial { get; set; } 32 | 33 | /// 34 | /// Steam 设备唯一标识 35 | /// 36 | [MPKey(4), MP2Key(4)] 37 | public string? DeviceId { get; set; } 38 | 39 | /// 40 | /// Steam 相关数据 41 | /// 42 | [MPKey(5), MP2Key(5)] 43 | public string? SteamData { get; set; } 44 | 45 | /// 46 | /// HOTP 计数器 47 | /// 48 | [MPKey(6), MP2Key(6)] 49 | public long Counter { get; set; } 50 | 51 | /// 52 | /// 下一个代码的周期(秒) 53 | /// 54 | [MPKey(7), MP2Key(7)] 55 | public int Period { get; set; } 56 | 57 | /// 58 | /// 密钥信息 59 | /// 60 | [MPKey(8), MP2Key(8)] 61 | public byte[]? SecretKey { get; set; } 62 | 63 | /// 64 | /// 代码中返回的位数(默认为 6) 65 | /// 66 | [MPKey(9), MP2Key(9)] 67 | public int CodeDigits { get; set; } 68 | 69 | /// 70 | /// 名称 71 | /// 72 | [MPKey(10), MP2Key(10)] 73 | public string Name { get; set; } = string.Empty; 74 | 75 | /// 76 | public override string ToString() => this.ToUrl(); 77 | } 78 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WinAuth/AuthenticatorModel.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WinAuth; 2 | 3 | /// 4 | [MessagePackObject(keyAsPropertyName: true)] 5 | [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] 6 | public sealed partial class AuthenticatorModel : IAuthenticatorModel 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | public AuthenticatorModel() 12 | { 13 | Value = new AuthenticatorValueModel(); 14 | } 15 | 16 | /// 17 | /// 唯一标识符 18 | /// 19 | [MPIgnore, NewtonsoftJsonIgnore, SystemTextJsonIgnore] 20 | public ushort Id { get; set; } 21 | 22 | /// 23 | /// 索引 24 | /// 25 | public int Index { get; set; } 26 | 27 | /// 28 | /// 验证器名称 29 | /// 30 | public string Name { get; set; } = string.Empty; 31 | 32 | /// 33 | /// 身份验证器平台 34 | /// 35 | [MPIgnore, NewtonsoftJsonIgnore, SystemTextJsonIgnore] 36 | public AuthenticatorPlatform Platform => Value == null ? default : Value.Platform; 37 | 38 | /// 39 | /// 服务器唯一标识 40 | /// 41 | public Guid? ServerId { get; set; } 42 | 43 | /// 44 | /// 创建时间 45 | /// 46 | public DateTimeOffset Created { get; set; } 47 | 48 | /// 49 | /// 最后更新时间 50 | /// 51 | public DateTimeOffset LastUpdate { get; set; } 52 | 53 | /// 54 | /// 身份验证器 ValueDto 55 | /// 56 | public IAuthenticatorValueModel Value { get; set; } 57 | 58 | /// 59 | /// 该验证器是否含有内容 60 | /// 61 | /// 62 | bool IExplicitHasValue.ExplicitHasValue() 63 | { 64 | return !string.IsNullOrEmpty(Name) && Value != null; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WinAuth/BattleNetAuthenticator.IAuthenticatorNetService.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WinAuth; 2 | 3 | partial class BattleNetAuthenticator 4 | { 5 | /// 6 | /// 战网令牌相关网络服务 7 | /// 8 | public interface IAuthenticatorNetService 9 | { 10 | static IAuthenticatorNetService Instance => Ioc.Get(); 11 | 12 | /// 13 | /// 地理位置 IP 14 | /// 15 | /// 16 | /// 17 | Task> GEOIP(CancellationToken cancellationToken = default); 18 | 19 | /// 20 | /// 令牌添加 21 | /// 22 | /// 23 | /// 24 | /// 25 | /// 26 | Task> EnRoll(string region, byte[] encrypted, CancellationToken cancellationToken = default); 27 | 28 | /// 29 | /// 令牌同步 30 | /// 31 | /// 32 | /// 33 | /// 34 | Task> Sync(string region, CancellationToken cancellationToken = default); 35 | 36 | /// 37 | /// 令牌恢复 38 | /// 39 | /// 40 | /// 41 | /// 42 | /// 43 | Task> ReStore(string serial, byte[] serialBytes, CancellationToken cancellationToken = default); 44 | 45 | /// 46 | /// 令牌恢复验证 47 | /// 48 | /// 49 | /// 50 | /// 51 | /// 52 | Task> ReStoreValidate(string serial, byte[] postbytes, CancellationToken cancellationToken = default); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WinAuth/GoogleAuthenticator.IAuthenticatorNetService.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WinAuth; 2 | 3 | partial class GoogleAuthenticator 4 | { 5 | /// 6 | /// 谷歌令牌相关网络服务 7 | /// 8 | public interface IAuthenticatorNetService 9 | { 10 | static IAuthenticatorNetService Instance => Ioc.Get(); 11 | 12 | /// 13 | /// 同步时间 14 | /// 15 | /// 16 | /// 17 | Task> TimeSync(CancellationToken cancellationToken = default); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WinAuth/MicrosoftAuthenticator.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WinAuth; 2 | 3 | /// 4 | /// 微软身份验证令牌 5 | /// 6 | [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] 7 | [MessagePackObject(keyAsPropertyName: true)] 8 | public sealed class MicrosoftAuthenticator : GoogleAuthenticator 9 | { 10 | /// 11 | /// 初始化 类的新实例 12 | /// 13 | [SerializationConstructor] 14 | public MicrosoftAuthenticator() : base() 15 | { 16 | } 17 | 18 | /// 19 | [IgnoreDataMember] 20 | [MPIgnore] 21 | [NewtonsoftJsonIgnore] 22 | [SystemTextJsonIgnore] 23 | public override AuthenticatorPlatform Platform => AuthenticatorPlatform.Microsoft; 24 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WinAuth/SteamAuthenticator.IAuthenticatorNetService.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WinAuth; 2 | 3 | partial class SteamAuthenticator 4 | { 5 | /// 6 | /// Steam 令牌相关网络服务 7 | /// 8 | public interface IAuthenticatorNetService 9 | { 10 | static IAuthenticatorNetService Instance => Ioc.Get(); 11 | 12 | /// 13 | /// 服务器时间 14 | /// 15 | /// 16 | /// 17 | Task> TwoFAQueryTime(CancellationToken cancellationToken = default); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Models/WinAuth/TOTPAuthenticator.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Models.WinAuth; 2 | 3 | /// 4 | /// TOTP 身份验证 5 | /// 6 | [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] 7 | [MessagePackObject(keyAsPropertyName: true)] 8 | public class TOTPAuthenticator : GoogleAuthenticator 9 | { 10 | /// 11 | /// 初始化 类的新实例 12 | /// 13 | [SerializationConstructor] 14 | public TOTPAuthenticator() : base() 15 | { 16 | } 17 | 18 | /// 19 | [IgnoreDataMember] 20 | [MPIgnore] 21 | [SystemTextJsonIgnore] 22 | public override AuthenticatorPlatform Platform => AuthenticatorPlatform.TOTP; 23 | 24 | /// 25 | public override void Sync() 26 | { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/BD.SteamClient8.Primitives.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | BD.SteamClient8 6 | SteamClient8 基本库 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Columns/Authenticators/IOrderAuthenticator.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Columns.Authenticators; 2 | 3 | /// 4 | /// 可排序的身份验证器 5 | /// 6 | public interface IOrderAuthenticator 7 | { 8 | /// 9 | /// 唯一标识符 10 | /// 11 | ushort Id { get; set; } 12 | 13 | /// 14 | /// 索引 15 | /// 16 | int Index { get; set; } 17 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/Authenticators/AuthenticatorPlatform.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.Authenticators; 2 | 3 | /// 4 | /// 令牌平台类型 5 | /// 6 | public enum AuthenticatorPlatform : byte 7 | { 8 | Steam = 1, 9 | 10 | Microsoft = 5, 11 | 12 | BattleNet = 11, 13 | 14 | Google = 12, 15 | 16 | HOTP = 13, 17 | 18 | TOTP = 14, 19 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/Authenticators/HMACTypes.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.Authenticators; 2 | 3 | /// 4 | /// HMAC 哈希算法类型 5 | /// 6 | public enum HMACTypes 7 | { 8 | /// 9 | SHA1 = 0, 10 | 11 | /// 12 | SHA256 = 1, 13 | 14 | /// 15 | SHA512 = 2, 16 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/WebApi/Markets/MarketTradingHisotryRowType.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.WebApi.Markets; 2 | 3 | /// 4 | /// 交易历史操作类型 5 | /// 6 | public enum MarketTradingHistoryRowType 7 | { 8 | /// 9 | /// 普通行 10 | /// 11 | Normal, 12 | 13 | /// 14 | /// 上架 15 | /// 16 | Publish, 17 | 18 | /// 19 | /// 下架 20 | /// 21 | UnPublish, 22 | } 23 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/WebApi/PersonaState.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.WebApi; 2 | 3 | /// 4 | /// 在线状态 5 | /// 6 | public enum PersonaState 7 | { 8 | Default = -1, 9 | 10 | /// 11 | /// 离线 12 | /// 13 | Offline = 0, 14 | 15 | /// 16 | /// 在线 17 | /// 18 | Online = 1, 19 | 20 | /// 21 | /// 忙碌的 22 | /// 23 | Busy = 2, 24 | 25 | /// 26 | /// 离开 27 | /// 28 | Away = 3, 29 | 30 | /// 31 | /// 打盹 32 | /// 33 | Snooze = 4, 34 | 35 | /// 36 | /// 想交易 37 | /// 38 | LookingToTrade = 5, 39 | 40 | /// 41 | /// 想玩游戏 42 | /// 43 | LookingToPlay = 6, 44 | 45 | /// 46 | /// 隐身 47 | /// 48 | Invisible = 7, 49 | } 50 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/WebApi/SteamApps/LibCacheType.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.WebApi.SteamApps; 2 | 3 | /// 4 | /// Library 图片缓存类型 5 | /// 6 | public enum LibCacheType : byte 7 | { 8 | /// 9 | /// 10 | /// 11 | Header, 12 | 13 | /// 14 | /// 15 | /// 16 | Icon, 17 | 18 | /// 19 | /// 20 | /// 21 | Library_Grid, 22 | 23 | /// 24 | /// 25 | /// 26 | Library_Hero, 27 | 28 | /// 29 | /// 30 | /// 31 | Library_Hero_Blur, 32 | 33 | /// 34 | /// 35 | /// 36 | Logo, 37 | } 38 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/WebApi/SteamApps/SteamAppPropertyType.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.WebApi.SteamApps; 2 | 3 | public enum SteamAppPropertyType 4 | { 5 | _Invalid_ = -1, 6 | Table = 0, 7 | String = 1, 8 | Int32 = 2, 9 | Float = 3, 10 | WString = 5, 11 | Color = 6, 12 | Uint64 = 7, 13 | _EndOfTable_ = 8, 14 | } 15 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/WebApi/SteamApps/SteamAppRunType.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.WebApi.SteamApps; 2 | 3 | public enum SteamAppRunType 4 | { 5 | Idle, 6 | UnlockAchievement, 7 | CloudManager, 8 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/WebApi/SteamGridDB/SteamGridItemType.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.WebApi.SteamGridDB; 2 | 3 | /// 4 | /// steamgriddb.com 托管图像类型 5 | /// 6 | public enum SteamGridItemType 7 | { 8 | /// 9 | /// 网格 10 | /// 11 | Grid, 12 | 13 | /// 14 | /// 英雄 15 | /// 16 | Hero, 17 | 18 | /// 19 | /// 徽标 20 | /// 21 | Logo, 22 | 23 | /// 24 | /// 图标 25 | /// 26 | Icon, 27 | 28 | /// 29 | /// 标题头 30 | /// 31 | Header, 32 | } 33 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/WebApi/Trades/TradeOfferState.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.WebApi.Trades; 2 | 3 | /// 4 | /// 交易报价状态 5 | /// 6 | public enum TradeOfferState 7 | { 8 | /// 9 | /// 已失效 10 | /// 11 | Invalid = 1, 12 | 13 | /// 14 | /// 有效的 15 | /// 16 | Active = 2, 17 | 18 | /// 19 | /// 已接受 20 | /// 21 | Accepted = 3, 22 | 23 | /// 24 | /// 交易遭到调整 25 | /// 26 | Countered = 4, 27 | 28 | /// 29 | /// 已过期 30 | /// 31 | Expired = 5, 32 | 33 | /// 34 | /// 已取消 35 | /// 36 | Canceled = 6, 37 | 38 | /// 39 | /// 拒绝 40 | /// 41 | Declined = 7, 42 | 43 | /// 44 | /// 报价物品已失效 45 | /// 46 | InvalidItems = 8, 47 | 48 | /// 49 | /// 待确认 50 | /// 51 | ConfirmationNeed = 9, 52 | 53 | /// 54 | /// 按次要因素取消 55 | /// 56 | CanceledBySecondaryFactor = 10, 57 | 58 | /// 59 | /// 托管状态 60 | /// 61 | StateInEscrow = 11 62 | } 63 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/WebApi/Trades/TradeTag.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.WebApi.Trades; 2 | 3 | /// 4 | /// 交易报价确认信息操作类型 5 | /// 6 | public enum TradeTag : byte 7 | { 8 | [Description("conf")] 9 | CONF = 1, 10 | 11 | [Description("details")] 12 | DETAILS = 2, 13 | 14 | /// 15 | /// 允许 16 | /// 17 | [Description("allow")] 18 | ALLOW = 3, 19 | 20 | /// 21 | /// 取消 22 | /// 23 | [Description("cancel")] 24 | CANCEL = 4 25 | } 26 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Enums/WebApi/Trades/TradeTaskEnum.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Enums.WebApi.Trades; 2 | 3 | /// 4 | /// 交易报价后台任务类型枚举 5 | /// 6 | public enum TradeTaskEnum : byte 7 | { 8 | None = 0, 9 | 10 | /// 11 | /// 自动接收礼品报价 12 | /// 13 | AutoAcceptGitTrade = 1, 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Extensions/CurrencyCodeEnumExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Extensions; 2 | 3 | public static partial class ECurrencyCodeEnumExtensions 4 | { 5 | /// 6 | /// 根据货币获取文化信息 7 | /// 8 | /// 9 | /// 10 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 11 | public static CultureInfo? GetCultureInfo(this ECurrencyCode eCurrencyCode) 12 | { 13 | if (eCurrencyCode == ECurrencyCode.Invalid) return null; 14 | return CultureInfo.GetCultures(CultureTypes.SpecificCultures) 15 | .FirstOrDefault(culture => new RegionInfo(culture.LCID).ISOCurrencySymbol == eCurrencyCode.ToString()); 16 | } 17 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/README.md: -------------------------------------------------------------------------------- 1 | ### BD.SteamClient8.Primitives 2 | SteamClient8 基本库 3 | 4 | - Markets ```Steam 市场相关``` 5 | - SteamApps ```Steam 游戏``` 6 | - SteamGridDB ```Steam 相关第三方数据平台``` 7 | - Trades ```Steam 交易``` 8 | 9 | #### Columns 10 | | 描述 | XmlnsDefinition | 关键字 | 11 | | ----------- | ----------- | ----------- | 12 | | 列接口 | ```false``` | ```public interface``` | 13 | 14 | #### Constants 15 | | 描述 | XmlnsDefinition | 关键字 | 16 | | ----------- | ----------- | ----------- | 17 | | 常量 | ```false``` | ```public static class``` or ```internal``` | 18 | 19 | #### Enums 20 | | 描述 | XmlnsDefinition | 关键字 | 21 | | ----------- | ----------- | ----------- | 22 | | 枚举 | ```true``` | ```public enum``` | 23 | 24 | #### Extensions 25 | | 描述 | XmlnsDefinition | 关键字 | 26 | | ----------- | ----------- | ----------- | 27 | | 扩展函数 | ```false``` | ```public static partial class``` | -------------------------------------------------------------------------------- /src/BD.SteamClient8.Primitives/Resources/Strings.ResXGeneratedCodeAttributes.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具 BD.Common8.SourceGenerator.ResX.Test.Helpers.ResXHelper 生成。 4 | // 5 | // 对此文件的更改可能会导致不正确的行为,并且如果 6 | // 重新生成代码,这些更改将会丢失。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | #pragma warning disable IDE0079 // 请删除不必要的忽略 11 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 12 | namespace BD.SteamClient8.Resources; 13 | #pragma warning restore IDE0079 // 请删除不必要的忽略 14 | 15 | [ResXGeneratedCode(@"..\..\..\res\i18n\BD.SteamClient8.Primitives.resx", version: 1)] 16 | public partial class Strings { } 17 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.UnitTest/BD.SteamClient8.UnitTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net$(DotNet_Version) 5 | net$(DotNet_Version)-windows$(WinSDK_Version) 6 | true 7 | false 8 | true 9 | 51922236-4771-4648-8755-76d97bcfa849 10 | true 11 | 12 | BD.Common8.Bcl; 13 | BD.SteamClient8.Primitives; 14 | BD.SteamClient8.Models; 15 | BD.SteamClient8; 16 | BD.SteamClient8.Impl; 17 | 18 | 19 | 20 | 21 | 22 | Templates 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Properties 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.UnitTest/Extensions/ServiceCollectionExtensions.TryAddHttpPlatformHelper.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 2 | namespace Microsoft.Extensions.DependencyInjection; 3 | 4 | public static partial class ServiceCollectionExtensions 5 | { 6 | /// 7 | /// 尝试添加 的实现 8 | /// 9 | /// 10 | /// 11 | /// 12 | public static IServiceCollection TryAddHttpPlatformHelper( 13 | this IServiceCollection services, 14 | string? userAgent = null) 15 | { 16 | if (userAgent != null) 17 | HttpPlatformHelperImpl.PresetUserAgent = userAgent; 18 | services.TryAddSingleton(); 19 | return services; 20 | } 21 | } 22 | 23 | file sealed class HttpPlatformHelperImpl : HttpPlatformHelperService 24 | { 25 | public static string? PresetUserAgent { get; internal set; } 26 | 27 | public override string UserAgent => PresetUserAgent ?? DefaultUserAgent; 28 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8.UnitTest/ProjectUtilsTest.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.UnitTest; 2 | 3 | sealed class _ProjectUtilsTest 4 | { 5 | [Test] 6 | public void Test() 7 | { 8 | TestContext.WriteLine($"tfm: {tfm}"); 9 | TestContext.WriteLine($"IsCI: {IsCI().ToLowerString()}"); 10 | TestContext.WriteLine($"ProjPath: {ProjPath}"); 11 | TestContext.WriteLine($"ROOT_ProjPath: {ROOT_ProjPath}"); 12 | TestContext.WriteLine($"DataPath: {DataPath}"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.UnitTest/ResxTest.cs: -------------------------------------------------------------------------------- 1 | using Resx1 = BD.SteamClient8.Resources.Strings; 2 | 3 | namespace BD.SteamClient8.UnitTest; 4 | 5 | sealed class ResxTest 6 | { 7 | [Test] 8 | public void Test() 9 | { 10 | var s1 = GetProperties(typeof(Resx1)); 11 | Assert.That(s1, Is.Not.Empty); 12 | 13 | TestContext.WriteLine(s1.Length.ToString()); 14 | } 15 | 16 | static PropertyInfo[] GetProperties(Type type) 17 | { 18 | var props = type.GetProperties(BindingFlags.Public | BindingFlags.Static); 19 | props = props.Where(x => x.PropertyType == typeof(string)).ToArray(); 20 | foreach (var item in props) 21 | { 22 | item.GetValue(null); 23 | } 24 | return props; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.UnitTest/SteamGridDBWebApiTest.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.UnitTest; 2 | 3 | /// 4 | /// 单元测试 5 | /// 6 | sealed class SteamGridDBWebApiTest : ServiceTestBase 7 | { 8 | ISteamGridDBWebApiServiceImpl steamGridDBWebApiService = null!; 9 | 10 | /// 11 | [SetUp] 12 | public override async ValueTask Setup() 13 | { 14 | await base.Setup(); 15 | 16 | steamGridDBWebApiService = GetRequiredService(); 17 | } 18 | 19 | /// 20 | /// 测试通过 AppId 获取 SteamGridApp 信息 21 | /// 22 | /// 23 | /// 24 | [TestCase(730)] 25 | [Test] 26 | public async Task GetSteamGridAppBySteamAppId(long appId) 27 | { 28 | var rsp = await steamGridDBWebApiService.GetSteamGridAppBySteamAppId(appId); 29 | 30 | Assert.That(rsp, Is.Not.Null); 31 | Assert.Multiple(() => 32 | { 33 | Assert.That(rsp.IsSuccess); 34 | Assert.That(rsp.Content?.Name, Is.Not.Empty); 35 | }); 36 | 37 | var gridItems = await steamGridDBWebApiService.GetSteamGridItemsByGameId(rsp.Content.Id); 38 | 39 | Assert.That(gridItems, Is.Not.Null); 40 | Assert.Multiple(() => 41 | { 42 | Assert.That(gridItems.IsSuccess); 43 | Assert.That(gridItems.Content, Is.Not.Empty); 44 | }); 45 | 46 | TestContext.WriteLine(Serializable.SJSON(rsp, writeIndented: true)); 47 | TestContext.WriteLine(Serializable.SJSON(gridItems, writeIndented: true)); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.ViewModels/AchievementInfoViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.ViewModels; 2 | 3 | /// 4 | /// 模型绑定类型 5 | /// 6 | [ViewModelWrapperGenerated(typeof(AchievementInfo), Properties = [nameof(AchievementInfo.IsChecked)])] 7 | public partial class AchievementInfoViewModel 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.ViewModels/AuthorizedDeviceViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.ViewModels; 2 | 3 | /// 4 | /// 视图模型 5 | /// 6 | [ViewModelWrapperGenerated(typeof(AuthorizedDevice), 7 | Properties = [ 8 | nameof(AuthorizedDevice.Disable), 9 | nameof(AuthorizedDevice.OnlineState), 10 | nameof(AuthorizedDevice.Remark), 11 | nameof(AuthorizedDevice.SteamID), 12 | nameof(AuthorizedDevice.SteamNickName), 13 | nameof(AuthorizedDevice.AvatarMedium) 14 | ])] 15 | public partial class AuthorizedDeviceViewModel 16 | { 17 | } 18 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.ViewModels/BD.SteamClient8.ViewModels.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net$(DotNet_Version);net$(DotNet_Version)-android;net$(DotNet_Version)-ios;net$(DotNet_Version)-macos;net$(DotNet_Version)-maccatalyst 5 | $(TargetFrameworks);net$(DotNet_Version)-windows$(WinSDK_Version) 6 | true 7 | true 8 | true 9 | true 10 | true 11 | 12 | 13 | 14 | true 15 | 16 | 17 | 18 | 19 | Properties\GlobalUsings 20 | 21 | 22 | Properties\GlobalUsings 23 | 24 | 25 | Properties\GlobalUsings 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.ViewModels/Expressions/PropertySetExpression.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.ViewModels.Expressions; 2 | 3 | /// 4 | /// 属性赋值表达式数 5 | /// 6 | public static class PropertySetExpression 7 | { 8 | /// 9 | /// 相同属性名赋值 10 | /// 11 | /// 12 | /// 13 | /// 14 | public static Expression> CreateCopyExpression< 15 | [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] TSource, 16 | [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] TTarget>() 17 | { 18 | var sourceParameter = Expression.Parameter(typeof(TSource), "source"); 19 | var targetParameter = Expression.Parameter(typeof(TTarget), "target"); 20 | 21 | var copyExpressions = typeof(TSource).GetProperties() 22 | .Where(prop => typeof(TTarget).GetProperty(prop.Name) != null) 23 | .Select(prop => 24 | { 25 | var sourceProperty = Expression.Property(sourceParameter, prop); 26 | var targetProperty = Expression.Property(targetParameter, prop); 27 | 28 | return Expression.Assign(targetProperty, sourceProperty); 29 | }); 30 | 31 | var block = Expression.Block(copyExpressions); 32 | 33 | return Expression.Lambda>(block, sourceParameter, targetParameter); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.ViewModels/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.ViewModels/SampleViewModel.cs: -------------------------------------------------------------------------------- 1 | #if DEBUG 2 | namespace BD.SteamClient8.ViewModels; 3 | 4 | #pragma warning disable SA1600 // Elements should be documented 5 | 6 | /// 7 | /// 视图模型的示例 8 | /// 9 | [ViewModelWrapperGenerated(typeof(SampleModel), 10 | Properties = [ 11 | nameof(SampleModel.A), 12 | ])] 13 | public partial class SampleViewModel 14 | { 15 | [Reactive] 16 | public Guid Id { get; set; } 17 | } 18 | #endif -------------------------------------------------------------------------------- /src/BD.SteamClient8.ViewModels/SteamAppLaunchItemViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.ViewModels; 2 | 3 | /// 4 | /// 模型绑定类型 5 | /// 6 | [ViewModelWrapperGenerated(typeof(SteamAppLaunchItem))] 7 | public partial class SteamAppLaunchItemViewModel 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.ViewModels/SteamRemoteFileViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.ViewModels; 2 | 3 | /// 4 | /// 模型绑定类型 5 | /// 6 | [ViewModelWrapperGenerated(typeof(SteamRemoteFile))] 7 | public partial class SteamRemoteFileViewModel 8 | { 9 | /// 10 | /// 获取文件名 11 | /// 12 | public string Name { get => Model.Name; } 13 | 14 | /// 15 | public int Read(byte[] buffer) 16 | { 17 | return ISteamworksLocalApiService.Instance.FileRead(Name, buffer).GetAwaiter().GetResult()?.Content ?? default; 18 | } 19 | 20 | /// 21 | /// 读取文件的所有字节 22 | /// 23 | public byte[] ReadAllBytes() 24 | { 25 | byte[] buffer = new byte[Size]; 26 | int read = Read(buffer); 27 | if (read != buffer.Length) 28 | throw new IOException("Could not read entire file."); 29 | return buffer; 30 | } 31 | 32 | /// 33 | public bool WriteAllBytes(byte[] buffer) 34 | { 35 | return ISteamworksLocalApiService.Instance.FileWrite(Name, buffer).GetAwaiter().GetResult()?.IsSuccess ?? default; 36 | } 37 | 38 | /// 39 | public bool Forget() 40 | { 41 | return ISteamworksLocalApiService.Instance.FileForget(Name).GetAwaiter().GetResult()?.IsSuccess ?? default; 42 | } 43 | 44 | /// 45 | public bool Delete() 46 | { 47 | return ISteamworksLocalApiService.Instance.FileDelete(Name).GetAwaiter().GetResult()?.IsSuccess ?? default; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/BD.SteamClient8.ViewModels/SteamUserViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.ViewModels; 2 | 3 | /// 4 | /// 模型绑定类型 5 | /// 6 | [ViewModelWrapperGenerated(typeof(SteamUser), 7 | Properties = [ 8 | nameof(SteamUser.OnlineState), 9 | nameof(SteamUser.Level), 10 | nameof(SteamUser.AvatarIcon), 11 | nameof(SteamUser.AvatarMedium), 12 | nameof(SteamUser.AvatarFull), 13 | nameof(SteamUser.MostRecent), 14 | nameof(SteamUser.WantsOfflineMode), 15 | nameof(SteamUser.Remark), 16 | nameof(SteamUser.MiniProfile), 17 | nameof(SteamUser.PersonaState), 18 | ])] 19 | public sealed partial class SteamUserViewModel 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /src/BD.SteamClient8/BD.SteamClient8.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | true 6 | SteamClient8 主库 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/BD.SteamClient8/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /src/BD.SteamClient8/Helpers/VdfHelper.cs: -------------------------------------------------------------------------------- 1 | #if !(IOS || ANDROID) 2 | namespace BD.SteamClient8.Helpers; 3 | 4 | /// 5 | /// Valve Data File 格式助手类 6 | /// 7 | public static class VdfHelper 8 | { 9 | const string TAG = nameof(VdfHelper); 10 | 11 | static readonly KVSerializerOptions options = new() 12 | { 13 | HasEscapeSequences = true, 14 | }; 15 | 16 | /// 17 | /// 根据路径读取 Valve Data File 内容 18 | /// 19 | /// 20 | /// 21 | /// 22 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 23 | public static KVObject Read(string filePath, bool isBinary = false) 24 | { 25 | var kv = KVSerializer.Create(isBinary ? KVSerializationFormat.KeyValues1Binary : KVSerializationFormat.KeyValues1Text); 26 | var data = kv.Deserialize(IOPath.OpenRead(filePath)!, options); 27 | return data; 28 | } 29 | 30 | /// 31 | /// 根据路径写入 Valve Data File 内容 32 | /// 33 | /// 34 | /// 35 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 36 | public static void Write(string filePath, KVObject content) 37 | { 38 | try 39 | { 40 | //不要用 FileMode.OpenOrCreate 文件内容长度不一致会导致结尾内容错误 41 | using var stream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete); 42 | var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text); 43 | kv.Serialize(stream, content, options); 44 | } 45 | catch (Exception e) 46 | { 47 | Log.Error(TAG, e, "Write vdf file error, filePath: {filePath}", filePath); 48 | } 49 | } 50 | } 51 | #endif -------------------------------------------------------------------------------- /src/BD.SteamClient8/README.md: -------------------------------------------------------------------------------- 1 | ### BD.SteamClient8 2 | SteamClient8 主库 3 | 4 | #### Extensions 5 | | 描述 | XmlnsDefinition | 关键字 | 6 | | ----------- | ----------- | ----------- | 7 | | 扩展函数 | ```false``` | ```public static partial class``` | 8 | 9 | #### Helpers 10 | | 描述 | XmlnsDefinition | 关键字 | 11 | | ----------- | ----------- | ----------- | 12 | | 助手 | ```false``` | ```public static class``` | 13 | 14 | #### Services 15 | | 描述 | XmlnsDefinition | 关键字 | 16 | | ----------- | ----------- | ----------- | 17 | | 服务接口 | ```false``` | ```public interface``` | -------------------------------------------------------------------------------- /src/BD.SteamClient8/Services/Abstractions/PInvoke/ISteamService.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Services.Abstractions.PInvoke; 2 | 3 | /// 4 | /// Steam 相关助手、工具类服务 5 | /// 6 | public partial interface ISteamService 7 | { 8 | static ISteamService Instance => Ioc.Get(); 9 | } 10 | -------------------------------------------------------------------------------- /src/BD.SteamClient8/Services/Abstractions/WebApi/ISteamDbWebApiService.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Services.Abstractions.WebApi; 2 | 3 | /// 4 | /// SteamDb WebApi 服务 5 | /// 6 | public interface ISteamDbWebApiService 7 | { 8 | /// 9 | /// 获取当前服务实例 10 | /// 11 | static ISteamDbWebApiService Instance => Ioc.Get(); 12 | 13 | /// 14 | /// 获取用户详情 15 | /// 16 | /// 17 | /// 18 | /// 19 | Task> GetUserInfo(long steamId64, CancellationToken cancellationToken = default); 20 | 21 | /// 22 | /// 批量获取用户详情 23 | /// 24 | /// 25 | /// 26 | /// 27 | Task>> GetUserInfos(IEnumerable steamId64s, CancellationToken cancellationToken = default); 28 | 29 | /// 30 | /// 通过 AppId 获取游戏详情 31 | /// 32 | /// 33 | /// 34 | /// 35 | Task> GetAppInfo(int appId, CancellationToken cancellationToken = default); 36 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8/Services/Abstractions/WebApi/ISteamGridDBWebApiServiceImpl.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Services.Abstractions.WebApi; 2 | 3 | /// 4 | /// SteamGridDB WebApi 服务 5 | /// 6 | public interface ISteamGridDBWebApiServiceImpl 7 | { 8 | /// 9 | /// SteamGridDB 接口密钥 10 | /// 11 | const string SteamGridDBApiKey = "ae93db7411cac53190aa5a9b633bf5e2"; 12 | 13 | /// 14 | /// 获取当前服务实例 15 | /// 16 | static ISteamGridDBWebApiServiceImpl Instance => Ioc.Get(); 17 | 18 | /// 19 | /// 通过 AppId 获取 SteamGridApp 信息 20 | /// 21 | /// 22 | /// 23 | /// 24 | Task> GetSteamGridAppBySteamAppId(long appId, CancellationToken cancellationToken = default); 25 | 26 | /// 27 | /// 通过 GameId 获取 SteamGrid 详情列表 28 | /// 29 | /// 30 | /// 31 | /// 32 | /// 33 | Task?>> GetSteamGridItemsByGameId(long gameId, SteamGridItemType type = SteamGridItemType.Grid, CancellationToken cancellationToken = default); 34 | 35 | /// 36 | /// SteamGridDB 接口密钥 37 | /// 38 | static string? ApiKey { get; set; } = SteamGridDBApiKey; 39 | } -------------------------------------------------------------------------------- /src/BD.SteamClient8/Services/Abstractions/WebApi/ISteamIdleCardService.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Services.Abstractions.WebApi; 2 | 3 | /// 4 | /// Steam 挂卡相关服务 5 | /// 6 | public interface ISteamIdleCardService 7 | { 8 | /// 9 | /// 获取当前服务实例 10 | /// 11 | static ISteamIdleCardService Instance => Ioc.Get(); 12 | 13 | /// 14 | /// 获取用户徽章和卡片数据 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | Task> GetBadgesAsync(string steam_id, bool need_price = false, string currency = "CNY", CancellationToken cancellationToken = default); 22 | 23 | /// 24 | /// 获取游戏卡组卡片平均价格 25 | /// 26 | /// 27 | /// 28 | /// 29 | /// 30 | Task?>> GetAppCardsAvgPrice(uint[] appIds, string currency, CancellationToken cancellationToken = default); 31 | 32 | /// 33 | /// 获取游戏卡片价格 34 | /// 35 | /// 36 | /// 37 | /// 38 | /// 39 | Task?>> GetCardsMarketPrice(uint appId, string currency, CancellationToken cancellationToken = default); 40 | } 41 | -------------------------------------------------------------------------------- /src/BD.SteamClient8/Services/Abstractions/WebApi/ISteamworksWebApiService.cs: -------------------------------------------------------------------------------- 1 | namespace BD.SteamClient8.Services.Abstractions.WebApi; 2 | 3 | /// 4 | /// Steamworks WebApi 服务 5 | /// 6 | public interface ISteamworksWebApiService 7 | { 8 | /// 9 | /// 获取当前服务实例 10 | /// 11 | static ISteamworksWebApiService Instance => Ioc.Get(); 12 | 13 | /// 14 | /// 获取所有游戏 JSON 字符串 15 | /// 16 | /// 17 | /// 18 | Task> GetAllSteamAppsString(CancellationToken cancellationToken = default); 19 | 20 | /// 21 | /// 获取所有 Steam 游戏列表 22 | /// 23 | /// 24 | /// 25 | Task>> GetAllSteamAppList(CancellationToken cancellationToken = default); 26 | 27 | /// 28 | /// 获取 Steam 个人资料 29 | /// 30 | /// 31 | /// 32 | /// 33 | Task> GetUserInfo(long steamId64, CancellationToken cancellationToken = default); 34 | 35 | /// 36 | /// 获取 Mini 资料 37 | /// 38 | /// 39 | /// 40 | /// 41 | Task> GetUserMiniProfile(long steamId3, CancellationToken cancellationToken = default); 42 | } -------------------------------------------------------------------------------- /src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $(MSBuildThisFileDirectory)..\ref\ 8 | 9 | 10 | 11 | $(MSBuildThisFileDirectory)..\..\ 12 | 13 | 14 | 15 | 16 | 17 | $(Version_SteamClient8) 18 | 19 | 20 | 21 | 22 | true 23 | 24 | 25 | 26 | 27 | Properties\InternalsVisibleTo 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | $(MSBuildThisFileDirectory)..\ref\ 4 | 5 | 6 | 7 | $(MSBuildThisFileDirectory)..\..\ 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Directory.Packages.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Protobuf/steammessages_unified_base.steamclient.proto: -------------------------------------------------------------------------------- 1 | // See README.md for information and build instructions. 2 | // 3 | // Note: START and END tags are used in comments to define sections used in 4 | // tutorials. They are not part of the syntax for Protocol Buffers. 5 | // 6 | // To get an in-depth walkthrough of this file and the related examples, see: 7 | // https://developers.google.com/protocol-buffers/docs/tutorials 8 | // https://github.com/protocolbuffers/protobuf/blob/v21.7/examples/addressbook.proto 9 | 10 | // [START declaration] 11 | syntax = "proto2"; 12 | package tutorial; 13 | 14 | import "google-protobuf-descriptor.proto"; 15 | // [END declaration] 16 | 17 | option optimize_for = SPEED; 18 | option cc_generic_services = true; 19 | 20 | // [START csharp_declaration] 21 | option csharp_namespace = "BD.SteamClient8.Models.Protobuf"; 22 | // [END csharp_declaration] 23 | 24 | // [START messages] 25 | extend .google.protobuf.FieldOptions { 26 | optional string description = 50000; 27 | } 28 | 29 | extend .google.protobuf.ServiceOptions { 30 | optional string service_description = 50000; 31 | optional EProtoExecutionSite service_execution_site = 50008 [default = k_EProtoExecutionSiteUnknown]; 32 | } 33 | 34 | extend .google.protobuf.MethodOptions { 35 | optional string method_description = 50000; 36 | } 37 | 38 | extend .google.protobuf.EnumOptions { 39 | optional string enum_description = 50000; 40 | } 41 | 42 | extend .google.protobuf.EnumValueOptions { 43 | optional string enum_value_description = 50000; 44 | } 45 | 46 | enum EProtoExecutionSite { 47 | k_EProtoExecutionSiteUnknown = 0; 48 | k_EProtoExecutionSiteSteamClient = 2; 49 | } 50 | 51 | message NoResponse { 52 | } 53 | // [END messages] -------------------------------------------------------------------------------- /src/SAM.API/Callback.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API; 24 | 25 | public abstract class Callback : ICallback 26 | { 27 | public delegate void CallbackFunction(nint param); 28 | 29 | public event CallbackFunction? OnRun; 30 | 31 | public abstract int Id { get; } 32 | 33 | public abstract bool IsServer { get; } 34 | 35 | public void Run(nint param) 36 | { 37 | OnRun?.Invoke(param); 38 | } 39 | } 40 | 41 | public abstract class Callback<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] TParameter> : ICallback 42 | where TParameter : struct 43 | { 44 | public delegate void CallbackFunction(TParameter arg); 45 | 46 | public event CallbackFunction? OnRun; 47 | 48 | public abstract int Id { get; } 49 | 50 | public abstract bool IsServer { get; } 51 | 52 | public void Run(nint pvParam) 53 | { 54 | var data = Marshal.PtrToStructure(pvParam); 55 | OnRun?.Invoke(data); 56 | } 57 | } -------------------------------------------------------------------------------- /src/SAM.API/Callbacks/AppDataChanged.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Callbacks; 24 | 25 | public sealed class AppDataChanged : Callback 26 | { 27 | public override int Id => 1001; 28 | 29 | public override bool IsServer => false; 30 | } -------------------------------------------------------------------------------- /src/SAM.API/Callbacks/UserStatsReceived.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Callbacks; 24 | 25 | public sealed class UserStatsReceived : Callback 26 | { 27 | public override int Id => 1101; 28 | 29 | public override bool IsServer => false; 30 | } -------------------------------------------------------------------------------- /src/SAM.API/ClientInitializeException.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API; 24 | 25 | public class ClientInitializeException : ApplicationException 26 | { 27 | public readonly ClientInitializeFailure Failure; 28 | 29 | public ClientInitializeException(ClientInitializeFailure failure) 30 | { 31 | Failure = failure; 32 | } 33 | 34 | public ClientInitializeException(ClientInitializeFailure failure, string message) 35 | : base(message) 36 | { 37 | Failure = failure; 38 | } 39 | 40 | public ClientInitializeException( 41 | ClientInitializeFailure failure, 42 | string message, 43 | Exception innerException) 44 | : base(message, innerException) 45 | { 46 | Failure = failure; 47 | } 48 | } -------------------------------------------------------------------------------- /src/SAM.API/ClientInitializeFailure.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | namespace SAM.API; 23 | 24 | public enum ClientInitializeFailure : byte 25 | { 26 | Unknown = 0, 27 | GetInstallPath, 28 | Load, 29 | CreateSteamClient, 30 | CreateSteamPipe, 31 | ConnectToGlobalUser, 32 | AppIdMismatch, 33 | } -------------------------------------------------------------------------------- /src/SAM.API/ICallback.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API; 24 | 25 | public interface ICallback 26 | { 27 | int Id { get; } 28 | 29 | bool IsServer { get; } 30 | 31 | void Run(nint param); 32 | } -------------------------------------------------------------------------------- /src/SAM.API/INativeWrapper.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API; 24 | 25 | public interface INativeWrapper 26 | { 27 | void SetupFunctions(nint objectAddress); 28 | } -------------------------------------------------------------------------------- /src/SAM.API/Interfaces/ISteamApps001.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Interfaces; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct ISteamApps001 27 | { 28 | public nint GetAppData; 29 | } -------------------------------------------------------------------------------- /src/SAM.API/Interfaces/ISteamUser012.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Interfaces; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct ISteamUser012 27 | { 28 | public nint GetHSteamUser; 29 | public nint LoggedOn; 30 | public nint GetSteamID; 31 | public nint InitiateGameConnection; 32 | public nint TerminateGameConnection; 33 | public nint TrackAppUsageEvent; 34 | public nint GetUserDataFolder; 35 | public nint StartVoiceRecording; 36 | public nint StopVoiceRecording; 37 | public nint GetCompressedVoice; 38 | public nint DecompressVoice; 39 | public nint GetAuthSessionTicket; 40 | public nint BeginAuthSession; 41 | public nint EndAuthSession; 42 | public nint CancelAuthTicket; 43 | public nint UserHasLicenseForApp; 44 | } -------------------------------------------------------------------------------- /src/SAM.API/Interfaces/ISteamUser019.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Interfaces; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct ISteamUser019 27 | { 28 | public nint GetHSteamUser; 29 | public nint LoggedOn; 30 | public nint GetSteamID; 31 | public nint InitiateGameConnection; 32 | public nint TerminateGameConnection; 33 | public nint TrackAppUsageEvent; 34 | public nint GetUserDataFolder; 35 | public nint StartVoiceRecording; 36 | public nint StopVoiceRecording; 37 | public nint GetCompressedVoice; 38 | public nint DecompressVoice; 39 | public nint GetAuthSessionTicket; 40 | public nint BeginAuthSession; 41 | public nint EndAuthSession; 42 | public nint CancelAuthTicket; 43 | public nint UserHasLicenseForApp; 44 | public nint GetPlayerSteamLevel; 45 | } -------------------------------------------------------------------------------- /src/SAM.API/Interfaces/ISteamUtils005.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Interfaces; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct ISteamUtils005 27 | { 28 | public nint GetSecondsSinceAppActive; 29 | public nint GetSecondsSinceComputerActive; 30 | public nint GetConnectedUniverse; 31 | public nint GetServerRealTime; 32 | public nint GetIPCountry; 33 | public nint GetImageSize; 34 | public nint GetImageRGBA; 35 | public nint GetCSERIPPort; 36 | public nint GetCurrentBatteryPower; 37 | public nint GetAppID; 38 | public nint SetOverlayNotificationPosition; 39 | public nint IsAPICallCompleted; 40 | public nint GetAPICallFailureReason; 41 | public nint GetAPICallResult; 42 | public nint RunFrame; 43 | public nint GetIPCCallCount; 44 | public nint SetWarningMessageHook; 45 | public nint IsOverlayEnabled; 46 | public nint OverlayNeedsPresent; 47 | } -------------------------------------------------------------------------------- /src/SAM.API/Interfaces/ISteamUtils009.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Interfaces; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct ISteamUtils009 27 | { 28 | public nint GetSecondsSinceAppActive; 29 | public nint GetSecondsSinceComputerActive; 30 | public nint GetConnectedUniverse; 31 | public nint GetServerRealTime; 32 | public nint GetIPCountry; 33 | public nint GetImageSize; 34 | public nint GetImageRGBA; 35 | public nint GetCSERIPPort; 36 | public nint GetCurrentBatteryPower; 37 | public nint GetAppID; 38 | public nint SetOverlayNotificationPosition; 39 | public nint IsAPICallCompleted; 40 | public nint GetAPICallFailureReason; 41 | public nint GetAPICallResult; 42 | public nint RunFrame; 43 | public nint GetIPCCallCount; 44 | public nint SetWarningMessageHook; 45 | public nint IsOverlayEnabled; 46 | public nint IsSteamChinaLauncher; 47 | public nint IsSteamRunningInVR; 48 | public nint OverlayNeedsPresent; 49 | public nint IsSteamInBigPictureMode; 50 | } -------------------------------------------------------------------------------- /src/SAM.API/LICENSE.txt: -------------------------------------------------------------------------------- 1 | zlib License 2 | 3 | Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. -------------------------------------------------------------------------------- /src/SAM.API/NativeClass.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)] 26 | internal struct NativeClass 27 | { 28 | public nint VirtualTable; 29 | } -------------------------------------------------------------------------------- /src/SAM.API/Types/AccountType.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Types; 24 | 25 | public enum AccountType : int 26 | { 27 | Invalid = 0, 28 | Individual = 1, 29 | Multiset = 2, 30 | GameServer = 3, 31 | AnonGameServer = 4, 32 | Pending = 5, 33 | ContentServer = 6, 34 | Clan = 7, 35 | Chat = 8, 36 | P2PSuperSeeder = 9, 37 | } -------------------------------------------------------------------------------- /src/SAM.API/Types/AppDataChanged.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Types; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct AppDataChanged 27 | { 28 | public uint Id; 29 | public bool Result; 30 | } -------------------------------------------------------------------------------- /src/SAM.API/Types/CallbackMessage.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Types; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct CallbackMessage 27 | { 28 | public int User; 29 | public int Id; 30 | public nint ParamPointer; 31 | public int ParamSize; 32 | } -------------------------------------------------------------------------------- /src/SAM.API/Types/ItemRequestResult.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Types; 24 | 25 | public enum ItemRequestResult : int 26 | { 27 | InvalidValue = -1, 28 | OK = 0, 29 | Denied = 1, 30 | ServerError = 2, 31 | Timeout = 3, 32 | Invalid = 4, 33 | NoMatch = 5, 34 | UnknownError = 6, 35 | NotLoggedOn = 7, 36 | } -------------------------------------------------------------------------------- /src/SAM.API/Types/RemoteStorageCommon.cs: -------------------------------------------------------------------------------- 1 | namespace SAM.API.Types; 2 | 3 | public enum ERemoteStoragePlatform : int 4 | { 5 | k_ERemoteStoragePlatformNone = 0, 6 | k_ERemoteStoragePlatformWindows = 1, 7 | k_ERemoteStoragePlatformOSX = 2, 8 | k_ERemoteStoragePlatformPS3 = 4, 9 | k_ERemoteStoragePlatformLinux = 8, 10 | k_ERemoteStoragePlatformReserved2 = 16, 11 | k_ERemoteStoragePlatformAll = -1, 12 | } 13 | -------------------------------------------------------------------------------- /src/SAM.API/Types/UserItemsReceived.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Types; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct UserItemsReceived 27 | { 28 | public ulong GameId; 29 | public int Unknown; 30 | public int ItemCount; 31 | } -------------------------------------------------------------------------------- /src/SAM.API/Types/UserStatType.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Types; 24 | 25 | public enum UserStatType 26 | { 27 | Invalid = 0, 28 | Integer = 1, 29 | Float = 2, 30 | AverageRate = 3, 31 | Achievements = 4, 32 | GroupAchievements = 5, 33 | } -------------------------------------------------------------------------------- /src/SAM.API/Types/UserStatsReceived.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Types; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct UserStatsReceived 27 | { 28 | public ulong GameId; 29 | public int Result; 30 | } -------------------------------------------------------------------------------- /src/SAM.API/Types/UserStatsStored.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Types; 24 | 25 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 26 | public struct UserStatsStored 27 | { 28 | public ulong GameId; 29 | public int Result; 30 | } -------------------------------------------------------------------------------- /src/SAM.API/Wrappers/SteamApps001.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Wrappers; 24 | 25 | public class SteamApps001 : NativeWrapper 26 | { 27 | #region GetAppData 28 | [UnmanagedFunctionPointer(CallingConvention.ThisCall)] 29 | private delegate int NativeGetAppData( 30 | nint self, 31 | uint appId, 32 | nint key, 33 | nint value, 34 | int valueLength); 35 | 36 | public string GetAppData(uint appId, string key) 37 | { 38 | using var nativeHandle = NativeStrings.StringToStringHandle(key); 39 | const int valueLength = 1024; 40 | var valuePointer = Marshal.AllocHGlobal(valueLength); 41 | int result = Call( 42 | Functions.GetAppData, 43 | ObjectAddress, 44 | appId, 45 | nativeHandle.Handle, 46 | valuePointer, 47 | valueLength); 48 | var value = result == 0 ? null : NativeStrings.PointerToString(valuePointer, valueLength); 49 | Marshal.FreeHGlobal(valuePointer); 50 | return value ?? string.Empty; 51 | } 52 | #endregion 53 | } -------------------------------------------------------------------------------- /src/SAM.API/Wrappers/SteamUGC015.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Wrappers; 24 | 25 | public class SteamUGC015 : NativeWrapper 26 | { 27 | #region GetAppData 28 | 29 | #endregion 30 | } -------------------------------------------------------------------------------- /src/SAM.API/Wrappers/SteamUser012.cs: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) 2 | * 3 | * This software is provided 'as-is', without any express or implied 4 | * warranty. In no event will the authors be held liable for any damages 5 | * arising from the use of this software. 6 | * 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 11 | * 1. The origin of this software must not be misrepresented; you must not 12 | * claim that you wrote the original software. If you use this software 13 | * in a product, an acknowledgment in the product documentation would 14 | * be appreciated but is not required. 15 | * 16 | * 2. Altered source versions must be plainly marked as such, and must not 17 | * be misrepresented as being the original software. 18 | * 19 | * 3. This notice may not be removed or altered from any source 20 | * distribution. 21 | */ 22 | 23 | namespace SAM.API.Wrappers; 24 | 25 | public class SteamUser012 : NativeWrapper 26 | { 27 | #region IsLoggedIn 28 | [UnmanagedFunctionPointer(CallingConvention.ThisCall)] 29 | [return: MarshalAs(UnmanagedType.I1)] 30 | private delegate bool NativeLoggedOn(nint self); 31 | 32 | public bool IsLoggedIn() 33 | { 34 | return Call(Functions.LoggedOn, ObjectAddress); 35 | } 36 | #endregion 37 | 38 | #region GetSteamID 39 | [UnmanagedFunctionPointer(CallingConvention.ThisCall)] 40 | private delegate void NativeGetSteamId(nint self, out ulong steamId); 41 | 42 | public ulong GetSteamId() 43 | { 44 | var call = GetFunction(Functions.GetSteamID); 45 | call(ObjectAddress, out var steamId); 46 | return steamId; 47 | } 48 | #endregion 49 | } -------------------------------------------------------------------------------- /src/Sdk/BD.SteamClient8.Sdk.Lib.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Sdk/BD.SteamClient8.Sdk.Ref.Link.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | _SourceReference\BD.SteamClient8.Primitives 8 | 9 | 10 | 11 | 12 | 13 | 14 | _SourceReference\BD.SteamClient8.Models 15 | 16 | 17 | 18 | 19 | 20 | 21 | _SourceReference\BD.SteamClient8 22 | 23 | 24 | 25 | 26 | 27 | 28 | _SourceReference\BD.SteamClient8.Impl 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Sdk/BD.SteamClient8.Sdk.Ref.Package.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Sdk/BD.SteamClient8.Sdk.Ref.Project.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Sdk/BD.SteamClient8.Sdk.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net$(DotNet_Version) 5 | 6 | 7 | 8 | 9 | Shared 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Sdk/BD.SteamClient8.Sdk.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Sdk/GeneratePackage.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | LGPL-3.0-only 7 | https://github.com/BeyondDimension/SteamClient 8 | $(PackageProjectUrl)/releases 9 | $(PackageProjectUrl).git 10 | git 11 | dev8 12 | true 13 | true 14 | $(MSBuildProjectDirectory)\..\..\pkg 15 | 16 | true 17 | 18 | true 19 | snupkg 20 | true 21 | README.md 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Sdk/Links/SteamAchievementManager.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _SourceReference\SteamAchievementManager 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Sdk/Links/ValveKeyValue.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _SourceReference\ValveKeyValue 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Sdk/Projects/BD.SteamClient8.Impl.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Properties\GlobalUsings 6 | 7 | 8 | Properties 9 | 10 | 11 | 12 | 13 | 14 | $(BeyondDimensionFeatures) 15 | BD.Common8.Bcl; 16 | BD.Common8.Primitives; 17 | BD.Common8.Primitives.ApiRsp; 18 | BD.Common8.Security; 19 | BD.Common8.Crawler; 20 | BD.Common8.Http.ClientFactory; 21 | BD.SteamClient8.Primitives; 22 | BD.SteamClient8.Models; 23 | BD.SteamClient8; 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Sdk/Projects/BD.SteamClient8.Models.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Properties\GlobalUsings 6 | 7 | 8 | Properties 9 | 10 | 11 | 12 | 13 | 14 | $(BeyondDimensionFeatures) 15 | BD.Common8.Bcl; 16 | BD.Common8.Primitives; 17 | BD.Common8.Primitives.ApiRsp; 18 | BD.Common8.Security; 19 | BD.SteamClient8.Primitives; 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Sdk/Projects/BD.SteamClient8.Primitives.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Properties\GlobalUsings 6 | 7 | 8 | Properties 9 | 10 | 11 | 12 | 13 | 14 | $(BeyondDimensionFeatures) 15 | BD.Common8.Bcl; 16 | BD.Common8.Primitives; 17 | BD.Common8.Primitives.ApiRsp; 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Sdk/Projects/BD.SteamClient8.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Properties\GlobalUsings 6 | 7 | 8 | Properties 9 | 10 | 11 | 12 | 13 | 14 | $(BeyondDimensionFeatures) 15 | BD.Common8.Bcl; 16 | BD.Common8.Primitives; 17 | BD.Common8.Primitives.ApiRsp; 18 | BD.Common8.Security; 19 | BD.SteamClient8.Primitives; 20 | BD.SteamClient8.Models; 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Sdk/TFM_NETX_WINDOWS.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$(DotNet_Version) 4 | net$(DotNet_Version)-windows$(WinSDK_Version) 5 | 6 | -------------------------------------------------------------------------------- /src/Sdk/TFM_NETX_WITH_ALL.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$(DotNet_Version) 4 | $(TargetFrameworks);net$(DotNet_Version)-android;net$(DotNet_Version)-ios;net$(DotNet_Version)-macos;net$(DotNet_Version)-windows$(WinSDK_Version) 5 | $(TargetFrameworks);net$(DotNet_Version)-android;net$(DotNet_Version)-ios;net$(DotNet_Version)-macos 6 | $(TargetFrameworks) 7 | LINUX;$(DefineConstants) 8 | 9 | -------------------------------------------------------------------------------- /src/Sdk/TFM_NETX_WITH_DESKTOP.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$(DotNet_Version) 4 | $(TargetFrameworks);net$(DotNet_Version)-macos;net$(DotNet_Version)-windows$(WinSDK_Version) 5 | $(TargetFrameworks);net$(DotNet_Version)-macos 6 | $(TargetFrameworks) 7 | LINUX;$(DefineConstants) 8 | 9 | -------------------------------------------------------------------------------- /src/Sdk/buildTransitive/BD.SteamClient8.Primitives.props: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/Sdk/buildTransitive/BD.SteamClient8.Primitives.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Shared/GlobalUsings.BD.SteamClient8.Impl.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Shared/GlobalUsings.BD.SteamClient8.Models.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Shared/GlobalUsings.BD.SteamClient8.Primitives.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Shared/GlobalUsings.BD.SteamClient8.UnitTest.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Shared/GlobalUsings.BD.SteamClient8.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Shared/GlobalUsings.BouncyCastle.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Shared/GlobalUsings.SteamAchievementManager.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Shared/GlobalUsings.ValveKeyValue.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Shared/InternalsVisibleTo.BD.SteamClient8.UnitTest.cs: -------------------------------------------------------------------------------- 1 | using IVT = System.Runtime.CompilerServices.InternalsVisibleToAttribute; 2 | 3 | [assembly: IVT("BD.SteamClient8.UnitTest")] 4 | -------------------------------------------------------------------------------- /src/TFM_NETX.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$(DotNet_Version) 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/TFM_NETX_SINGLE.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$(DotNet_Version)-windows10.0.19041.0 4 | net$(DotNet_Version)-macos 5 | net$(DotNet_Version) 6 | 14.0 7 | 10.15 8 | 10.0.17763.0 9 | 10.0.17763.0 10 | LINUX;$(DefineConstants) 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/TFM_NETX_WINDOWS.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$(DotNet_Version) 4 | net$(DotNet_Version)-windows10.0.19041.0 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/TFM_NETX_WITH_DESKTOP.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$(DotNet_Version);net$(DotNet_Version)-macos;net$(DotNet_Version)-windows10.0.19041.0 4 | net$(DotNet_Version)-macos 5 | net$(DotNet_Version) 6 | 14.0 7 | 10.15 8 | 10.0.17763.0 9 | 10.0.17763.0 10 | LINUX;$(DefineConstants) 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/TFM_NETX_WITH_WINDOWS.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net$(DotNet_Version) 4 | $(TargetFrameworks);net$(DotNet_Version)-windows10.0.19041.0 5 | 10.0.17763.0 6 | 10.0.17763.0 7 | LINUX;$(DefineConstants) 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Tools.Build/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "BD.SteamClient8.Tools.Build": { 4 | "commandName": "Project", 5 | "commandLineArgs": "b" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/Tools.Build/Tools.Build.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net$(DotNet_Version) 6 | true 7 | 8 | BD.Common8.Bcl; 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Tools.DocFX/Tools.DocFX.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net$(DotNet_Version) 6 | true 7 | 8 | BD.Common8.Bcl; 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Tools.Sort.PackageVersion/Tools.Sort.PackageVersion.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net$(DotNet_Version) 6 | true 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Version.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8.24.10611.11400 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/WinAuth/BD.WTTS/Columns/IOrderAuthenticator.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace BD.WTTS.Columns; 5 | 6 | /// 7 | /// 可排序的身份验证器 8 | /// 9 | public interface IOrderAuthenticator 10 | { 11 | /// 12 | /// 唯一标识符 13 | /// 14 | ushort Id { get; set; } 15 | 16 | /// 17 | /// 索引 18 | /// 19 | int Index { get; set; } 20 | } 21 | 22 | [Obsolete("use IOrderAuthenticator", true)] 23 | #pragma warning disable SA1600 // Elements should be documented 24 | public interface IOrderGAPAuthenticator : IOrderAuthenticator 25 | #pragma warning restore SA1600 // Elements should be documented 26 | { 27 | } -------------------------------------------------------------------------------- /src/WinAuth/BD.WTTS/Enums/AuthenticatorPlatform.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace BD.WTTS.Enums; 5 | 6 | /// 7 | /// 令牌平台类型 8 | /// 9 | public enum AuthenticatorPlatform : byte 10 | { 11 | Steam = 1, 12 | 13 | Microsoft = 5, 14 | 15 | BattleNet = 11, 16 | 17 | Google = 12, 18 | 19 | HOTP = 13, 20 | 21 | TOTP = 14, 22 | } -------------------------------------------------------------------------------- /src/WinAuth/BD.WTTS/Enums/HMACTypes.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 2 | 3 | namespace BD.WTTS.Enums; 4 | 5 | /// 6 | /// HMAC 哈希算法类型 7 | /// 8 | public enum HMACTypes 9 | { 10 | SHA1 = 0, 11 | SHA256 = 1, 12 | SHA512 = 2, 13 | } 14 | -------------------------------------------------------------------------------- /src/WinAuth/BD.WTTS/Models/Abstractions/IAuthenticatorDTO.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace BD.WTTS.Models.Abstractions; 5 | 6 | /// 7 | /// 身份验证器(游戏平台令牌)可传输模型 8 | /// 9 | public interface IAuthenticatorDTO : IOrderAuthenticator, IExplicitHasValue 10 | { 11 | /// 12 | /// 名称最大长度 13 | /// 14 | const int MaxLength_Name = 32; 15 | 16 | /// 17 | /// 名称 18 | /// 19 | string Name { get; set; } 20 | 21 | /// 22 | /// 令牌平添 23 | /// 24 | AuthenticatorPlatform Platform { get; } 25 | 26 | /// 27 | /// 服务器唯一标识 28 | /// 29 | Guid? ServerId { get; set; } 30 | 31 | /// 32 | /// 创建时间 33 | /// 34 | public DateTimeOffset Created { get; set; } 35 | 36 | /// 37 | /// 最后更新时间 38 | /// 39 | public DateTimeOffset LastUpdate { get; set; } 40 | 41 | /// 42 | /// 身份验证器(游戏平台令牌)数据值 43 | /// 44 | IAuthenticatorValueDTO Value { get; set; } 45 | } -------------------------------------------------------------------------------- /src/WinAuth/BD.WTTS/Models/Abstractions/IAuthenticatorValueDTO.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace BD.WTTS.Models.Abstractions; 5 | 6 | /// 7 | /// 身份验证器(游戏平台令牌)数据值可传输模型 8 | /// 9 | [MPUnion((int)AuthenticatorPlatform.BattleNet, typeof(BattleNetAuthenticator))] 10 | [MPUnion((int)AuthenticatorPlatform.Google, typeof(GoogleAuthenticator))] 11 | [MPUnion((int)AuthenticatorPlatform.TOTP, typeof(TOTPAuthenticator))] 12 | [MPUnion((int)AuthenticatorPlatform.HOTP, typeof(HOTPAuthenticator))] 13 | [MPUnion((int)AuthenticatorPlatform.Microsoft, typeof(MicrosoftAuthenticator))] 14 | [MPUnion((int)AuthenticatorPlatform.Steam, typeof(SteamAuthenticator))] 15 | public partial interface IAuthenticatorValueDTO : IExplicitHasValue 16 | { 17 | /// 18 | /// 身份验证器平台 19 | /// 20 | AuthenticatorPlatform Platform { get; } 21 | 22 | /// 23 | /// 本地机器和服务器的时间差(毫秒 ms) 24 | /// 25 | long ServerTimeDiff { get; set; } 26 | 27 | /// 28 | /// 上次同步时间 29 | /// 30 | long LastServerTime { get; set; } 31 | 32 | /// 33 | /// 用于身份验证器的密钥 34 | /// 35 | byte[]? SecretKey { get; set; } 36 | 37 | /// 38 | /// 代码中返回的位数(默认为 6) 39 | /// 40 | int CodeDigits { get; set; } 41 | 42 | /// 43 | /// 用于 OTP 生成的哈希算法(默认为SHA1) 44 | /// 45 | HMACTypes HMACType { get; set; } 46 | 47 | /// 48 | /// 下一个代码的周期(秒) 49 | /// 50 | int Period { get; set; } 51 | } 52 | 53 | [Obsolete("use IAuthenticatorValueDTO", true)] 54 | #pragma warning disable SA1600 // Elements should be documented 55 | public interface IGAPAuthenticatorValueDTO : IAuthenticatorValueDTO 56 | #pragma warning restore SA1600 // Elements should be documented 57 | { 58 | } 59 | -------------------------------------------------------------------------------- /src/WinAuth/BD.WTTS/Models/AuthenticatorDTO.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 2 | 3 | namespace BD.WTTS.Models; 4 | 5 | /// 6 | [MessagePackObject(keyAsPropertyName: true)] 7 | public sealed partial class AuthenticatorDTO : IAuthenticatorDTO 8 | { 9 | /// 10 | /// Construct 11 | /// 12 | public AuthenticatorDTO() 13 | { 14 | Value = new AuthenticatorValueDTO(); 15 | } 16 | 17 | /// 18 | /// 唯一标识符 19 | /// 20 | [MPIgnore, NewtonsoftJsonIgnore, SystemTextJsonIgnore] 21 | public ushort Id { get; set; } 22 | 23 | /// 24 | /// 索引 25 | /// 26 | public int Index { get; set; } 27 | 28 | /// 29 | /// 验证器名称 30 | /// 31 | public string Name { get; set; } = string.Empty; 32 | 33 | /// 34 | /// 身份验证器平台 35 | /// 36 | [MPIgnore, NewtonsoftJsonIgnore, SystemTextJsonIgnore] 37 | public AuthenticatorPlatform Platform => Value == null ? default : Value.Platform; 38 | 39 | /// 40 | /// 服务器唯一标识 41 | /// 42 | public Guid? ServerId { get; set; } 43 | 44 | /// 45 | /// 创建时间 46 | /// 47 | public DateTimeOffset Created { get; set; } 48 | 49 | /// 50 | /// 最后更新时间 51 | /// 52 | public DateTimeOffset LastUpdate { get; set; } 53 | 54 | /// 55 | /// 身份验证器 ValueDto 56 | /// 57 | public IAuthenticatorValueDTO Value { get; set; } 58 | 59 | /// 60 | /// 该验证器是否含有内容 61 | /// 62 | /// 63 | bool IExplicitHasValue.ExplicitHasValue() 64 | { 65 | return !string.IsNullOrEmpty(Name) && Value != null; 66 | } 67 | } -------------------------------------------------------------------------------- /src/WinAuth/BD.WTTS/Models/AuthenticatorExportDTO.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 2 | 3 | namespace BD.WTTS.Models; 4 | 5 | /// 6 | /// 令牌数据轻量化导出模型 7 | /// 8 | [MPObj, MP2Obj(SerializeLayout.Explicit)] 9 | public sealed partial class AuthenticatorExportDTO 10 | { 11 | /// 12 | /// 平台 13 | /// 14 | [MPKey(0), MP2Key(0)] 15 | public AuthenticatorPlatform Platform { get; set; } 16 | 17 | /// 18 | /// 颁发者 19 | /// 20 | [MPKey(1), MP2Key(1)] 21 | public string? Issuer { get; set; } 22 | 23 | /// 24 | /// HMAC 加密类型 25 | /// 26 | [MPKey(2), MP2Key(2)] 27 | public HMACTypes HMACType { get; set; } 28 | 29 | /// 30 | /// BattleNet(战网) 序列号 31 | /// 32 | [MPKey(3), MP2Key(3)] 33 | public string? Serial { get; set; } 34 | 35 | /// 36 | /// Steam 设备唯一标识 37 | /// 38 | [MPKey(4), MP2Key(4)] 39 | public string? DeviceId { get; set; } 40 | 41 | /// 42 | /// Steam 相关数据 43 | /// 44 | [MPKey(5), MP2Key(5)] 45 | public string? SteamData { get; set; } 46 | 47 | /// 48 | /// HOTP 计数器 49 | /// 50 | [MPKey(6), MP2Key(6)] 51 | public long Counter { get; set; } 52 | 53 | /// 54 | /// 下一个代码的周期(秒) 55 | /// 56 | [MPKey(7), MP2Key(7)] 57 | public int Period { get; set; } 58 | 59 | /// 60 | /// 密钥信息 61 | /// 62 | [MPKey(8), MP2Key(8)] 63 | public byte[]? SecretKey { get; set; } 64 | 65 | /// 66 | /// 代码中返回的位数(默认为 6) 67 | /// 68 | [MPKey(9), MP2Key(9)] 69 | public int CodeDigits { get; set; } 70 | 71 | /// 72 | /// 名称 73 | /// 74 | [MPKey(10), MP2Key(10)] 75 | public string Name { get; set; } = string.Empty; 76 | 77 | /// 78 | /// 内部 ToString 重写 79 | /// 80 | /// 81 | public override string ToString() => this.ToUrl(); 82 | } -------------------------------------------------------------------------------- /src/WinAuth/BD.WTTS/Models/AuthenticatorValueDTO.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable IDE0130 // 命名空间与文件夹结构不匹配 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace BD.WTTS.Models; 5 | 6 | public partial class AuthenticatorValueDTO : IAuthenticatorValueDTO 7 | { 8 | /// 9 | /// Construct 10 | /// 11 | public AuthenticatorValueDTO() 12 | { 13 | } 14 | 15 | /// 16 | /// 判断 实例是否具有值 17 | /// 18 | protected virtual bool ExplicitHasValue() 19 | { 20 | return SecretKey != null && CodeDigits > 0 && HMACType.IsDefined() && Period > 0; 21 | } 22 | 23 | /// 24 | /// 判断 实例是否具有值 25 | /// 26 | bool IExplicitHasValue.ExplicitHasValue() => ExplicitHasValue(); 27 | } -------------------------------------------------------------------------------- /src/WinAuth/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /src/WinAuth/Services.Implementation/AuthenticatorNetService.Google.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace WinAuth.Services.Implementation; 3 | 4 | /// 5 | /// 谷歌令牌相关服务实现 6 | /// 7 | public sealed partial class GoogleNetService : IGoogleNetService 8 | { 9 | /// 10 | /// 初始化 类的新实例 11 | /// 12 | public GoogleNetService() 13 | { 14 | } 15 | 16 | /// 17 | /// 用于同步时间的 URL 18 | /// 19 | const string TIME_SYNC_URL = "http://www.google.com"; 20 | 21 | /// 22 | public async Task TimeSync() 23 | { 24 | using var requestMessage = new HttpRequestMessage(HttpMethod.Get, TIME_SYNC_URL) 25 | { 26 | Content = new StringContent(string.Empty, Encoding.UTF8, "text/html"), 27 | }; 28 | using var client = new HttpClient(); 29 | client.Timeout = new TimeSpan(0, 0, 5); 30 | return await client.SendAsync(requestMessage); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/WinAuth/Services.Implementation/AuthenticatorNetService.HOTP.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace WinAuth.Services.Implementation; 3 | 4 | public sealed partial class HOTPNetService : WebApiClientFactoryService, IHOTPNetService 5 | { 6 | private const string Tag = "HOTPNetService"; 7 | 8 | /// 9 | protected override string ClientName => Tag; 10 | 11 | /// 12 | /// 初始化 类的新实例 13 | /// 14 | /// 15 | /// 16 | public HOTPNetService(IServiceProvider serviceProvider, ILoggerFactory loggerFactory) : base(loggerFactory.CreateLogger(Tag), serviceProvider) 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/WinAuth/Services.Implementation/AuthenticatorNetService.Microsoft.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace WinAuth.Services.Implementation; 3 | 4 | public sealed partial class MicrosoftNetService : WebApiClientFactoryService, IMicrosoftNetService 5 | { 6 | private const string Tag = "MicrosoftNetService"; 7 | 8 | /// 9 | protected override string ClientName => Tag; 10 | 11 | /// 12 | /// 初始化 类的新实例 13 | /// 14 | /// 15 | /// 16 | public MicrosoftNetService(IServiceProvider serviceProvider, ILoggerFactory loggerFactory) : base(loggerFactory.CreateLogger(Tag), serviceProvider) 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/WinAuth/Services.Implementation/AuthenticatorNetService.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace WinAuth.Services.Implementation; 3 | 4 | /// 5 | /// 提供身份验证器服务 6 | /// 7 | public static class AuthenticatorNetService 8 | { 9 | private static readonly IServiceProvider _serviceProvider = Ioc.Get(); 10 | private static readonly ILoggerFactory _loggerFactory = Ioc.Get(); 11 | 12 | /// 13 | /// 服务实例 14 | /// 15 | public static BattleNetService BattleNet = new BattleNetService(_serviceProvider, _loggerFactory); 16 | 17 | /// 18 | /// 服务实例 19 | /// 20 | public static GoogleNetService Google = new GoogleNetService(); 21 | 22 | /// 23 | /// 服务实例 24 | /// 25 | public static HOTPNetService HOTP = new HOTPNetService(_serviceProvider, _loggerFactory); 26 | 27 | /// 28 | /// 服务实例 29 | /// 30 | public static MicrosoftNetService Microsoft = new MicrosoftNetService(_serviceProvider, _loggerFactory); 31 | } 32 | -------------------------------------------------------------------------------- /src/WinAuth/Services/IAuthenticatorNetService.BattleNet.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace WinAuth.Services; 3 | 4 | /// 5 | /// 战网令牌相关服务 6 | /// 7 | public interface IBattleNetService 8 | { 9 | /// 10 | /// 地理位置 IP 11 | /// 12 | /// 13 | Task GEOIP(); 14 | 15 | /// 16 | /// 令牌添加 17 | /// 18 | /// 19 | /// 20 | /// 21 | Task EnRoll(string region, byte[] encrypted); 22 | 23 | /// 24 | /// 令牌同步 25 | /// 26 | /// 27 | /// 28 | HttpResponseMessage? Sync(string region); 29 | 30 | /// 31 | /// 令牌恢复 32 | /// 33 | /// 34 | /// 35 | /// 36 | Task ReStore(string serial, byte[] serialBytes); 37 | 38 | /// 39 | /// 令牌恢复验证 40 | /// 41 | /// 42 | /// 43 | /// 44 | Task ReStoreValidate(string serial, byte[] postbytes); 45 | } 46 | -------------------------------------------------------------------------------- /src/WinAuth/Services/IAuthenticatorNetService.Google.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace WinAuth.Services; 3 | 4 | /// 5 | /// 谷歌令牌相关服务 6 | /// 7 | public interface IGoogleNetService 8 | { 9 | /// 10 | /// 同步时间 11 | /// 12 | /// 13 | Task TimeSync(); 14 | } 15 | -------------------------------------------------------------------------------- /src/WinAuth/Services/IAuthenticatorNetService.HOTP.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace WinAuth.Services; 3 | 4 | #pragma warning disable SA1600 // Elements should be documented 5 | 6 | public interface IHOTPNetService 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/WinAuth/Services/IAuthenticatorNetService.Microsoft.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace WinAuth.Services; 3 | 4 | #pragma warning disable SA1600 // Elements should be documented 5 | 6 | public interface IMicrosoftNetService 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/WinAuth/WinAuth/IAuthenticator.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace BD.WTTS.Models.Abstractions; 3 | 4 | partial interface IAuthenticatorValueDTO 5 | { 6 | /// 7 | /// 使用当前加密和/或密码保存的当前数据(可能为无) 8 | /// 9 | string? EncryptedData { get; set; } 10 | 11 | /// 12 | /// 服务器时间戳 13 | /// 14 | long ServerTime { get; } 15 | 16 | /// 17 | /// 用于加密机密数据的密码类型 18 | /// 19 | public enum PasswordTypes 20 | { 21 | None = 0, 22 | Explicit = 1, 23 | User = 2, 24 | Machine = 4, 25 | YubiKeySlot1 = 8, 26 | YubiKeySlot2 = 16, 27 | } 28 | 29 | /// 30 | /// 用于加密机密数据的密码类型 31 | /// 32 | PasswordTypes PasswordType { get; set; } 33 | 34 | /// 35 | /// 是否必须密码 36 | /// 37 | bool RequiresPassword { get; } 38 | 39 | /// 40 | /// 发行者名称 41 | /// 42 | string? Issuer { get; set; } 43 | 44 | /// 45 | /// 获取/设置组合的机密数据值 46 | /// 47 | string? SecretData { get; set; } 48 | 49 | /// 50 | /// 根据计算的服务器时间计算代码间隔 51 | /// 52 | long CodeInterval { get; } 53 | 54 | /// 55 | /// 获取验证器的当前代码 56 | /// 57 | string CurrentCode { get; } 58 | 59 | /// 60 | /// 将此验证器的时间与服务器时间同步,我们用 UTC 时间的差值更新数据记录 61 | /// 62 | void Sync(); 63 | 64 | /// 65 | /// 令牌保护 66 | /// 67 | void Protect(); 68 | 69 | /// 70 | /// 取消令牌保护 71 | /// 72 | /// 73 | /// 74 | bool Unprotect(string? password); 75 | 76 | /// 77 | /// Xml 内容读取 78 | /// 79 | /// 80 | /// 81 | /// 82 | bool ReadXml(XmlReader reader, string? password = null); 83 | } -------------------------------------------------------------------------------- /src/WinAuth/WinAuth/MicrosoftAuthenticator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Colin Mackie. 3 | * This software is distributed under the terms of the GNU General Public License. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | namespace WinAuth.WinAuth; 20 | 21 | /// 22 | /// 微软身份验证 23 | /// 24 | [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] 25 | [MessagePackObject(keyAsPropertyName: true)] 26 | public sealed class MicrosoftAuthenticator : GoogleAuthenticator 27 | { 28 | /// 29 | /// 初始化 类的新实例 30 | /// 31 | [SerializationConstructor] 32 | public MicrosoftAuthenticator() : base() 33 | { 34 | } 35 | 36 | /// 37 | [IgnoreDataMember] 38 | [MPIgnore] 39 | #if __HAVE_N_JSON__ 40 | [NewtonsoftJsonIgnore] 41 | #endif 42 | #if !__NOT_HAVE_S_JSON__ 43 | [SystemTextJsonIgnore] 44 | #endif 45 | public override AuthenticatorPlatform Platform => AuthenticatorPlatform.Microsoft; 46 | } 47 | -------------------------------------------------------------------------------- /src/WinAuth/WinAuth/TOTPAuthenticator.cs: -------------------------------------------------------------------------------- 1 | namespace WinAuth.WinAuth; 2 | 3 | /// 4 | /// TOTP 身份验证 5 | /// 6 | public class TOTPAuthenticator : GoogleAuthenticator 7 | { 8 | /// 9 | /// 初始化 类的新实例 10 | /// 11 | [SerializationConstructor] 12 | public TOTPAuthenticator() : base() 13 | { 14 | } 15 | 16 | /// 17 | [IgnoreDataMember] 18 | [MPIgnore] 19 | #if __HAVE_N_JSON__ 20 | [NewtonsoftJsonIgnore] 21 | #endif 22 | #if !__NOT_HAVE_S_JSON__ 23 | [SystemTextJsonIgnore] 24 | #endif 25 | public override AuthenticatorPlatform Platform => AuthenticatorPlatform.TOTP; 26 | 27 | /// 28 | public override void Sync() 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /toc.yml: -------------------------------------------------------------------------------- 1 | - name: 文章 2 | href: doc/ 3 | - name: API 文档 4 | href: api/ 5 | homepage: api/index.html 6 | - name: Common 7 | href: https://beyonddimension.github.io/Common/doc/Code-Style.html 8 | - name: Avalonia8 9 | href: https://beyonddimension.github.io/Avalonia8 10 | - name: Watt Toolkit 11 | href: https://steampp.net/ 12 | - name: WattGame 13 | href: https://shop.steampp.net/ --------------------------------------------------------------------------------