├── .gitignore ├── LICENSE ├── Privacy.md ├── README.md ├── Xunkong.Widget.sln ├── Xunkong.Widget ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── Images │ │ ├── Domain_64.png │ │ ├── Transparent.png │ │ ├── UI_EmotionIcon2.png │ │ ├── UI_EmotionIcon5.png │ │ ├── UI_Icon_Intee_Explore_1.png │ │ ├── UI_ItemIcon_201.png │ │ ├── UI_ItemIcon_202.png │ │ ├── UI_ItemIcon_204.png │ │ ├── UI_ItemIcon_210.png │ │ ├── UI_ItemIcon_211.png │ │ ├── UI_ItemIcon_220021_64.png │ │ └── UI_NPCTopIcon_QuestEvent_64.png │ ├── LargeTile.scale-100.png │ ├── LargeTile.scale-125.png │ ├── LargeTile.scale-150.png │ ├── LargeTile.scale-200.png │ ├── SmallTile.scale-100.png │ ├── SmallTile.scale-125.png │ ├── SmallTile.scale-150.png │ ├── SmallTile.scale-200.png │ ├── SplashScreen.scale-100.png │ ├── SplashScreen.scale-125.png │ ├── SplashScreen.scale-150.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-100.png │ ├── Square150x150Logo.scale-125.png │ ├── Square150x150Logo.scale-150.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-16.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-24.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-32.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-48.png │ ├── Square44x44Logo.altform-unplated_targetsize-16.png │ ├── Square44x44Logo.altform-unplated_targetsize-32.png │ ├── Square44x44Logo.altform-unplated_targetsize-48.png │ ├── Square44x44Logo.scale-100.png │ ├── Square44x44Logo.scale-125.png │ ├── Square44x44Logo.scale-150.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-16.png │ ├── Square44x44Logo.targetsize-24.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── Square44x44Logo.targetsize-32.png │ ├── Square44x44Logo.targetsize-48.png │ ├── StoreLogo.backup.png │ ├── StoreLogo.scale-100.png │ ├── StoreLogo.scale-125.png │ ├── StoreLogo.scale-150.png │ ├── StoreLogo.scale-200.png │ ├── Wide310x150Logo.scale-100.png │ ├── Wide310x150Logo.scale-125.png │ ├── Wide310x150Logo.scale-150.png │ └── Wide310x150Logo.scale-200.png ├── Controls │ ├── UserCard.xaml │ ├── UserCard.xaml.cs │ ├── XboxWidgetUserCard.xaml │ └── XboxWidgetUserCard.xaml.cs ├── Converters │ ├── BoolToVisibilityConverter.cs │ ├── DateTimeOffsetToTimeStringConverter.cs │ ├── ExpeditionStatusToColorConverter.cs │ ├── ObjToBoolStringConverter.cs │ ├── ObjectToVisibilityConverter.cs │ └── QuestEventStatsConverter.cs ├── Hoyolab │ ├── Account │ │ ├── GenshinPlayerInfo.cs │ │ ├── GenshinRoleInfoWrapper.cs │ │ ├── HoyolabUserInfo.cs │ │ ├── HoyolabUserInfoWrapper.cs │ │ ├── SignInInfo.cs │ │ └── SignTodayJsonConverter.cs │ ├── Avatar │ │ ├── AvatarCalculate.cs │ │ ├── AvatarConstellation.cs │ │ ├── AvatarCostume.cs │ │ ├── AvatarDetail.cs │ │ ├── AvatarDetailWrapper.cs │ │ ├── AvatarInfo.cs │ │ ├── AvatarReliquary.cs │ │ ├── AvatarSkill.cs │ │ ├── AvatarWeapon.cs │ │ ├── ReliquaryAffix.cs │ │ └── ReliquarySet.cs │ ├── Core │ │ ├── ElementType.cs │ │ ├── EnumExtension.cs │ │ ├── RegionHelper.cs │ │ ├── RegionType.cs │ │ ├── WeaponType.cs │ │ └── XunkongException.cs │ ├── DailyNote │ │ ├── DailyNoteInfo.cs │ │ ├── Expedition.cs │ │ ├── RecoveryTimeJsonConverter.cs │ │ ├── Transformer.cs │ │ └── TransformerRecoveryTime.cs │ ├── DynamicSecret.cs │ ├── GameRecord │ │ ├── GameRecordSummary.cs │ │ ├── PlayerRiskStats.cs │ │ ├── PotHome.cs │ │ ├── WorldExploration.cs │ │ ├── WorldExplorationOffering.cs │ │ └── WorldExplorationRewardType.cs │ ├── HoyolabBaseWrapper.cs │ ├── HoyolabClient.cs │ ├── HoyolabException.cs │ ├── HoyolabJsonContext.cs │ ├── News │ │ ├── NewsDetailWrapper.cs │ │ ├── NewsItem.cs │ │ ├── NewsListWrapper.cs │ │ ├── NewsPost.cs │ │ ├── NewsTimeJsonConverter.cs │ │ └── NewsType.cs │ ├── SpiralAbyss │ │ ├── SpiralAbyssAvatar.cs │ │ ├── SpiralAbyssBattle.cs │ │ ├── SpiralAbyssFloor.cs │ │ ├── SpiralAbyssInfo.cs │ │ ├── SpiralAbyssLevel.cs │ │ ├── SpiralAbyssRank.cs │ │ └── SpiralAbyssTimeJsonConverter.cs │ ├── TravelNotes │ │ ├── TravelNotesAwardItem.cs │ │ ├── TravelNotesAwardType.cs │ │ ├── TravelNotesBase.cs │ │ ├── TravelNotesDateJsonConverter.cs │ │ ├── TravelNotesDateTimeJsonConverter.cs │ │ ├── TravelNotesDayData.cs │ │ ├── TravelNotesDetail.cs │ │ ├── TravelNotesMonthData.cs │ │ ├── TravelNotesPrimogemsMonthGroupStats.cs │ │ └── TravelNotesSummary.cs │ └── Wishlog │ │ ├── QueryParam.cs │ │ ├── WishEventInfo.cs │ │ ├── WishType.cs │ │ ├── WishTypeJsonConverter.cs │ │ ├── WishlogClient.cs │ │ ├── WishlogItem.cs │ │ ├── WishlogJsonContext.cs │ │ └── WishlogWrapper.cs ├── MainPage.xaml ├── MainPage.xaml.cs ├── Models │ └── UserInfo.cs ├── Package.appxmanifest ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml ├── Services │ ├── DatabaseService.cs │ ├── DatabaseSql.cs │ ├── HoyolabService.cs │ ├── RefreshTileBackgroundTask.cs │ └── TileService.cs ├── XBoxWidgetPage.xaml ├── XBoxWidgetPage.xaml.cs └── Xunkong.Widget.csproj └── img ├── Snipaste_20220625_204008.webp └── Snipaste_20220625_204040.webp /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 寻空 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Privacy.md: -------------------------------------------------------------------------------- 1 | # 隐私政策 2 | 3 | 更新日期:**2022/6/28** 4 | 5 | 生效日期:**2022/6/28** 6 | 7 | ## 导言 8 | 9 | _寻空小组件_ 是一款由 _Scighost_ (以下简称“我们”)提供的产品。 您在使用我们的服务时,我们可能会收集和使用您的相关信息。我们希望通过本《隐私政策》向您说明,在使用我们的服务时,我们如何收集、使用、储存和分享这些信息,以及我们为您提供的访问、更新、控制和保护这些信息的方式。 本《隐私政策》与您所使用的 _寻空小组件_ 服务息息相关,希望您仔细阅读,在需要时,按照本《隐私政策》的指引,作出您认为适当的选择。本《隐私政策》中涉及的相关技术词汇,我们尽量以简明扼要的表述,并提供进一步说明的链接,以便您的理解。 10 | 11 | **您使用或继续使用我们的服务,即意味着同意我们按照本《隐私政策》收集、使用、储存和分享您的相关信息。** 12 | 13 | 如对本《隐私政策》或相关事宜有任何问题,请通过 **scighost@outlook.com** 与我们联系。 14 | 15 | ## 1. 我们收集的信息 16 | 17 | 我们或我们的第三方合作伙伴提供服务时,可能会收集、储存和使用下列与您有关的信息。如果您不提供相关信息,可能无法注册成为我们的用户或无法享受我们提供的某些服务,或者无法达到相关服务拟达到的效果。 18 | 19 | ## 2. 信息的存储 20 | 21 | **2.1 信息存储的方式和期限** 22 | 23 | - 我们会通过安全的方式存储您的信息,包括本地存储(例如利用APP进行数据缓存)、数据库和服务器日志。 24 | - 一般情况下,我们只会在为实现服务目的所必需的时间内或法律法规规定的条件下存储您的个人信息。 25 | 26 | **2.2 信息存储的地域** 27 | 28 | - 我们会按照法律法规规定,将境内收集的用户个人信息存储于中国境内。 29 | - 目前我们不会跨境传输或存储您的个人信息。将来如需跨境传输或存储的,我们会向您告知信息出境的目的、接收方、安全保证措施和安全风险,并征得您的同意。 30 | 31 | **2.3 产品或服务停止运营时的通知** 32 | 33 | - 当我们的产品或服务发生停止运营的情况时,我们将以推送通知、公告等形式通知您,并在合理期限内删除您的个人信息或进行匿名化处理,法律法规另有规定的除外。 34 | 35 | ## 3. 信息安全 36 | 37 | 我们使用各种安全技术和程序,以防信息的丢失、不当使用、未经授权阅览或披露。例如,在某些服务中,我们将利用加密技术(例如SSL)来保护您提供的个人信息。但请您理解,由于技术的限制以及可能存在的各种恶意手段,在互联网行业,即便竭尽所能加强安全措施,也不可能始终保证信息百分之百的安全。您需要了解,您接入我们的服务所用的系统和通讯网络,有可能因我们可控范围外的因素而出现问题。 38 | 39 | ## 4. 我们如何使用信息 40 | 41 | 我们可能将在向您提供服务的过程之中所收集的信息用作下列用途: 42 | 43 | - 向您提供服务; 44 | - 在我们提供服务时,用于身份验证、客户服务、安全防范、诈骗监测、存档和备份用途,确保我们向您提供的产品和服务的安全性; 45 | - 帮助我们设计新服务,改善我们现有服务; 46 | - 使我们更加了解您如何接入和使用我们的服务,从而针对性地回应您的个性化需求,例如语言设定、位置设定、个性化的帮助服务和指示,或对您和其他用户作出其他方面的回应; 47 | - 向您提供与您更加相关的广告以替代普遍投放的广告; 48 | - 评估我们服务中的广告和其他促销及推广活动的效果,并加以改善; 49 | - 软件认证或管理软件升级; 50 | - 让您参与有关我们产品和服务的调查。 51 | 52 | ## 5. 信息共享 53 | 54 | 目前,我们不会主动共享或转让您的个人信息至第三方,如存在其他共享或转让您的个人信息或您需要我们将您的个人信息共享或转让至第三方情形时,我们会直接或确认第三方征得您对上述行为的明示同意。 55 | 56 | 为了投放广告,评估、优化广告投放效果等目的,我们需要向广告主及其代理商等第三方合作伙伴共享您的部分数据,要求其严格遵守我们关于数据隐私保护的措施与要求,包括但不限于根据数据保护协议、承诺书及相关数据处理政策进行处理,避免识别出个人身份,保障隐私安全。 57 | 58 | 我们不会向合作伙伴分享可用于识别您个人身份的信息(例如您的姓名或电子邮件地址),除非您明确授权。 59 | 60 | 我们不会对外公开披露所收集的个人信息,如必须公开披露时,我们会向您告知此次公开披露的目的、披露信息的类型及可能涉及的敏感信息,并征得您的明示同意。 61 | 62 | 随着我们业务的持续发展,我们有可能进行合并、收购、资产转让等交易,我们将告知您相关情形,按照法律法规及不低于本《隐私政策》所要求的标准继续保护或要求新的控制者继续保护您的个人信息。 63 | 64 | 另外,根据相关法律法规及国家标准,以下情形中,我们可能会共享、转让、公开披露个人信息无需事先征得您的授权同意: 65 | 66 | - 与国家安全、国防安全直接相关的; 67 | - 与公共安全、公共卫生、重大公共利益直接相关的; 68 | - 犯罪侦查、起诉、审判和判决执行等直接相关的; 69 | - 出于维护个人信息主体或其他个人的生命、财产等重大合法权益但又很难得到本人同意的; 70 | - 个人信息主体自行向社会公众公开个人信息的; 71 | - 从合法公开披露的信息中收集个人信息的,如合法的新闻报道、政府信息公开等渠道。 72 | 73 | ## 6. 您的权利 74 | 75 | 在您使用我们的服务期间,我们可能会视产品具体情况为您提供相应的操作设置,以便您可以查询、删除、更正或撤回您的相关个人信息,您可参考相应的具体指引进行操作。此外,我们还设置了投诉举报渠道,您的意见将会得到及时的处理。如果您无法通过上述途径和方式行使您的个人信息主体权利,您可以通过本《隐私政策》中提供的联系方式提出您的请求,我们会按照法律法规的规定予以反馈。 76 | 77 | ## 7. 变更 78 | 79 | 我们可能适时修订本《隐私政策》的条款。当变更发生时,我们会在版本更新时向您提示新的《隐私政策》,并向您说明生效日期。请您仔细阅读变更后的《隐私政策》内容,**若您继续使用我们的服务,即表示您同意我们按照更新后的《隐私政策》处理您的个人信息。** 80 | 81 | ## 8. 未成年人保护 82 | 83 | 我们鼓励父母或监护人指导未满十八岁的未成年人使用我们的服务。我们建议未成年人鼓励他们的父母或监护人阅读本《隐私政策》,并建议未成年人在提交的个人信息之前寻求父母或监护人的同意和指导。 84 | 85 | ## 9. 补充 86 | 87 | **以上内容由模板生成,具体到本应用, _寻空小组件_ 仅会在您的电脑上存储您的个人信息,且不会向寻空服务器和除米哈游以外的任何第三方发送您的个人信息。** 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 寻空小组件 2 | 3 | > 系统升 Win11 了,没有磁贴很不适应,于是把目光转向了 Xbox Game Bar 4 | 5 | 支持 **普通窗口** ,**Xbox Game Bar** ,**Win10 磁贴** 6 | 7 | ## 下载 8 | 9 | [Microsoft Store](https://www.microsoft.com/store/apps/9PHN021FKW2T) (推荐) 10 | 11 | [GitHub Releases](https://github.com/xunkong/widget/releases) 12 | 13 | ## 使用方法 14 | 15 | 懂得都懂,不懂的看[这个](https://xunkong.cc/help/desktop/account.html) 16 | 17 | ## 截图 18 | 19 | **普通窗口** 20 | 21 | ![普通窗口](img/Snipaste_20220625_204008.webp) 22 | 23 | **Xbox Game Bar** 24 | 25 | ![Xbox Game Bar](img/Snipaste_20220625_204040.webp) 26 | 27 | **Win10 磁贴** 28 | 29 | 图略 30 | 31 | ## 其他 32 | 33 | 应用图标来源:[Bilibili@QuAn__](https://t.bilibili.com/575371497058829825) 34 | 35 | [隐私策略](./Privacy.md) 36 | -------------------------------------------------------------------------------- /Xunkong.Widget.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.2.32526.322 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xunkong.Widget", "Xunkong.Widget\Xunkong.Widget.csproj", "{B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|ARM = Debug|ARM 11 | Debug|ARM64 = Debug|ARM64 12 | Debug|x64 = Debug|x64 13 | Debug|x86 = Debug|x86 14 | Release|ARM = Release|ARM 15 | Release|ARM64 = Release|ARM64 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|ARM.ActiveCfg = Debug|ARM 21 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|ARM.Build.0 = Debug|ARM 22 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|ARM.Deploy.0 = Debug|ARM 23 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|ARM64.ActiveCfg = Debug|ARM64 24 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|ARM64.Build.0 = Debug|ARM64 25 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|ARM64.Deploy.0 = Debug|ARM64 26 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|x64.ActiveCfg = Debug|x64 27 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|x64.Build.0 = Debug|x64 28 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|x64.Deploy.0 = Debug|x64 29 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|x86.ActiveCfg = Debug|x86 30 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|x86.Build.0 = Debug|x86 31 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Debug|x86.Deploy.0 = Debug|x86 32 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|ARM.ActiveCfg = Release|ARM 33 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|ARM.Build.0 = Release|ARM 34 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|ARM.Deploy.0 = Release|ARM 35 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|ARM64.ActiveCfg = Release|ARM64 36 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|ARM64.Build.0 = Release|ARM64 37 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|ARM64.Deploy.0 = Release|ARM64 38 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|x64.ActiveCfg = Release|x64 39 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|x64.Build.0 = Release|x64 40 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|x64.Deploy.0 = Release|x64 41 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|x86.ActiveCfg = Release|x86 42 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|x86.Build.0 = Release|x86 43 | {B67C7ABF-5BAA-4FDF-9A52-C7D0A6C0A1B9}.Release|x86.Deploy.0 = Release|x86 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {05092D3D-0E5B-4FA6-B4B2-3E71067A9320} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /Xunkong.Widget/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | #9E000000 15 | 16 | ms-appx:///Assets/Images/Domain_64.png 17 | ms-appx:///Assets/Images/UI_ItemIcon_210.png 18 | ms-appx:///Assets/Images/UI_ItemIcon_211.png 19 | ms-appx:///Assets/Images/UI_ItemIcon_204.png 20 | ms-appx:///Assets/Images/UI_ItemIcon_220021_64.png 21 | ms-appx:///Assets/Images/UI_NPCTopIcon_QuestEvent_64.png 22 | ms-appx:///Assets/Images/UI_ItemIcon_201.png 23 | ms-appx:///Assets/Images/UI_ItemIcon_202.png 24 | ms-appx:///Assets/Images/UI_EmotionIcon5.png 25 | ms-appx:///Assets/Images/UI_Icon_Intee_Explore_1.png 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Xunkong.Widget/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Gaming.XboxGameBar; 2 | using System; 3 | using System.IO; 4 | using Windows.ApplicationModel; 5 | using Windows.ApplicationModel.Activation; 6 | using Windows.Storage; 7 | using Windows.UI.Xaml; 8 | using Windows.UI.Xaml.Controls; 9 | using Windows.UI.Xaml.Navigation; 10 | using Xunkong.Widget.Services; 11 | 12 | namespace Xunkong.Widget 13 | { 14 | /// 15 | /// 提供特定于应用程序的行为,以补充默认的应用程序类。 16 | /// 17 | sealed partial class App : Application 18 | { 19 | /// 20 | /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行, 21 | /// 已执行,逻辑上等同于 main() 或 WinMain()。 22 | /// 23 | public App() 24 | { 25 | this.InitializeComponent(); 26 | this.Suspending += OnSuspending; 27 | AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; 28 | } 29 | 30 | private void CurrentDomain_UnhandledException(object sender, System.UnhandledExceptionEventArgs e) 31 | { 32 | if (e.ExceptionObject is Exception ex) 33 | { 34 | var file = Path.Combine(ApplicationData.Current.LocalFolder.Path, $"Crash/crash_{DateTimeOffset.Now:yyyyMMdd_HHmmss}.txt"); 35 | Directory.CreateDirectory(Path.GetDirectoryName(file)); 36 | File.WriteAllText(file, ex.ToString()); 37 | } 38 | } 39 | 40 | /// 41 | /// 在应用程序由最终用户正常启动时进行调用。 42 | /// 将在启动应用程序以打开特定文件等情况下使用。 43 | /// 44 | /// 有关启动请求和过程的详细信息。 45 | protected override void OnLaunched(LaunchActivatedEventArgs e) 46 | { 47 | Frame rootFrame = Window.Current.Content as Frame; 48 | 49 | // 不要在窗口已包含内容时重复应用程序初始化, 50 | // 只需确保窗口处于活动状态 51 | if (rootFrame == null) 52 | { 53 | // 创建要充当导航上下文的框架,并导航到第一页 54 | rootFrame = new Frame(); 55 | 56 | rootFrame.NavigationFailed += OnNavigationFailed; 57 | 58 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 59 | { 60 | //TODO: 从之前挂起的应用程序加载状态 61 | } 62 | 63 | // 将框架放在当前窗口中 64 | Window.Current.Content = rootFrame; 65 | } 66 | 67 | if (e.PrelaunchActivated == false) 68 | { 69 | if (rootFrame.Content == null) 70 | { 71 | // 当导航堆栈尚未还原时,导航到第一页, 72 | // 并通过将所需信息作为导航参数传入来配置 73 | // 参数 74 | rootFrame.Navigate(typeof(MainPage), e); 75 | } 76 | // 确保当前窗口处于活动状态 77 | Window.Current.Activate(); 78 | } 79 | } 80 | 81 | /// 82 | /// 导航到特定页失败时调用 83 | /// 84 | ///导航失败的框架 85 | ///有关导航失败的详细信息 86 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 87 | { 88 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 89 | } 90 | 91 | /// 92 | /// 在将要挂起应用程序执行时调用。 在不知道应用程序 93 | /// 无需知道应用程序会被终止还是会恢复, 94 | /// 并让内存内容保持不变。 95 | /// 96 | /// 挂起的请求的源。 97 | /// 有关挂起请求的详细信息。 98 | private void OnSuspending(object sender, SuspendingEventArgs e) 99 | { 100 | var deferral = e.SuspendingOperation.GetDeferral(); 101 | //TODO: 保存应用程序状态并停止任何后台活动 102 | xboxWidget = null; 103 | deferral.Complete(); 104 | } 105 | 106 | 107 | 108 | protected override async void OnBackgroundActivated(BackgroundActivatedEventArgs args) 109 | { 110 | base.OnBackgroundActivated(args); 111 | var deferral = args.TaskInstance.GetDeferral(); 112 | await RefreshTileBackgroundTask.RefreshTileAsync(); 113 | deferral.Complete(); 114 | } 115 | 116 | 117 | 118 | private XboxGameBarWidget xboxWidget = null; 119 | private XBoxWidgetPage xboxWidgetPage = null; 120 | 121 | protected override void OnActivated(IActivatedEventArgs args) 122 | { 123 | XboxGameBarWidgetActivatedEventArgs widgetArgs = null; 124 | if (args.Kind == ActivationKind.Protocol) 125 | { 126 | var protocolArgs = args as IProtocolActivatedEventArgs; 127 | string scheme = protocolArgs.Uri.Scheme; 128 | if (scheme.Equals("ms-gamebarwidget")) 129 | { 130 | widgetArgs = args as XboxGameBarWidgetActivatedEventArgs; 131 | } 132 | } 133 | if (widgetArgs != null) 134 | { 135 | // 136 | // Activation Notes: 137 | // 138 | // If IsLaunchActivation is true, this is Game Bar launching a new instance 139 | // of our widget. This means we have a NEW CoreWindow with corresponding UI 140 | // dispatcher, and we MUST create and hold onto a new XboxGameBarWidget. 141 | // 142 | // Otherwise this is a subsequent activation coming from Game Bar. We MUST 143 | // continue to hold the XboxGameBarWidget created during initial activation 144 | // and ignore this repeat activation, or just observe the URI command here and act 145 | // accordingly. It is ok to perform a navigate on the root frame to switch 146 | // views/pages if needed. Game Bar lets us control the URI for sending widget to 147 | // widget commands or receiving a command from another non-widget process. 148 | // 149 | // Important Cleanup Notes: 150 | // When our widget is closed--by Game Bar or us calling XboxGameBarWidget.Close()-, 151 | // the CoreWindow will get a closed event. We can register for Window.Closed 152 | // event to know when our particular widget has shutdown, and cleanup accordingly. 153 | // 154 | // NOTE: If a widget's CoreWindow is the LAST CoreWindow being closed for the process 155 | // then we won't get the Window.Closed event. However, we will get the OnSuspending 156 | // call and can use that for cleanup. 157 | // 158 | if (widgetArgs.IsLaunchActivation) 159 | { 160 | var rootFrame = new Frame(); 161 | rootFrame.NavigationFailed += OnNavigationFailed; 162 | Window.Current.Content = rootFrame; 163 | 164 | // Create Game Bar widget object which bootstraps the connection with Game Bar 165 | xboxWidget = new XboxGameBarWidget( 166 | widgetArgs, 167 | Window.Current.CoreWindow, 168 | rootFrame); 169 | xboxWidget.GameBarDisplayModeChanged += XBoxWidget_GameBarDisplayModeChanged; 170 | rootFrame.Navigate(typeof(XBoxWidgetPage)); 171 | 172 | if (rootFrame.Content is XBoxWidgetPage page) 173 | { 174 | xboxWidgetPage = page; 175 | } 176 | 177 | Window.Current.Closed += XboxWidget_Closed; 178 | 179 | Window.Current.Activate(); 180 | } 181 | else 182 | { 183 | // You can perform whatever behavior you need based on the URI payload. 184 | if (Window.Current.Content is Frame frame) 185 | { 186 | if (frame.Content is XBoxWidgetPage page) 187 | { 188 | 189 | } 190 | } 191 | } 192 | } 193 | } 194 | 195 | 196 | 197 | private async void XBoxWidget_GameBarDisplayModeChanged(XboxGameBarWidget sender, object args) 198 | { 199 | await xboxWidgetPage.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, async () => await xboxWidgetPage.RefreshAsync()); 200 | } 201 | 202 | private void XboxWidget_Closed(object sender, Windows.UI.Core.CoreWindowEventArgs e) 203 | { 204 | xboxWidget = null; 205 | Window.Current.Closed -= XboxWidget_Closed; 206 | } 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/Domain_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/Domain_64.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/Transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/Transparent.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_EmotionIcon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_EmotionIcon2.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_EmotionIcon5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_EmotionIcon5.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_Icon_Intee_Explore_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_Icon_Intee_Explore_1.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_ItemIcon_201.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_ItemIcon_201.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_ItemIcon_202.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_ItemIcon_202.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_ItemIcon_204.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_ItemIcon_204.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_ItemIcon_210.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_ItemIcon_210.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_ItemIcon_211.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_ItemIcon_211.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_ItemIcon_220021_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_ItemIcon_220021_64.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Images/UI_NPCTopIcon_QuestEvent_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Images/UI_NPCTopIcon_QuestEvent_64.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/LargeTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/LargeTile.scale-100.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/LargeTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/LargeTile.scale-125.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/LargeTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/LargeTile.scale-150.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/LargeTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/LargeTile.scale-200.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/SmallTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/SmallTile.scale-100.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/SmallTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/SmallTile.scale-125.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/SmallTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/SmallTile.scale-150.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/SmallTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/SmallTile.scale-200.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/SplashScreen.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/SplashScreen.scale-125.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/SplashScreen.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/SplashScreen.scale-150.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square150x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square150x150Logo.scale-100.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square150x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square150x150Logo.scale-125.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square150x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square150x150Logo.scale-150.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.altform-unplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.altform-unplated_targetsize-16.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.altform-unplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.altform-unplated_targetsize-32.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.altform-unplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.altform-unplated_targetsize-48.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.scale-100.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.scale-125.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.scale-150.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.targetsize-16.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.targetsize-24.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.targetsize-32.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Square44x44Logo.targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Square44x44Logo.targetsize-48.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/StoreLogo.backup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/StoreLogo.backup.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/StoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/StoreLogo.scale-100.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/StoreLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/StoreLogo.scale-125.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/StoreLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/StoreLogo.scale-150.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/StoreLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/StoreLogo.scale-200.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Wide310x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Wide310x150Logo.scale-100.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Wide310x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Wide310x150Logo.scale-125.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Wide310x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Wide310x150Logo.scale-150.png -------------------------------------------------------------------------------- /Xunkong.Widget/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xunkong/widget/19500a2f3d93ab0e697f9e6fb5c473629cc4c774/Xunkong.Widget/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /Xunkong.Widget/Controls/UserCard.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Runtime.CompilerServices; 4 | using Windows.UI.Xaml; 5 | using Windows.UI.Xaml.Controls; 6 | using Xunkong.Widget.Models; 7 | using Xunkong.Widget.Services; 8 | 9 | //https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板 10 | 11 | namespace Xunkong.Widget.Controls 12 | { 13 | public sealed partial class UserCard : UserControl, INotifyPropertyChanged 14 | { 15 | public event PropertyChangedEventHandler PropertyChanged = delegate { }; 16 | private void OnPropertyChanged([CallerMemberName] string propertyName = "") 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | 22 | 23 | public Visibility IsPinButtonVisible => Environment.OSVersion.Version < new Version("10.0.22000.0") ? Visibility.Visible : Visibility.Collapsed; 24 | 25 | 26 | 27 | private UserInfo _UserInfo; 28 | public UserInfo UserInfo 29 | { 30 | get { return _UserInfo; } 31 | set 32 | { 33 | _UserInfo = value; 34 | OnPropertyChanged(); 35 | } 36 | } 37 | 38 | 39 | public UserCard() 40 | { 41 | this.InitializeComponent(); 42 | } 43 | 44 | 45 | 46 | public event EventHandler Deleted; 47 | 48 | private async void MenuItem_Pin_Click(object sender, RoutedEventArgs e) 49 | { 50 | try 51 | { 52 | if (Environment.OSVersion.Version < new Version("10.0.22000.0")) 53 | { 54 | await TileService.RequestPinTileAsync(UserInfo.DailyNoteInfo); 55 | await RefreshTileBackgroundTask.RegisterTaskAsync(); 56 | } 57 | } 58 | catch { } 59 | } 60 | 61 | 62 | 63 | private void MenuItem_Delete_Click(object sender, RoutedEventArgs e) 64 | { 65 | Deleted?.Invoke(this, UserInfo); 66 | } 67 | 68 | 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Xunkong.Widget/Controls/XboxWidgetUserCard.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 49 | 50 | 51 | 52 | 53 | 56 | 61 | 62 | 67 | 71 | 72 | 73 | 74 | 75 | 76 | 81 | 82 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 109 | 113 | 114 | 115 | 116 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 132 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /Xunkong.Widget/Controls/XboxWidgetUserCard.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.CompilerServices; 3 | using Windows.UI.Xaml.Controls; 4 | using Xunkong.Widget.Models; 5 | 6 | //https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板 7 | 8 | namespace Xunkong.Widget.Controls 9 | { 10 | public sealed partial class XboxWidgetUserCard : UserControl, INotifyPropertyChanged 11 | { 12 | public event PropertyChangedEventHandler PropertyChanged; 13 | private void OnPropertyChanged([CallerMemberName] string propertyName = "") 14 | { 15 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 16 | } 17 | 18 | 19 | private UserInfo _UserInfo; 20 | public UserInfo UserInfo 21 | { 22 | get { return _UserInfo; } 23 | set 24 | { 25 | _UserInfo = value; 26 | OnPropertyChanged(); 27 | } 28 | } 29 | 30 | 31 | public XboxWidgetUserCard() 32 | { 33 | this.InitializeComponent(); 34 | } 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Xunkong.Widget/Converters/BoolToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.UI.Xaml; 3 | using Windows.UI.Xaml.Data; 4 | 5 | namespace Xunkong.Widget.Converters 6 | { 7 | internal class BoolToVisibilityConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, string language) 10 | { 11 | var b = (bool)value; 12 | return b ? Visibility.Visible : Visibility.Collapsed; 13 | } 14 | 15 | public object ConvertBack(object value, Type targetType, object parameter, string language) 16 | { 17 | throw new NotImplementedException(); 18 | } 19 | } 20 | 21 | internal class BoolToVisibilityReversedConverter : IValueConverter 22 | { 23 | public object Convert(object value, Type targetType, object parameter, string language) 24 | { 25 | var b = (bool)value; 26 | return b ? Visibility.Collapsed : Visibility.Visible; 27 | } 28 | 29 | public object ConvertBack(object value, Type targetType, object parameter, string language) 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Xunkong.Widget/Converters/DateTimeOffsetToTimeStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.UI.Xaml.Data; 3 | 4 | namespace Xunkong.Widget.Converters 5 | { 6 | internal class DateTimeOffsetToTimeStringConverter : IValueConverter 7 | { 8 | public object Convert(object value, Type targetType, object parameter, string language) 9 | { 10 | if (value is DateTimeOffset time) 11 | { 12 | return time.LocalDateTime.ToString("HH:mm:ss"); 13 | } 14 | if (value is DateTime time1) 15 | { 16 | return time1.ToString("HH:mm:ss"); 17 | } 18 | return null; 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, string language) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | 27 | 28 | internal class DateTimeOffsetToDateTimeStringConverter : IValueConverter 29 | { 30 | public object Convert(object value, Type targetType, object parameter, string language) 31 | { 32 | if (value is DateTimeOffset time) 33 | { 34 | return time.LocalDateTime.ToString("yyyy-MM-dd HH:mm:ss"); 35 | } 36 | if (value is DateTime time1) 37 | { 38 | return time1.ToString("yyyy-MM-dd HH:mm:ss"); 39 | } 40 | return null; 41 | } 42 | 43 | public object ConvertBack(object value, Type targetType, object parameter, string language) 44 | { 45 | throw new NotImplementedException(); 46 | } 47 | } 48 | 49 | 50 | 51 | internal class DateTimeOffsetToDayStringConverter : IValueConverter 52 | { 53 | public object Convert(object value, Type targetType, object parameter, string language) 54 | { 55 | if (value is DateTimeOffset time) 56 | { 57 | var days = time.Date - DateTimeOffset.Now.Date; 58 | if (days.Days == 0) 59 | { 60 | return "今日"; 61 | } 62 | if (days.Days == 1) 63 | { 64 | return "明日"; 65 | } 66 | switch (time.DayOfWeek) 67 | { 68 | case DayOfWeek.Friday: 69 | return "周五"; 70 | case DayOfWeek.Monday: 71 | return "周一"; 72 | case DayOfWeek.Saturday: 73 | return "周六"; 74 | case DayOfWeek.Sunday: 75 | return "周日"; 76 | case DayOfWeek.Thursday: 77 | return "周四"; 78 | case DayOfWeek.Tuesday: 79 | return "周二"; 80 | case DayOfWeek.Wednesday: 81 | return "周三"; 82 | } 83 | } 84 | if (value is DateTime time1) 85 | { 86 | var days = time.Date - DateTimeOffset.Now.Date; 87 | if (days.Days == 0) 88 | { 89 | return "今日"; 90 | } 91 | if (days.Days == 1) 92 | { 93 | return "明日"; 94 | } 95 | switch (time.DayOfWeek) 96 | { 97 | case DayOfWeek.Friday: 98 | return "周五"; 99 | case DayOfWeek.Monday: 100 | return "周一"; 101 | case DayOfWeek.Saturday: 102 | return "周六"; 103 | case DayOfWeek.Sunday: 104 | return "周日"; 105 | case DayOfWeek.Thursday: 106 | return "周四"; 107 | case DayOfWeek.Tuesday: 108 | return "周二"; 109 | case DayOfWeek.Wednesday: 110 | return "周三"; 111 | } 112 | } 113 | return null; 114 | } 115 | 116 | public object ConvertBack(object value, Type targetType, object parameter, string language) 117 | { 118 | throw new NotImplementedException(); 119 | } 120 | } 121 | 122 | 123 | 124 | 125 | 126 | } 127 | -------------------------------------------------------------------------------- /Xunkong.Widget/Converters/ExpeditionStatusToColorConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.UI; 3 | using Windows.UI.Xaml.Data; 4 | using Windows.UI.Xaml.Media; 5 | 6 | namespace Xunkong.Widget.Converters 7 | { 8 | internal class ExpeditionStatusToColorConverter : IValueConverter 9 | { 10 | 11 | private static SolidColorBrush green = new SolidColorBrush(Colors.Green); 12 | private static SolidColorBrush orange = new SolidColorBrush(Colors.Orange); 13 | private static SolidColorBrush gray = new SolidColorBrush(Colors.Gray); 14 | 15 | public object Convert(object value, Type targetType, object parameter, string language) 16 | { 17 | 18 | var status = (bool)value; 19 | if (status) 20 | { 21 | return green; 22 | } 23 | else 24 | { 25 | return orange; 26 | } 27 | } 28 | 29 | public object ConvertBack(object value, Type targetType, object parameter, string language) 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | } 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Xunkong.Widget/Converters/ObjToBoolStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.UI.Xaml.Data; 3 | 4 | namespace Xunkong.Widget.Converters 5 | { 6 | public class ObjToBoolStringConverter : IValueConverter 7 | { 8 | public object Convert(object value, Type targetType, object parameter, string language) 9 | { 10 | return value is null ? "False" : "True"; 11 | } 12 | 13 | public object ConvertBack(object value, Type targetType, object parameter, string language) 14 | { 15 | throw new NotImplementedException(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Xunkong.Widget/Converters/ObjectToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.UI.Xaml; 3 | using Windows.UI.Xaml.Data; 4 | 5 | namespace Xunkong.Widget.Converters 6 | { 7 | internal class ObjectToVisibilityConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, string language) 10 | { 11 | return value is null ? Visibility.Collapsed : Visibility.Visible; 12 | } 13 | 14 | public object ConvertBack(object value, Type targetType, object parameter, string language) 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | } 19 | 20 | internal class ObjectToVisibilityReversedConverter : IValueConverter 21 | { 22 | public object Convert(object value, Type targetType, object parameter, string language) 23 | { 24 | return value is null ? Visibility.Visible : Visibility.Collapsed; 25 | } 26 | 27 | public object ConvertBack(object value, Type targetType, object parameter, string language) 28 | { 29 | throw new NotImplementedException(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Xunkong.Widget/Converters/QuestEventStatsConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.UI; 3 | using Windows.UI.Xaml.Data; 4 | using Windows.UI.Xaml.Media; 5 | using Xunkong.Widget.Hoyolab.DailyNote; 6 | 7 | namespace Xunkong.Widget.Converters 8 | { 9 | internal class QuestEventStatsColorConverter : IValueConverter 10 | { 11 | 12 | private static SolidColorBrush green = new SolidColorBrush(Colors.Green); 13 | private static SolidColorBrush orangeRed = new SolidColorBrush(Colors.OrangeRed); 14 | private static SolidColorBrush gray = new SolidColorBrush(Colors.Gray); 15 | 16 | 17 | 18 | public object Convert(object value, Type targetType, object parameter, string language) 19 | { 20 | var info = value as DailyNoteInfo; 21 | if (info != null) 22 | { 23 | if (info.IsExtraTaskRewardReceived) 24 | { 25 | return gray; 26 | } 27 | else 28 | { 29 | return orangeRed; 30 | } 31 | } 32 | return gray; 33 | } 34 | 35 | public object ConvertBack(object value, Type targetType, object parameter, string language) 36 | { 37 | throw new NotImplementedException(); 38 | } 39 | } 40 | 41 | 42 | internal class QuestEventStatsColorForXboxWidgetConverter : IValueConverter 43 | { 44 | 45 | private static SolidColorBrush orangeRed = new SolidColorBrush(Colors.OrangeRed); 46 | private static SolidColorBrush black = new SolidColorBrush(Colors.Black); 47 | 48 | public object Convert(object value, Type targetType, object parameter, string language) 49 | { 50 | var info = value as DailyNoteInfo; 51 | if (info != null) 52 | { 53 | if (info.IsExtraTaskRewardReceived) 54 | { 55 | return black; 56 | } 57 | else 58 | { 59 | return orangeRed; 60 | } 61 | } 62 | return black; 63 | } 64 | 65 | public object ConvertBack(object value, Type targetType, object parameter, string language) 66 | { 67 | throw new NotImplementedException(); 68 | } 69 | } 70 | 71 | 72 | internal class QuestEventStatsStringConverter : IValueConverter 73 | { 74 | 75 | 76 | public object Convert(object value, Type targetType, object parameter, string language) 77 | { 78 | var info = value as DailyNoteInfo; 79 | if (info != null) 80 | { 81 | if (info.IsExtraTaskRewardReceived) 82 | { 83 | return "奖励已领取"; 84 | } 85 | if (info.FinishedTaskNumber == info.TotalTaskNumber) 86 | { 87 | return "奖励未领取"; 88 | } 89 | return "任务未完成"; 90 | } 91 | return ""; 92 | } 93 | 94 | public object ConvertBack(object value, Type targetType, object parameter, string language) 95 | { 96 | throw new NotImplementedException(); 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Account/GenshinPlayerInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Xunkong.Widget.Hoyolab.Core; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Account 5 | { 6 | public class GenshinRoleInfo 7 | { 8 | 9 | [JsonPropertyName("game_biz")] 10 | public string GameBiz { get; set; } 11 | 12 | 13 | [JsonPropertyName("region"), JsonConverter(typeof(JsonStringEnumConverter))] 14 | public RegionType Region { get; set; } 15 | 16 | 17 | [JsonPropertyName("game_uid"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] 18 | public int Uid { get; set; } 19 | 20 | 21 | [JsonPropertyName("nickname")] 22 | public string Nickname { get; set; } 23 | 24 | 25 | [JsonPropertyName("level")] 26 | public int Level { get; set; } 27 | 28 | 29 | [JsonPropertyName("is_chosen")] 30 | public bool IsChosen { get; set; } 31 | 32 | 33 | [JsonPropertyName("region_name")] 34 | public string RegionName { get; set; } 35 | 36 | 37 | [JsonPropertyName("is_official")] 38 | public bool IsOfficial { get; set; } 39 | 40 | 41 | [JsonIgnore] 42 | public string Cookie { get; set; } 43 | } 44 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Account/GenshinRoleInfoWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Account 5 | { 6 | internal class GenshinRoleInfoWrapper 7 | { 8 | [JsonPropertyName("list")] 9 | public List List { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Account/HoyolabUserInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Account 4 | { 5 | public class HoyolabUserInfo 6 | { 7 | /// 8 | /// 通行证 ID 9 | /// 10 | [JsonPropertyName("uid"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] 11 | public int Uid { get; set; } 12 | 13 | /// 14 | /// 昵称 15 | /// 16 | [JsonPropertyName("nickname")] 17 | public string Nickname { get; set; } 18 | 19 | /// 20 | /// 介绍 21 | /// 22 | [JsonPropertyName("introduce")] 23 | public string Introduce { get; set; } 24 | 25 | /// 26 | /// 头像 ID 27 | /// 28 | [JsonPropertyName("avatar")] 29 | public string Avatar { get; set; } 30 | 31 | /// 32 | /// 性别 0/1/2 33 | /// 34 | [JsonPropertyName("gender")] 35 | public int Gender { get; set; } 36 | 37 | /// 38 | /// 头像 39 | /// 40 | [JsonPropertyName("avatar_url")] 41 | public string AvatarUrl { get; set; } 42 | 43 | /// 44 | /// 头像框 45 | /// 46 | [JsonPropertyName("pendant")] 47 | public string Pendant { get; set; } 48 | 49 | /// 50 | /// 与此账号相关联的 Cookie 51 | /// 52 | [JsonIgnore] 53 | public string Cookie { get; set; } 54 | 55 | } 56 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Account/HoyolabUserInfoWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Account 4 | { 5 | internal class HoyolabUserInfoWrapper 6 | { 7 | [JsonPropertyName("user_info")] 8 | public HoyolabUserInfo HoyolabUserInfo { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Account/SignInInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Account 5 | { 6 | public class SignInInfo 7 | { 8 | /// 9 | /// 累积签到天数 10 | /// 11 | [JsonPropertyName("total_sign_day")] 12 | public int TotalSignDays { get; set; } 13 | 14 | /// 15 | /// 今天是... 16 | /// 17 | [JsonPropertyName("today"), JsonConverter(typeof(SignTodayJsonConverter))] 18 | public DateTime Today { get; set; } 19 | 20 | /// 21 | /// 今日是否已签到 22 | /// 23 | [JsonPropertyName("is_sign")] 24 | public bool IsSign { get; set; } 25 | 26 | 27 | [JsonPropertyName("is_sub")] 28 | public bool IsSub { get; set; } 29 | 30 | 31 | [JsonPropertyName("first_bind")] 32 | public bool FirstBind { get; set; } 33 | 34 | 35 | [JsonPropertyName("month_first")] 36 | public bool IsFirstDayOfMonth { get; set; } 37 | 38 | 39 | [JsonPropertyName("sign_cnt_missed")] 40 | public int MissedCount { get; set; } 41 | } 42 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Account/SignTodayJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.Account 6 | { 7 | public class SignTodayJsonConverter : JsonConverter 8 | { 9 | public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 10 | { 11 | var str = reader.GetString(); 12 | if (DateTime.TryParse(str, out var date)) 13 | { 14 | return date; 15 | } 16 | else 17 | { 18 | return DateTime.Now; 19 | } 20 | } 21 | 22 | public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) 23 | { 24 | writer.WriteStringValue(value.ToString("yyyy-MM-dd")); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/AvatarCalculate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Avatar 5 | { 6 | 7 | /// 8 | /// 角色养成计算器 9 | /// 10 | public class AvatarCalculate 11 | { 12 | /// 13 | /// 角色技能 14 | /// 15 | [JsonPropertyName("skill_list")] 16 | public List Skills { get; set; } 17 | 18 | 19 | //[JsonPropertyName("weapon")] 20 | //public Weapon? Weapon { get; set; } 21 | 22 | 23 | //[JsonPropertyName("reliquary_list")] 24 | //public List? ReliquaryList { get; set; } 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/AvatarConstellation.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Avatar 4 | { 5 | /// 6 | /// 角色命之座 7 | /// 8 | public class AvatarConstellation 9 | { 10 | 11 | [JsonPropertyName("id")] 12 | public int Id { get; set; } 13 | 14 | /// 15 | /// 名称 16 | /// 17 | [JsonPropertyName("name")] 18 | public string Name { get; set; } 19 | 20 | /// 21 | /// 名座图标(白色) 22 | /// 23 | /// 24 | [JsonPropertyName("icon")] 25 | public string Icon { get; set; } 26 | 27 | /// 28 | /// 名字效果(内容中会带上原神特有的 color 标签) 29 | /// 30 | /// 31 | /// 神里绫华的普通攻击或重击对敌人造成<color=#99FFFFFF>冰元素伤害</color>时,有50%的几率使<ccolor=#FFD780FF>神里流·冰华</color>的冷却时间缩减0.3秒。该效果每0.1秒只能触发一次。 32 | /// 33 | /// 34 | /// 35 | [JsonPropertyName("effect")] 36 | public string Effect { get; set; } 37 | 38 | /// 39 | /// 是否激活 40 | /// 41 | [JsonPropertyName("is_actived")] 42 | public bool IsActived { get; set; } 43 | 44 | /// 45 | /// 位置 1-6 46 | /// 47 | [JsonPropertyName("pos")] 48 | public int Position { get; set; } 49 | 50 | } 51 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/AvatarCostume.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Avatar 4 | { 5 | /// 6 | /// 角色服装 7 | /// 8 | public class AvatarCostume 9 | { 10 | 11 | [JsonPropertyName("id")] 12 | public int Id { get; set; } 13 | 14 | /// 15 | /// 服装名称 16 | /// 17 | [JsonPropertyName("name")] 18 | public string Name { get; set; } 19 | 20 | /// 21 | /// 服装图片 22 | /// 23 | /// 24 | [JsonPropertyName("icon")] 25 | public string Icon { get; set; } 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/AvatarDetail.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Avatar 5 | { 6 | public class AvatarDetail : AvatarInfo 7 | { 8 | 9 | /// 10 | /// 半身肖像 11 | /// 12 | /// 13 | [JsonPropertyName("icon")] 14 | public string Icon { get; set; } 15 | 16 | /// 17 | /// 半透明全身图片 18 | /// 19 | /// 20 | [JsonPropertyName("image")] 21 | public new string Image { get; set; } 22 | 23 | /// 24 | /// 已装备武器 25 | /// 26 | [JsonPropertyName("weapon")] 27 | public AvatarWeapon Weapon { get; set; } 28 | 29 | /// 30 | /// 已装备圣遗物 31 | /// 32 | [JsonPropertyName("reliquaries")] 33 | public List Reliquaries { get; set; } 34 | 35 | /// 36 | /// 命之座 37 | /// 38 | [JsonPropertyName("constellations")] 39 | public List Constellations { get; set; } 40 | 41 | /// 42 | /// 已拥有服装 43 | /// 44 | [JsonPropertyName("costumes")] 45 | public List Costumes { get; set; } 46 | 47 | } 48 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/AvatarDetailWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Avatar 5 | { 6 | internal class AvatarDetailWrapper 7 | { 8 | [JsonPropertyName("avatars")] 9 | public List Avatars { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/AvatarInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Xunkong.Widget.Hoyolab.Core; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Avatar 5 | { 6 | /// 7 | /// 角色信息 8 | /// 9 | public class AvatarInfo 10 | { 11 | 12 | [JsonPropertyName("id")] 13 | public int Id { get; set; } 14 | 15 | /// 16 | /// 名称 17 | /// 18 | [JsonPropertyName("name")] 19 | public string Name { get; set; } 20 | 21 | /// 22 | /// 元素类型 23 | /// 24 | [JsonPropertyName("element"), JsonConverter(typeof(JsonStringEnumConverter))] 25 | public ElementType Element { get; set; } 26 | 27 | /// 28 | /// 半身肖像 29 | /// 30 | /// 31 | [JsonPropertyName("image")] 32 | public string Image { get; set; } 33 | 34 | /// 35 | /// 半身肖像(带有卡片边框) 36 | /// 37 | /// 38 | [JsonPropertyName("card_image")] 39 | public string CardImage { get; set; } 40 | 41 | /// 42 | /// 好感度 43 | /// 44 | [JsonPropertyName("fetter")] 45 | public int Fetter { get; set; } 46 | 47 | /// 48 | /// 等级 49 | /// 50 | [JsonPropertyName("level")] 51 | public int Level { get; set; } 52 | 53 | /// 54 | /// 稀有度 55 | /// 56 | [JsonPropertyName("rarity")] 57 | public int Rarity { get; set; } 58 | 59 | /// 60 | /// 已激活名座数 61 | /// 62 | [JsonPropertyName("actived_constellation_num")] 63 | public int ActivedConstellationNumber { get; set; } 64 | 65 | } 66 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/AvatarReliquary.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Avatar 4 | { 5 | /// 6 | /// 圣遗物 7 | /// 8 | public class AvatarReliquary 9 | { 10 | 11 | [JsonPropertyName("id")] 12 | public int Id { get; set; } 13 | 14 | /// 15 | /// 名称 16 | /// 17 | [JsonPropertyName("name")] 18 | public string Name { get; set; } 19 | 20 | /// 21 | /// 圣遗物图标 22 | /// 23 | /// 24 | [JsonPropertyName("icon")] 25 | public string Icon { get; set; } 26 | 27 | /// 28 | /// 圣遗物位置,1-5花羽沙杯冠 29 | /// 30 | [JsonPropertyName("pos")] 31 | public int Position { get; set; } 32 | 33 | /// 34 | /// 稀有度 35 | /// 36 | [JsonPropertyName("rarity")] 37 | public int Rarity { get; set; } 38 | 39 | /// 40 | /// 强化等级 41 | /// 42 | [JsonPropertyName("level")] 43 | public int Level { get; set; } 44 | 45 | /// 46 | /// 套装及效果 47 | /// 48 | [JsonPropertyName("set")] 49 | public ReliquarySet ReliquarySet { get; set; } 50 | 51 | /// 52 | /// 位置名称(生之花) 53 | /// 54 | [JsonPropertyName("pos_name")] 55 | public string PositionName { get; set; } 56 | 57 | 58 | } 59 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/AvatarSkill.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Avatar 4 | { 5 | /// 6 | /// 角色技能 7 | /// 8 | public class AvatarSkill 9 | { 10 | [JsonPropertyName("id")] 11 | public int Id { get; set; } 12 | 13 | [JsonPropertyName("group_id")] 14 | public int GroupId { get; set; } 15 | 16 | /// 17 | /// 技能名称 18 | /// 19 | [JsonPropertyName("name")] 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// 技能图标 24 | /// 25 | /// 26 | [JsonPropertyName("icon")] 27 | public string Icon { get; set; } 28 | 29 | /// 30 | /// 当前等级(不计入名座加成) 31 | /// 32 | [JsonPropertyName("level_current")] 33 | public int CurrentLevel { get; set; } 34 | 35 | /// 36 | /// 最大等级(可升级为10,不可升级为1,不计入名座加成) 37 | /// 38 | [JsonPropertyName("max_level")] 39 | public int MaxLevel { get; set; } 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/AvatarWeapon.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Avatar 4 | { 5 | /// 6 | /// 武器信息 7 | /// 8 | public class AvatarWeapon 9 | { 10 | 11 | [JsonPropertyName("id")] 12 | public int Id { get; set; } 13 | 14 | /// 15 | /// 名称 16 | /// 17 | [JsonPropertyName("name")] 18 | public string Name { get; set; } 19 | 20 | /// 21 | /// 武器图标 22 | /// 23 | /// 24 | [JsonPropertyName("icon")] 25 | public string Icon { get; set; } 26 | 27 | /// 28 | /// 武器类型,1单手,11双手,13长柄,10法器,12弓 29 | /// 30 | [JsonPropertyName("type")] 31 | public int Type { get; set; } 32 | 33 | /// 34 | /// 稀有度 35 | /// 36 | [JsonPropertyName("rarity")] 37 | public int Rarity { get; set; } 38 | 39 | /// 40 | /// 等级 41 | /// 42 | [JsonPropertyName("level")] 43 | public int Level { get; set; } 44 | 45 | /// 46 | /// 突破等级 47 | /// 48 | [JsonPropertyName("promote_level")] 49 | public int PromoteLevel { get; set; } 50 | 51 | /// 52 | /// 类型名称 53 | /// 54 | [JsonPropertyName("type_name")] 55 | public string TypeName { get; set; } 56 | 57 | /// 58 | /// 描述 59 | /// 60 | [JsonPropertyName("desc")] 61 | public string Description { get; set; } 62 | 63 | /// 64 | /// 精炼等级 65 | /// 66 | [JsonPropertyName("affix_level")] 67 | public int AffixLevel { get; set; } 68 | 69 | } 70 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/ReliquaryAffix.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Avatar 4 | { 5 | /// 6 | /// 圣遗物套装效果 7 | /// 8 | public class ReliquaryAffix 9 | { 10 | 11 | /// 12 | /// 激活效果所需的数量 13 | /// 14 | [JsonPropertyName("activation_number")] 15 | public int ActivationNumber { get; set; } 16 | 17 | /// 18 | /// 效果描述 19 | /// 20 | [JsonPropertyName("effect")] 21 | public string Effect { get; set; } 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Avatar/ReliquarySet.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Avatar 5 | { 6 | /// 7 | /// 圣遗物套装 8 | /// 9 | public class ReliquarySet 10 | { 11 | 12 | [JsonPropertyName("id")] 13 | public int Id { get; set; } 14 | 15 | /// 16 | /// 套装名称 17 | /// 18 | [JsonPropertyName("name")] 19 | public string Name { get; set; } 20 | 21 | /// 22 | /// 圣遗物套装效果 23 | /// 24 | [JsonPropertyName("affixes")] 25 | public List Affixes { get; set; } 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Core/ElementType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Core 4 | { 5 | /// 6 | /// 元素类型 7 | /// 8 | [Flags] 9 | public enum ElementType 10 | { 11 | 12 | /// 13 | /// 未知 14 | /// 15 | None = 0, 16 | 17 | /// 18 | /// 物理 19 | /// 20 | Phys = 1, 21 | 22 | /// 23 | /// 火 24 | /// 25 | Pyro = 2, 26 | 27 | /// 28 | /// 水 29 | /// 30 | Hydro = 4, 31 | 32 | /// 33 | /// 风 34 | /// 35 | Anemo = 8, 36 | 37 | /// 38 | /// 雷 39 | /// 40 | Electro = 16, 41 | 42 | /// 43 | /// 草 44 | /// 45 | Dendro = 32, 46 | 47 | /// 48 | /// 冰 49 | /// 50 | Cryo = 64, 51 | 52 | /// 53 | /// 岩 54 | /// 55 | Geo = 128, 56 | 57 | } 58 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Core/EnumExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | 5 | namespace Xunkong.Widget.Hoyolab.Core 6 | { 7 | public static class EnumExtension 8 | { 9 | public static string ToDescription(this Enum value) 10 | { 11 | var text = value.ToString(); 12 | var fieldInfo = value.GetType().GetField(text); 13 | var descriptionAttribute = fieldInfo?.GetCustomAttributes(typeof(DescriptionAttribute), false).FirstOrDefault(); 14 | return (descriptionAttribute as DescriptionAttribute)?.Description ?? text; 15 | } 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Core/RegionHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Core 4 | { 5 | public static class RegionHelper 6 | { 7 | 8 | public static RegionType UidToRegionType(int uid) 9 | { 10 | switch (uid.ToString().FirstOrDefault()) 11 | { 12 | case '1': return RegionType.cn_gf01; 13 | case '2': return RegionType.cn_gf01; 14 | case '3': return RegionType.cn_gf01; 15 | case '4': return RegionType.cn_gf01; 16 | case '5': return RegionType.cn_qd01; 17 | case '6': return RegionType.os_usa; 18 | case '7': return RegionType.os_euro; 19 | case '8': return RegionType.os_asia; 20 | case '9': return RegionType.os_cht; 21 | default: return RegionType.None; 22 | } 23 | } 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Core/RegionType.cs: -------------------------------------------------------------------------------- 1 | namespace Xunkong.Widget.Hoyolab.Core 2 | { 3 | /// 4 | /// 服务器区域 5 | /// 6 | public enum RegionType 7 | { 8 | None = 0, 9 | 10 | cn_gf01 = 1, 11 | 12 | cn_qd01 = 5, 13 | 14 | os_usa = 6, 15 | 16 | os_euro = 7, 17 | 18 | os_asia = 8, 19 | 20 | os_cht = 9, 21 | } 22 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Core/WeaponType.cs: -------------------------------------------------------------------------------- 1 | namespace Xunkong.Widget.Hoyolab.Core 2 | { 3 | /// 4 | /// 武器类型 5 | /// 6 | public enum WeaponType 7 | { 8 | 9 | /// 10 | /// 未知 11 | /// 12 | None = 0, 13 | 14 | /// 15 | /// 单手剑 16 | /// 17 | Sword = 1, 18 | 19 | /// 20 | /// 双手剑 21 | /// 22 | Claymore = 2, 23 | 24 | /// 25 | /// 长柄武器 26 | /// 27 | Polearm = 4, 28 | 29 | /// 30 | /// 法器 31 | /// 32 | Catalyst = 8, 33 | 34 | /// 35 | /// 弓箭 36 | /// 37 | Bow = 16, 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Core/XunkongException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Core 4 | { 5 | public class XunkongException : Exception 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/DailyNote/DailyNoteInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.Json.Serialization; 5 | 6 | namespace Xunkong.Widget.Hoyolab.DailyNote 7 | { 8 | /// 9 | /// 实时便笺 10 | /// 11 | public class DailyNoteInfo 12 | { 13 | 14 | [JsonIgnore] 15 | public int Id { get; set; } 16 | 17 | [JsonIgnore] 18 | public int Uid { get; set; } 19 | 20 | [JsonIgnore] 21 | public string Nickname { get; set; } 22 | 23 | /// 24 | /// 获取实时便笺时的时间 25 | /// 26 | [JsonIgnore] 27 | public DateTimeOffset NowTime { get; private set; } = DateTimeOffset.Now; 28 | 29 | /// 30 | /// 当前树脂 31 | /// 32 | [JsonPropertyName("current_resin")] 33 | public int CurrentResin { get; set; } 34 | 35 | /// 36 | /// 最大树脂 37 | /// 38 | [JsonPropertyName("max_resin")] 39 | public int MaxResin { get; set; } 40 | 41 | /// 42 | /// 树脂剩余恢复时间 43 | /// 44 | [JsonPropertyName("resin_recovery_time"), JsonConverter(typeof(RecoveryTimeJsonConverter))] 45 | public TimeSpan ResinRecoveryTime { get; set; } 46 | 47 | /// 48 | /// 树脂是否恢复满 49 | /// 50 | [JsonIgnore] 51 | public bool IsResinFull => ResinRecoveryTime == TimeSpan.Zero; 52 | 53 | /// 54 | /// 树脂恢复满的时刻 55 | /// 56 | [JsonIgnore] 57 | public DateTimeOffset ResinFullTime => NowTime + ResinRecoveryTime; 58 | 59 | /// 60 | /// 委托完成数 61 | /// 62 | [JsonPropertyName("finished_task_num")] 63 | public int FinishedTaskNumber { get; set; } 64 | 65 | /// 66 | /// 委托总数 67 | /// 68 | [JsonPropertyName("total_task_num")] 69 | public int TotalTaskNumber { get; set; } 70 | 71 | /// 72 | /// 4次委托额外奖励是否领取 73 | /// 74 | [JsonPropertyName("is_extra_task_reward_received")] 75 | public bool IsExtraTaskRewardReceived { get; set; } 76 | 77 | /// 78 | /// 剩余周本树脂减半次数 79 | /// 80 | [JsonPropertyName("remain_resin_discount_num")] 81 | public int RemainResinDiscountNumber { get; set; } 82 | 83 | /// 84 | /// 周本树脂减半总次数 85 | /// 86 | [JsonPropertyName("resin_discount_num_limit")] 87 | public int ResinDiscountLimitedNumber { get; set; } 88 | 89 | /// 90 | /// 已完成派遣数 91 | /// 92 | [JsonIgnore] 93 | public int FinishedExpeditionNumber => Expeditions?.Count(x => x.IsFinished) ?? 0; 94 | 95 | /// 96 | /// 当前派遣数 97 | /// 98 | [JsonPropertyName("current_expedition_num")] 99 | public int CurrentExpeditionNumber { get; set; } 100 | 101 | /// 102 | /// 最大派遣数 103 | /// 104 | [JsonPropertyName("max_expedition_num")] 105 | public int MaxExpeditionNumber { get; set; } 106 | 107 | /// 108 | /// 探索派遣 109 | /// 110 | [JsonPropertyName("expeditions")] 111 | public List Expeditions { get; set; } 112 | 113 | /// 114 | /// 当前洞天宝钱 115 | /// 116 | [JsonPropertyName("current_home_coin")] 117 | public int CurrentHomeCoin { get; set; } 118 | 119 | /// 120 | /// 最大洞天宝钱 121 | /// 122 | [JsonPropertyName("max_home_coin")] 123 | public int MaxHomeCoin { get; set; } 124 | 125 | /// 126 | /// 洞天宝钱剩余恢复时间 127 | /// 128 | [JsonPropertyName("home_coin_recovery_time"), JsonConverter(typeof(RecoveryTimeJsonConverter))] 129 | public TimeSpan HomeCoinRecoveryTime { get; set; } 130 | 131 | /// 132 | /// 参量质变仪 133 | /// 134 | [JsonPropertyName("transformer")] 135 | public Transformer Transformer { get; set; } 136 | 137 | /// 138 | /// 洞天宝钱是否已满 139 | /// 140 | [JsonIgnore] 141 | public bool IsHomeCoinFull => HomeCoinRecoveryTime == TimeSpan.Zero; 142 | 143 | /// 144 | /// 洞天宝钱攒满时刻 145 | /// 146 | [JsonIgnore] 147 | public DateTimeOffset HomeCoinFullTime => NowTime + HomeCoinRecoveryTime; 148 | 149 | 150 | 151 | public DailyNoteInfo Clone() 152 | { 153 | var info = (DailyNoteInfo)MemberwiseClone(); 154 | info.Expeditions = new List(Expeditions); 155 | return info; 156 | } 157 | 158 | 159 | 160 | 161 | } 162 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/DailyNote/Expedition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.DailyNote 5 | { 6 | /// 7 | /// 探索派遣 8 | /// 9 | public class Expedition 10 | { 11 | /// 12 | /// 角色侧面图 13 | /// 14 | [JsonPropertyName("avatar_side_icon")] 15 | public string AvatarSideIcon { get; set; } 16 | 17 | /// 18 | /// 状态 Ongoing:派遣中 Finished:已完成 19 | /// 20 | [JsonPropertyName("status")] 21 | public string Status { get; set; } 22 | 23 | [JsonIgnore] 24 | public DateTimeOffset NowTime { get; private set; } = DateTimeOffset.Now; 25 | 26 | /// 27 | /// 剩余时间 28 | /// 29 | [JsonPropertyName("remained_time"), JsonConverter(typeof(RecoveryTimeJsonConverter))] 30 | public TimeSpan RemainedTime { get; set; } 31 | 32 | /// 33 | /// 探索派遣是否完成 34 | /// 35 | [JsonIgnore] 36 | public bool IsFinished => RemainedTime == TimeSpan.Zero; 37 | 38 | /// 39 | /// 完成时刻 40 | /// 41 | [JsonIgnore] 42 | public DateTimeOffset FinishedTime => NowTime + RemainedTime; 43 | 44 | } 45 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/DailyNote/RecoveryTimeJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.DailyNote 6 | { 7 | public class RecoveryTimeJsonConverter : JsonConverter 8 | { 9 | public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 10 | { 11 | var secondStr = reader.GetString(); 12 | if (int.TryParse(secondStr, out var second)) 13 | { 14 | return TimeSpan.FromSeconds(second); 15 | } 16 | else 17 | { 18 | return TimeSpan.Zero; 19 | } 20 | } 21 | 22 | public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) 23 | { 24 | writer.WriteStringValue(value.TotalSeconds.ToString()); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/DailyNote/Transformer.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.DailyNote 4 | { 5 | /// 6 | /// 参量质变仪 7 | /// 8 | public class Transformer 9 | { 10 | 11 | /// 12 | /// 是否获得 13 | /// 14 | [JsonPropertyName("obtained")] 15 | public bool Obtained { get; set; } 16 | 17 | /// 18 | /// 剩余时间 19 | /// 20 | [JsonPropertyName("recovery_time")] 21 | public TransformerRecoveryTime RecoveryTime { get; set; } 22 | 23 | /// 24 | /// Wiki url 25 | /// 26 | [JsonPropertyName("wiki")] 27 | public string Wiki { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/DailyNote/TransformerRecoveryTime.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.DailyNote 4 | { 5 | /// 6 | /// 参量质变仪恢复时间 7 | /// 时间四值中仅有 有值 8 | /// 9 | public class TransformerRecoveryTime 10 | { 11 | [JsonPropertyName("Day")] 12 | public int Day { get; set; } 13 | 14 | [JsonPropertyName("Hour")] 15 | public int Hour { get; set; } 16 | 17 | [JsonPropertyName("Minute")] 18 | public int Minute { get; set; } 19 | 20 | [JsonPropertyName("Second")] 21 | public int Second { get; set; } 22 | 23 | /// 24 | /// 是否可再次使用 25 | /// 26 | [JsonPropertyName("reached")] 27 | public bool Reached { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/DynamicSecret.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Security.Cryptography; 4 | using System.Text; 5 | using System.Text.Json; 6 | 7 | namespace Xunkong.Widget.Hoyolab 8 | { 9 | internal abstract class DynamicSecret 10 | { 11 | 12 | private static readonly string ApiSalt = "4a8knnbk5pbjqsrudp3dq484m9axoc5g"; 13 | 14 | private static readonly string ApiSalt2 = "xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs"; 15 | 16 | private static readonly Random Random = new Random(); 17 | 18 | private static readonly MD5 MD5 = MD5.Create(); 19 | 20 | public static string CreateSecret() 21 | { 22 | var t = (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds(); 23 | string r = GetRandomString(t); 24 | var bytes = MD5.ComputeHash(Encoding.UTF8.GetBytes($"salt={ApiSalt}&t={t}&r={r}")); 25 | var check = BitConverter.ToString(bytes).Replace("-", "").ToLower(); 26 | return $"{t},{r},{check}"; 27 | } 28 | 29 | 30 | public static string CreateSecret2(string url, object postBody = null) 31 | { 32 | int t = (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds(); 33 | string r = Random.Next(100000, 200000).ToString(); 34 | string b = postBody is null ? "" : JsonSerializer.Serialize(postBody); 35 | string q = ""; 36 | string[] urls = url.Split('?'); 37 | if (urls.Length == 2) 38 | { 39 | string[] queryParams = urls[1].Split('&').OrderBy(x => x).ToArray(); 40 | q = string.Join("&", queryParams); 41 | } 42 | var bytes = MD5.ComputeHash(Encoding.UTF8.GetBytes($"salt={ApiSalt2}&t={t}&r={r}&b={b}&q={q}")); 43 | var check = BitConverter.ToString(bytes).Replace("-", "").ToLower(); 44 | string result = $"{t},{r},{check}"; 45 | return result; 46 | } 47 | 48 | 49 | private static string GetRandomString(int timestamp) 50 | { 51 | var sb = new StringBuilder(6); 52 | var random = new Random(timestamp); 53 | for (int i = 0; i < 6; i++) 54 | { 55 | int v8 = random.Next(0, 32768) % 26; 56 | int v9 = 87; 57 | if (v8 < 10) 58 | { 59 | v9 = 48; 60 | } 61 | _ = sb.Append((char)(v8 + v9)); 62 | } 63 | return sb.ToString(); 64 | } 65 | 66 | } 67 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/GameRecord/GameRecordSummary.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Xunkong.Widget.Hoyolab.Avatar; 4 | 5 | namespace Xunkong.Widget.Hoyolab.GameRecord 6 | { 7 | public class GameRecordSummary 8 | { 9 | /// 10 | /// 角色信息 11 | /// 12 | [JsonPropertyName("avatars")] 13 | public List AvatarInfos { get; set; } 14 | 15 | /// 16 | /// 冒险统计 17 | /// 18 | [JsonPropertyName("stats")] 19 | public PlayerRiskStats PlayerStat { get; set; } 20 | 21 | /// 22 | /// 世界探索 23 | /// 24 | [JsonPropertyName("world_explorations")] 25 | public List WorldExplorations { get; set; } 26 | 27 | /// 28 | /// 尘歌壶 29 | /// 30 | [JsonPropertyName("homes")] 31 | public List PotHomes { get; set; } 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/GameRecord/PlayerRiskStats.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.GameRecord 4 | { 5 | /// 6 | /// 冒险统计 7 | /// 8 | public class PlayerRiskStats 9 | { 10 | 11 | /// 12 | /// 活跃天数 13 | /// 14 | [JsonPropertyName("active_day_number")] 15 | public int ActiveDayNumber { get; set; } 16 | 17 | /// 18 | /// 成就达成数 19 | /// 20 | [JsonPropertyName("achievement_number")] 21 | public int AchievementNumber { get; set; } 22 | 23 | /// 24 | /// 风神瞳 25 | /// 26 | [JsonPropertyName("anemoculus_number")] 27 | public int AnemoculusNumber { get; set; } 28 | 29 | /// 30 | /// 岩神瞳 31 | /// 32 | [JsonPropertyName("geoculus_number")] 33 | public int GeoculusNumber { get; set; } 34 | 35 | /// 36 | /// 雷神瞳 37 | /// 38 | [JsonPropertyName("electroculus_number")] 39 | public int ElectroculusNumber { get; set; } 40 | 41 | /// 42 | /// 获得角色数 43 | /// 44 | [JsonPropertyName("avatar_number")] 45 | public int AvatarNumber { get; set; } 46 | 47 | /// 48 | /// 解锁传送点 49 | /// 50 | [JsonPropertyName("way_point_number")] 51 | public int WayPointNumber { get; set; } 52 | 53 | /// 54 | /// 解锁秘境 55 | /// 56 | [JsonPropertyName("domain_number")] 57 | public int DomainNumber { get; set; } 58 | 59 | /// 60 | /// 深境螺旋 61 | /// 62 | [JsonPropertyName("spiral_abyss")] 63 | public string SpiralAbyss { get; set; } 64 | 65 | /// 66 | /// 华丽宝箱 67 | /// 68 | [JsonPropertyName("luxurious_chest_number")] 69 | public int LuxuriousChestNumber { get; set; } 70 | 71 | /// 72 | /// 珍贵宝箱 73 | /// 74 | [JsonPropertyName("precious_chest_number")] 75 | public int PreciousChestNumber { get; set; } 76 | 77 | /// 78 | /// 精致宝箱 79 | /// 80 | [JsonPropertyName("exquisite_chest_number")] 81 | public int ExquisiteChestNumber { get; set; } 82 | 83 | /// 84 | /// 普通宝箱 85 | /// 86 | [JsonPropertyName("common_chest_number")] 87 | public int CommonChestNumber { get; set; } 88 | 89 | 90 | /// 91 | /// 奇馈宝箱 92 | /// 93 | [JsonPropertyName("magic_chest_number")] 94 | public int MagicChestNumber { get; set; } 95 | 96 | } 97 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/GameRecord/PotHome.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.GameRecord 4 | { 5 | /// 6 | /// 尘歌壶 7 | /// 8 | public class PotHome 9 | { 10 | 11 | /// 12 | /// 信任等阶 13 | /// 14 | [JsonPropertyName("level")] 15 | public int Level { get; set; } 16 | 17 | /// 18 | /// 历史访客数 19 | /// 20 | [JsonPropertyName("visit_num")] 21 | public int VisitNumber { get; set; } 22 | 23 | /// 24 | /// 最高洞天仙力 25 | /// 26 | [JsonPropertyName("comfort_num")] 27 | public int ComfortNumber { get; set; } 28 | 29 | /// 30 | /// 摆设数 31 | /// 32 | [JsonPropertyName("item_num")] 33 | public int ItemNumber { get; set; } 34 | 35 | /// 36 | /// 洞天名称 37 | /// 38 | [JsonPropertyName("name")] 39 | public string Name { get; set; } 40 | 41 | /// 42 | /// 洞天图片 43 | /// 44 | /// 45 | [JsonPropertyName("icon")] 46 | public string Icon { get; set; } 47 | 48 | /// 49 | /// 仙力等级名称 50 | /// 51 | [JsonPropertyName("comfort_level_name")] 52 | public string ComfortLevelName { get; set; } 53 | 54 | /// 55 | /// 仙力等级图标 56 | /// 57 | /// 58 | [JsonPropertyName("comfort_level_icon")] 59 | public string ComfortLevelIcon { get; set; } 60 | 61 | } 62 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/GameRecord/WorldExploration.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.GameRecord 5 | { 6 | /// 7 | /// 世界探索信息 8 | /// 9 | public class WorldExploration 10 | { 11 | 12 | [JsonPropertyName("id")] 13 | public int Id { get; set; } 14 | 15 | /// 16 | /// 地区名称 17 | /// 18 | [JsonPropertyName("name")] 19 | public string Name { get; set; } 20 | 21 | /// 22 | /// 探索等级 23 | /// 24 | [JsonPropertyName("level")] 25 | public int Level { get; set; } 26 | 27 | /// 28 | /// 探索度,满值 1000 29 | /// 30 | [JsonPropertyName("exploration_percentage")] 31 | public int ExplorationPercentage { get; set; } 32 | 33 | /// 34 | /// 地区卡片背景图 35 | /// 36 | /// 37 | [JsonPropertyName("background_image")] 38 | public string BackgroundImage { get; set; } 39 | 40 | /// 41 | /// 地区封面背景图 42 | /// 43 | /// 44 | [JsonPropertyName("cover")] 45 | public string Cover { get; set; } 46 | 47 | /// 48 | /// 地区图标(白色) 49 | /// 50 | /// 51 | [JsonPropertyName("icon")] 52 | public string Icon { get; set; } 53 | 54 | /// 55 | /// 地区图标(黑色) 56 | /// 57 | /// 58 | [JsonPropertyName("inner_icon")] 59 | public string InnerIcon { get; set; } 60 | 61 | /// 62 | /// 米游社地图 63 | /// 64 | /// 65 | [JsonPropertyName("map_url")] 66 | public string MapUrl { get; set; } 67 | 68 | 69 | /// 70 | /// 地区探索奖励类型(声望,贡品) 71 | /// 72 | [JsonPropertyName("type"), JsonConverter(typeof(JsonStringEnumConverter))] 73 | public WorldExplorationRewardType Type { get; set; } 74 | 75 | /// 76 | /// 地区贡品等级 77 | /// 78 | [JsonPropertyName("offerings")] 79 | public List Offerings { get; set; } 80 | 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/GameRecord/WorldExplorationOffering.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.GameRecord 4 | { 5 | /// 6 | /// 贡品类型奖励信息 7 | /// 8 | public class WorldExplorationOffering 9 | { 10 | 11 | [JsonPropertyName("name")] 12 | public string Name { get; set; } 13 | 14 | 15 | [JsonPropertyName("level")] 16 | public int Level { get; set; } 17 | 18 | 19 | [JsonPropertyName("icon")] 20 | public string Icon { get; set; } 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/GameRecord/WorldExplorationRewardType.cs: -------------------------------------------------------------------------------- 1 | namespace Xunkong.Widget.Hoyolab.GameRecord 2 | { 3 | /// 4 | /// 世界探索奖励类型 5 | /// 6 | public enum WorldExplorationRewardType 7 | { 8 | /// 9 | /// 声望 10 | /// 11 | Reputation, 12 | 13 | /// 14 | /// 贡品 15 | /// 16 | Offering, 17 | } 18 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/HoyolabBaseWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab 4 | { 5 | internal class HoyolabBaseWrapper where T : class 6 | { 7 | 8 | [JsonPropertyName("retcode")] 9 | public int ReturnCode { get; set; } 10 | 11 | 12 | [JsonPropertyName("message")] 13 | public string Message { get; set; } 14 | 15 | 16 | [JsonPropertyName("data")] 17 | public T Data { get; set; } 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/HoyolabException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Xunkong.Widget.Hoyolab 4 | { 5 | public class HoyolabException : Exception 6 | { 7 | 8 | public int ReturnCode { get; private set; } 9 | 10 | public HoyolabException(int returnCode, string message) : base($"{message} ({returnCode})") 11 | { 12 | ReturnCode = returnCode; 13 | } 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/HoyolabJsonContext.cs: -------------------------------------------------------------------------------- 1 | #if NativeAOT 2 | 3 | using System.Text.Json.Nodes; 4 | using Xunkong.Hoyolab.Account; 5 | using Xunkong.Hoyolab.Avatar; 6 | using Xunkong.Hoyolab.DailyNote; 7 | using Xunkong.Hoyolab.GameRecord; 8 | using Xunkong.Hoyolab.News; 9 | using Xunkong.Hoyolab.SpiralAbyss; 10 | using Xunkong.Hoyolab.TravelNotes; 11 | 12 | namespace Xunkong.Hoyolab; 13 | 14 | 15 | [JsonSerializable(typeof(ElementType[]))] 16 | [JsonSerializable(typeof(RegionType[]))] 17 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 18 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 19 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 20 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 21 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 22 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 23 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 24 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 25 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 26 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 27 | [JsonSerializable(typeof(WorldExplorationRewardType[]))] 28 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 29 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 30 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 31 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 32 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 33 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 34 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 35 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 36 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 37 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 38 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 39 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 40 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 41 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 42 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 43 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 44 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 45 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 46 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 47 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 48 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 49 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 50 | [JsonSerializable(typeof(TravelNotesAwardType[]))] 51 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 52 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 53 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 54 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 55 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 56 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 57 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 58 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 59 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 60 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 61 | [JsonSerializable(typeof(NewsType[]))] 62 | internal partial class HoyolabJsonContext : JsonSerializerContext { } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/News/NewsDetailWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.News 4 | { 5 | internal class NewsDetailWrapper 6 | { 7 | 8 | [JsonPropertyName("post")] 9 | public NewsItem Post { get; set; } 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/News/NewsItem.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.News 4 | { 5 | public class NewsItem 6 | { 7 | 8 | /// 9 | /// 新闻内容 10 | /// 11 | [JsonPropertyName("post")] 12 | public NewsPost Post { get; set; } 13 | 14 | 15 | //[JsonPropertyName("forum")] 16 | //public object Forum { get; set; } 17 | 18 | //[JsonPropertyName("topics")] 19 | //public List Topics { get; set; } 20 | 21 | //[JsonPropertyName("user")] 22 | //public object User { get; set; } 23 | 24 | //[JsonPropertyName("stat")] 25 | //public object Stats { get; set; } 26 | 27 | //[JsonPropertyName("image_list")] 28 | //public List ImageList { get; set; } 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/News/NewsListWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.News 5 | { 6 | 7 | internal class NewsListWrapper 8 | { 9 | 10 | /// 11 | /// 是否翻到结尾了 12 | /// 13 | [JsonPropertyName("is_last")] 14 | public bool IsLast { get; set; } 15 | 16 | /// 17 | /// 下一次请求时使用 18 | /// 19 | [JsonPropertyName("last_id")] 20 | public int LastId { get; set; } 21 | 22 | /// 23 | /// 新闻 24 | /// 25 | [JsonPropertyName("list")] 26 | public List List { get; set; } 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/News/NewsPost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.Json.Serialization; 5 | 6 | namespace Xunkong.Widget.Hoyolab.News 7 | { 8 | /// 9 | /// 新闻内容 10 | /// 11 | public class NewsPost 12 | { 13 | 14 | [JsonPropertyName("post_id"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] 15 | public int PostId { get; set; } 16 | 17 | /// 18 | /// 标题 19 | /// 20 | [JsonPropertyName("subject")] 21 | public string Subject { get; set; } 22 | 23 | /// 24 | /// 正文(html格式) 25 | /// 26 | [JsonPropertyName("content")] 27 | public string Content { get; set; } 28 | 29 | /// 30 | /// 创建时间 31 | /// 32 | [JsonPropertyName("created_at"), JsonConverter(typeof(NewsTimeJsonConverter))] 33 | public DateTimeOffset CreateTime { get; set; } 34 | 35 | /// 36 | /// 图片,第一张为封面 37 | /// 38 | [JsonPropertyName("images")] 39 | public List Images { get; set; } 40 | 41 | /// 42 | /// 结构化正文 43 | /// 44 | [JsonPropertyName("structured_content")] 45 | public string StructuredContent { get; set; } 46 | 47 | /// 48 | /// 修改时间 49 | /// 50 | [JsonPropertyName("updated_at"), JsonConverter(typeof(NewsTimeJsonConverter))] 51 | public DateTimeOffset UpdateTime { get; set; } 52 | 53 | /// 54 | /// 封面 55 | /// 56 | [JsonIgnore] 57 | public string Cover => Images?.FirstOrDefault(); 58 | 59 | } 60 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/News/NewsTimeJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.News 6 | { 7 | public class NewsTimeJsonConverter : JsonConverter 8 | { 9 | public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 10 | { 11 | return DateTimeOffset.FromUnixTimeSeconds(reader.GetInt64()); 12 | } 13 | 14 | public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) 15 | { 16 | writer.WriteNumberValue(value.ToUnixTimeSeconds()); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/News/NewsType.cs: -------------------------------------------------------------------------------- 1 | namespace Xunkong.Widget.Hoyolab.News 2 | { 3 | /// 4 | /// 新闻类型 5 | /// 6 | public enum NewsType 7 | { 8 | 9 | /// 10 | /// 公告 11 | /// 12 | Announce = 1, 13 | 14 | /// 15 | /// 活动 16 | /// 17 | Activity = 2, 18 | 19 | /// 20 | /// 资讯 21 | /// 22 | Infomation = 3, 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/SpiralAbyss/SpiralAbyssAvatar.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.SpiralAbyss 4 | { 5 | /// 6 | /// 深境螺旋角色 7 | /// 8 | public class SpiralAbyssAvatar 9 | { 10 | 11 | [JsonIgnore] 12 | public int Id { get; set; } 13 | 14 | 15 | [JsonPropertyName("id")] 16 | public int AvatarId { get; set; } 17 | 18 | 19 | [JsonPropertyName("icon")] 20 | public string Icon { get; set; } 21 | 22 | 23 | [JsonPropertyName("level")] 24 | public int Level { get; set; } 25 | 26 | 27 | [JsonPropertyName("rarity")] 28 | public int Rarity { get; set; } 29 | 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/SpiralAbyss/SpiralAbyssBattle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.SpiralAbyss 6 | { 7 | 8 | /// 9 | /// 深境螺旋一场战斗 10 | /// 11 | public class SpiralAbyssBattle 12 | { 13 | [JsonIgnore] 14 | public int Id { get; set; } 15 | 16 | 17 | [JsonPropertyName("index")] 18 | public int Index { get; set; } 19 | 20 | 21 | [JsonPropertyName("timestamp"), JsonConverter(typeof(SpiralAbyssTimeJsonConverter))] 22 | public DateTimeOffset Time { get; set; } 23 | 24 | 25 | [JsonPropertyName("avatars")] 26 | public List Avatars { get; set; } 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/SpiralAbyss/SpiralAbyssFloor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.SpiralAbyss 5 | { 6 | /// 7 | /// 深境螺旋层 8 | /// 9 | public class SpiralAbyssFloor 10 | { 11 | [JsonIgnore] 12 | public int Id { get; set; } 13 | 14 | 15 | [JsonPropertyName("index")] 16 | public int Index { get; set; } 17 | 18 | 19 | [JsonPropertyName("icon")] 20 | public string Icon { get; set; } 21 | 22 | 23 | [JsonPropertyName("is_unlock")] 24 | public bool IsUnlock { get; set; } 25 | 26 | 27 | [JsonPropertyName("settle_time")] 28 | public string SettleTime { get; set; } 29 | 30 | 31 | [JsonPropertyName("star")] 32 | public int Star { get; set; } 33 | 34 | 35 | [JsonPropertyName("max_star")] 36 | public int MaxStar { get; set; } 37 | 38 | 39 | [JsonPropertyName("levels")] 40 | public List Levels { get; set; } 41 | 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/SpiralAbyss/SpiralAbyssInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.SpiralAbyss 6 | { 7 | public class SpiralAbyssInfo 8 | { 9 | 10 | [JsonIgnore] 11 | public int Id { get; set; } 12 | 13 | public int Uid { get; set; } 14 | 15 | [JsonPropertyName("schedule_id")] 16 | public int ScheduleId { get; set; } 17 | 18 | 19 | [JsonPropertyName("start_time"), JsonConverter(typeof(SpiralAbyssTimeJsonConverter))] 20 | public DateTimeOffset StartTime { get; set; } 21 | 22 | 23 | [JsonPropertyName("end_time"), JsonConverter(typeof(SpiralAbyssTimeJsonConverter))] 24 | public DateTimeOffset EndTime { get; set; } 25 | 26 | 27 | [JsonPropertyName("total_battle_times")] 28 | public int TotalBattleCount { get; set; } 29 | 30 | 31 | [JsonPropertyName("total_win_times")] 32 | public int TotalWinCount { get; set; } 33 | 34 | 35 | [JsonPropertyName("max_floor")] 36 | public string MaxFloor { get; set; } 37 | 38 | /// 39 | /// 出战最多 40 | /// 41 | [JsonPropertyName("reveal_rank")] 42 | public List RevealRank { get; set; } 43 | 44 | /// 45 | /// 击破最多 46 | /// 47 | [JsonPropertyName("defeat_rank")] 48 | public List DefeatRank { get; set; } 49 | 50 | /// 51 | /// 伤害最高 52 | /// 53 | [JsonPropertyName("damage_rank")] 54 | public List DamageRank { get; set; } 55 | 56 | /// 57 | /// 承伤最高 58 | /// 59 | [JsonPropertyName("take_damage_rank")] 60 | public List TakeDamageRank { get; set; } 61 | 62 | /// 63 | /// 元素战技最多 64 | /// 65 | [JsonPropertyName("normal_skill_rank")] 66 | public List NormalSkillRank { get; set; } 67 | 68 | /// 69 | /// 元素爆发最多 70 | /// 71 | [JsonPropertyName("energy_skill_rank")] 72 | public List EnergySkillRank { get; set; } 73 | 74 | 75 | [JsonPropertyName("floors")] 76 | public List Floors { get; set; } 77 | 78 | 79 | [JsonPropertyName("total_star")] 80 | public int TotalStar { get; set; } 81 | 82 | 83 | [JsonPropertyName("is_unlock")] 84 | public bool IsUnlock { get; set; } 85 | 86 | } 87 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/SpiralAbyss/SpiralAbyssLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.Json.Serialization; 5 | 6 | namespace Xunkong.Widget.Hoyolab.SpiralAbyss 7 | { 8 | /// 9 | /// 深境螺旋间 10 | /// 11 | public class SpiralAbyssLevel 12 | { 13 | 14 | [JsonIgnore] 15 | public int Id { get; set; } 16 | 17 | 18 | [JsonPropertyName("index")] 19 | public int Index { get; set; } 20 | 21 | 22 | [JsonPropertyName("star")] 23 | public int Star { get; set; } 24 | 25 | 26 | [JsonPropertyName("max_star")] 27 | public int MaxStar { get; set; } 28 | 29 | 30 | [JsonPropertyName("battles")] 31 | public List Battles { get; set; } 32 | 33 | 34 | [JsonIgnore] 35 | public DateTimeOffset FirstBattleTime => Battles.FirstOrDefault()?.Time ?? new DateTimeOffset(); 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/SpiralAbyss/SpiralAbyssRank.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.SpiralAbyss 4 | { 5 | /// 6 | /// 深境螺旋最值统计 7 | /// 8 | public class SpiralAbyssRank 9 | { 10 | 11 | [JsonIgnore] 12 | public int Id { get; set; } 13 | 14 | 15 | [JsonPropertyName("avatar_id")] 16 | public int AvatarId { get; set; } 17 | 18 | 19 | [JsonPropertyName("avatar_icon")] 20 | public string AvatarIcon { get; set; } 21 | 22 | 23 | [JsonPropertyName("value")] 24 | public int Value { get; set; } 25 | 26 | 27 | [JsonPropertyName("rarity")] 28 | public int Rarity { get; set; } 29 | 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/SpiralAbyss/SpiralAbyssTimeJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.SpiralAbyss 6 | { 7 | public class SpiralAbyssTimeJsonConverter : JsonConverter 8 | { 9 | public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 10 | { 11 | var str = reader.GetString(); 12 | if (int.TryParse(str, out var seconds)) 13 | { 14 | return DateTimeOffset.FromUnixTimeSeconds(seconds); 15 | } 16 | else 17 | { 18 | return DateTimeOffset.Now; 19 | } 20 | } 21 | 22 | public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options) 23 | { 24 | writer.WriteStringValue(value.ToUnixTimeSeconds().ToString()); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesAwardItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.TravelNotes 5 | { 6 | /// 7 | /// 旅行记录原石或摩拉获取记录 8 | /// 9 | public class TravelNotesAwardItem 10 | { 11 | 12 | [JsonIgnore] 13 | public int Id { get; set; } 14 | 15 | public int Uid { get; set; } 16 | 17 | public int Year { get; set; } 18 | 19 | public int Month { get; set; } 20 | 21 | public TravelNotesAwardType Type { get; set; } 22 | 23 | 24 | [JsonPropertyName("action_id")] 25 | public int ActionId { get; set; } 26 | 27 | 28 | [JsonPropertyName("action")] 29 | public string ActionName { get; set; } 30 | 31 | /// 32 | /// 获取时间,UTC+8 33 | /// 34 | [JsonPropertyName("time"), JsonConverter(typeof(TravelNotesDateTimeJsonConverter))] 35 | public DateTime Time { get; set; } 36 | 37 | 38 | [JsonPropertyName("num")] 39 | public int Number { get; set; } 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesAwardType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Xunkong.Widget.Hoyolab.TravelNotes 4 | { 5 | /// 6 | /// 旅行札记收入类型 7 | /// 8 | public enum TravelNotesAwardType 9 | { 10 | 11 | None = 0, 12 | 13 | /// 14 | /// 原石 15 | /// 16 | [Description("原石")] 17 | Primogems = 1, 18 | 19 | /// 20 | /// 摩拉 21 | /// 22 | [Description("摩拉")] 23 | Mora = 2, 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.Json.Serialization; 4 | using Xunkong.Widget.Hoyolab.Core; 5 | 6 | namespace Xunkong.Widget.Hoyolab.TravelNotes 7 | { 8 | public abstract class TravelNotesBase 9 | { 10 | 11 | [JsonPropertyName("uid")] 12 | public int Uid { get; set; } 13 | 14 | 15 | [JsonPropertyName("region"), JsonConverter(typeof(JsonStringEnumConverter))] 16 | public RegionType Region { get; set; } 17 | 18 | /// 19 | /// 米游社 ID 20 | /// 21 | [JsonPropertyName("account_id")] 22 | public int AccountId { get; set; } 23 | 24 | 25 | [JsonPropertyName("nickname")] 26 | public string Nickname { get; set; } 27 | 28 | /// 29 | /// 当前日期 30 | /// 31 | [JsonPropertyName("date"), JsonConverter(typeof(TravelNotesDateJsonConverter))] 32 | public DateTime Date { get; set; } 33 | 34 | /// 35 | /// 当前月 36 | /// 37 | [JsonPropertyName("month")] 38 | public int CurrentMonth { get; set; } 39 | 40 | /// 41 | /// 可查询月份 42 | /// 43 | [JsonPropertyName("optional_month")] 44 | public List OptionalMonth { get; set; } 45 | 46 | /// 47 | /// 获取的数据所在的月份 48 | /// 49 | [JsonPropertyName("data_month")] 50 | public int DataMonth { get; set; } 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesDateJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.TravelNotes 6 | { 7 | public class TravelNotesDateJsonConverter : JsonConverter 8 | { 9 | public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 10 | { 11 | return DateTime.Parse(reader.GetString()); 12 | } 13 | 14 | public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) 15 | { 16 | writer.WriteStringValue(value.ToString("yyyy-MM-dd HH:mm:ss")); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesDateTimeJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.TravelNotes 6 | { 7 | public class TravelNotesDateTimeJsonConverter : JsonConverter 8 | { 9 | public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 10 | { 11 | return DateTime.Parse(reader.GetString()); 12 | } 13 | 14 | public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options) 15 | { 16 | writer.WriteStringValue(value.ToString("yyyy-MM-dd HH:mm:ss")); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesDayData.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.TravelNotes 4 | { 5 | /// 6 | /// 旅行札记每日统计 7 | /// 8 | public class TravelNotesDayData 9 | { 10 | 11 | [JsonPropertyName("current_primogems")] 12 | public int CurrentPrimogems { get; set; } 13 | 14 | 15 | [JsonPropertyName("current_mora")] 16 | public int CurrentMora { get; set; } 17 | 18 | 19 | [JsonPropertyName("last_primogems")] 20 | public int LastPrimogems { get; set; } 21 | 22 | 23 | [JsonPropertyName("last_mora")] 24 | public int LastMora { get; set; } 25 | 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesDetail.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.TravelNotes 6 | { 7 | /// 8 | /// 旅行札记收入记录详细信息 9 | /// 10 | public class TravelNotesDetail : TravelNotesBase, IJsonOnDeserialized 11 | { 12 | 13 | [JsonPropertyName("page")] 14 | public int Page { get; set; } 15 | 16 | 17 | [JsonPropertyName("list")] 18 | public List List { get; set; } 19 | 20 | 21 | /// 22 | /// 反序列化后没有赋值 23 | /// 24 | public void OnDeserialized() 25 | { 26 | if (!(List?.Any() ?? false)) 27 | { 28 | return; 29 | } 30 | var year = List[0].Time.Year; 31 | var month = List[0].Time.Month; 32 | foreach (var item in List) 33 | { 34 | item.Uid = Uid; 35 | item.Year = year; 36 | item.Month = month; 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesMonthData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.TravelNotes 5 | { 6 | /// 7 | /// 旅行札记每月统计 8 | /// 9 | public class TravelNotesMonthData 10 | { 11 | [JsonIgnore] 12 | public int Id { get; set; } 13 | 14 | public int Uid { get; set; } 15 | 16 | public int Year { get; set; } 17 | 18 | public int Month { get; set; } 19 | 20 | 21 | /// 22 | /// 查询月原石数 23 | /// 24 | [JsonPropertyName("current_primogems")] 25 | public int CurrentPrimogems { get; set; } 26 | 27 | /// 28 | /// 查询月摩拉数 29 | /// 30 | [JsonPropertyName("current_mora")] 31 | public int CurrentMora { get; set; } 32 | 33 | /// 34 | /// 查询月上一月原石数 35 | /// 36 | [JsonPropertyName("last_primogems")] 37 | public int LastPrimogems { get; set; } 38 | 39 | /// 40 | /// 查询月上一月摩拉数 41 | /// 42 | [JsonPropertyName("last_mora")] 43 | public int LastMora { get; set; } 44 | 45 | /// 46 | /// 不知道什么意思 47 | /// 48 | [JsonPropertyName("current_primogems_level")] 49 | public int CurrentPrimogemsLevel { get; set; } 50 | 51 | /// 52 | /// 相比于上一月原石的增长率,单位为百分数 53 | /// 54 | [JsonPropertyName("primogems_rate")] 55 | public int PrimogemsChangeRate { get; set; } 56 | 57 | /// 58 | /// 相比于上一月摩拉的增长率,单位为百分数 59 | /// 60 | [JsonPropertyName("mora_rate")] 61 | public int MoraChangeRate { get; set; } 62 | 63 | /// 64 | /// 原石获取来源分组统计 65 | /// 66 | [JsonPropertyName("group_by")] 67 | public List PrimogemsGroupBy { get; set; } 68 | 69 | 70 | } 71 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesPrimogemsMonthGroupStats.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.TravelNotes 4 | { 5 | /// 6 | /// 旅行记录原石获取的分组统计 7 | /// 8 | public class TravelNotesPrimogemsMonthGroupStats 9 | { 10 | 11 | [JsonIgnore] 12 | public int Id { get; set; } 13 | 14 | public int Uid { get; set; } 15 | 16 | public int Year { get; set; } 17 | 18 | public int Month { get; set; } 19 | 20 | 21 | [JsonPropertyName("action_id")] 22 | public int ActionId { get; set; } 23 | 24 | 25 | [JsonPropertyName("action")] 26 | public string ActionName { get; set; } 27 | 28 | 29 | [JsonPropertyName("num")] 30 | public int Number { get; set; } 31 | 32 | 33 | [JsonPropertyName("percent")] 34 | public int Percent { get; set; } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/TravelNotes/TravelNotesSummary.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Xunkong.Widget.Hoyolab.TravelNotes 4 | { 5 | /// 6 | /// 旅行札记总览 7 | /// 8 | public class TravelNotesSummary : TravelNotesBase, IJsonOnDeserialized 9 | { 10 | /// 11 | /// 查询月份的上个月 12 | /// 13 | [JsonPropertyName("data_last_month")] 14 | public int DataLastMonth { get; set; } 15 | 16 | /// 17 | /// 今日数据,查询月份不是当前月时,数据内容均为0 18 | /// 19 | [JsonPropertyName("day_data")] 20 | public TravelNotesDayData DayData { get; set; } 21 | 22 | /// 23 | /// 查询月数据 24 | /// 25 | [JsonPropertyName("month_data")] 26 | public TravelNotesMonthData MonthData { get; set; } 27 | 28 | /// 29 | /// 不知道是什么 30 | /// 31 | [JsonPropertyName("lantern")] 32 | public bool Lantern { get; set; } 33 | 34 | public void OnDeserialized() 35 | { 36 | var year = DataMonth > Date.Month ? Date.Year - 1 : Date.Year; 37 | MonthData.Uid = Uid; 38 | MonthData.Year = year; 39 | MonthData.Month = DataMonth; 40 | foreach (var item in MonthData.PrimogemsGroupBy) 41 | { 42 | item.Uid = Uid; 43 | item.Year = year; 44 | item.Month = DataMonth; 45 | } 46 | } 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Wishlog/QueryParam.cs: -------------------------------------------------------------------------------- 1 | namespace Xunkong.Widget.Hoyolab.Wishlog 2 | { 3 | struct QueryParam 4 | { 5 | public WishType WishType { get; set; } 6 | 7 | public int Page { get; set; } 8 | 9 | public long EndId { get; set; } 10 | 11 | public int Size { get; set; } 12 | 13 | 14 | /// 15 | /// 获取一页祈愿记录时的查询参数 16 | /// 17 | /// 18 | /// 19 | /// 这一页有多少条记录,不超过20,默认6 20 | /// 上一页记录中最后一条的id,为0则从最新的记录开始获取 21 | public QueryParam(WishType type, int page, int size = 6, long endId = 0) 22 | { 23 | WishType = type; 24 | Page = page; 25 | Size = size; 26 | EndId = endId; 27 | } 28 | 29 | public override string ToString() 30 | { 31 | return $"gacha_type={(int)WishType}&page={Page}&size={Size}&end_id={EndId}"; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Wishlog/WishEventInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.Json.Serialization; 4 | using Xunkong.Widget.Hoyolab.Core; 5 | 6 | namespace Xunkong.Widget.Hoyolab.Wishlog 7 | { 8 | public class WishEventInfo 9 | { 10 | 11 | public int Id { get; set; } 12 | 13 | 14 | public WishType WishType { get; set; } 15 | 16 | [JsonIgnore] 17 | public WishType QueryType => WishTypeToQueryType(WishType); 18 | 19 | public string Name { get; set; } 20 | 21 | public string Version { get; set; } 22 | 23 | 24 | [JsonIgnore] 25 | public DateTimeOffset StartTime => TimeStringToTimeOffset(_StartTimeString); 26 | 27 | 28 | [JsonIgnore] 29 | public DateTimeOffset EndTime => TimeStringToTimeOffset(_EndTimeString); 30 | 31 | 32 | [JsonPropertyName("StartTime"), JsonInclude] 33 | #if NativeAOT 34 | public string _StartTimeString { get; private set; } 35 | #else 36 | public string _StartTimeString { get; set; } 37 | #endif 38 | 39 | [JsonPropertyName("EndTime"), JsonInclude] 40 | #if NativeAOT 41 | public string _EndTimeString { get; set; } 42 | #else 43 | public string _EndTimeString { get; private set; } 44 | #endif 45 | 46 | /// 47 | /// Up5星物品,此值不要使用SQL查询 48 | /// 49 | public List Rank5UpItems { get; set; } 50 | 51 | /// 52 | /// Up4星物品,此值不要使用SQL查询 53 | /// 54 | public List Rank4UpItems { get; set; } 55 | 56 | 57 | 58 | private static WishType WishTypeToQueryType(WishType type) 59 | { 60 | switch (type) 61 | { 62 | 63 | case WishType.CharacterEvent_2: 64 | return WishType.CharacterEvent; 65 | default: 66 | return type; 67 | } 68 | } 69 | 70 | 71 | [JsonIgnore] 72 | public static RegionType RegionType { get; set; } 73 | 74 | 75 | private static DateTimeOffset TimeStringToTimeOffset(string str) 76 | { 77 | if (str.Contains("+")) 78 | { 79 | return DateTimeOffset.Parse(str); 80 | } 81 | else 82 | { 83 | string offset; 84 | switch (RegionType) 85 | { 86 | case RegionType.os_usa: 87 | offset = "-05:00"; 88 | break; 89 | case RegionType.os_euro: 90 | offset = "+01:00"; 91 | break; 92 | default: 93 | offset = "+08:00"; 94 | break; 95 | } 96 | return DateTimeOffset.Parse($"{str} {offset}"); 97 | } 98 | } 99 | 100 | } 101 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Wishlog/WishType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Xunkong.Widget.Hoyolab.Wishlog 4 | { 5 | /// 6 | /// 祈愿类型 7 | /// 8 | public enum WishType 9 | { 10 | 11 | /// 12 | /// 新手祈愿 13 | /// 14 | [Description("新手祈愿")] 15 | Novice = 100, 16 | 17 | /// 18 | /// 常驻祈愿 19 | /// 20 | [Description("常驻祈愿")] 21 | Permanent = 200, 22 | 23 | /// 24 | /// 角色活动祈愿 25 | /// 26 | [Description("角色活动祈愿")] 27 | CharacterEvent = 301, 28 | 29 | /// 30 | /// 武器活动祈愿 31 | /// 32 | [Description("武器活动祈愿")] 33 | WeaponEvent = 302, 34 | 35 | /// 36 | /// 角色活动祈愿-2 37 | /// 38 | [Description("角色活动祈愿-2")] 39 | CharacterEvent_2 = 400, 40 | } 41 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Wishlog/WishTypeJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Xunkong.Widget.Hoyolab.Wishlog 6 | { 7 | public class WishTypeJsonConverter : JsonConverter 8 | { 9 | public override WishType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 10 | { 11 | var str = reader.GetString(); 12 | if (int.TryParse(str, out var num)) 13 | { 14 | return (WishType)num; 15 | } 16 | else 17 | { 18 | return 0; 19 | } 20 | } 21 | 22 | public override void Write(Utf8JsonWriter writer, WishType value, JsonSerializerOptions options) 23 | { 24 | writer.WriteStringValue(((int)value).ToString()); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Wishlog/WishlogClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net.Http; 6 | using System.Net.Http.Json; 7 | using System.Text.RegularExpressions; 8 | using System.Threading.Tasks; 9 | 10 | namespace Xunkong.Widget.Hoyolab.Wishlog 11 | { 12 | /// 13 | /// 祈愿记录请求类 14 | /// 15 | public class WishlogClient 16 | { 17 | 18 | private const string CnUrl = "https://hk4e-api.mihoyo.com/event/gacha_info/api/getGachaLog"; 19 | 20 | private const string SeaUrl = "https://hk4e-api-os.mihoyo.com/event/gacha_info/api/getGachaLog"; 21 | 22 | private static readonly string UserProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); 23 | 24 | private static readonly string LogFile_Cn = Path.Combine(UserProfile, @"AppData\LocalLow\miHoYo\原神\output_log.txt"); 25 | 26 | private static readonly string LogFile_Sea = Path.Combine(UserProfile, @"AppData\LocalLow\miHoYo\Genshin Impact\output_log.txt"); 27 | 28 | private readonly HttpClient _httpClient; 29 | 30 | private readonly Random Random; 31 | 32 | /// 33 | /// 获取记录的进度 34 | /// 35 | public event EventHandler<(WishType WishType, int Page)> ProgressChanged; 36 | 37 | 38 | public WishlogClient(HttpClient httpClient = null) 39 | { 40 | Random = new Random(); 41 | if (httpClient is null) 42 | { 43 | _httpClient = new HttpClient(new HttpClientHandler { AutomaticDecompression = System.Net.DecompressionMethods.GZip }); 44 | } 45 | else 46 | { 47 | _httpClient = httpClient; 48 | } 49 | } 50 | 51 | 52 | 53 | /// 54 | /// 从原神的日志文件获取祈愿记录网址(仅 Windows 可用) 55 | /// 56 | /// 是否外服优先 57 | /// 58 | /// 没有找到日志文件,或没有从日志文件中找到祈愿记录网址 59 | public static async Task GetWishlogUrlFromLogFileAsync(bool isSea = false) 60 | { 61 | var file = isSea ? LogFile_Sea : LogFile_Cn; 62 | if (!File.Exists(file)) 63 | { 64 | file = isSea ? LogFile_Cn : LogFile_Sea; 65 | } 66 | if (!File.Exists(file)) 67 | { 68 | throw new FileNotFoundException("Cannot find log file of Genshin Impact."); 69 | } 70 | using (var stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) 71 | { 72 | 73 | using (var reader = new StreamReader(stream)) 74 | { 75 | var log = await reader.ReadToEndAsync(); 76 | var matches = Regex.Matches(log, @"OnGetWebViewPageFinish:(.+#/log)"); 77 | if (matches.Any()) 78 | { 79 | return matches.Last().Value.Replace("OnGetWebViewPageFinish:", ""); 80 | } 81 | else 82 | { 83 | throw new FileNotFoundException("Cannot find wishlog url from log file of Genshin Impact."); 84 | } 85 | } 86 | } 87 | } 88 | 89 | 90 | /// 91 | /// 合并网址和身份验证相关的查询参数 92 | /// 93 | /// 94 | /// 95 | /// 96 | private static string GetBaseAndAuthString(string wishlogUrl) 97 | { 98 | var match = Regex.Match(wishlogUrl, @"(https://webstatic.+#/log)"); 99 | if (!match.Success) 100 | { 101 | throw new HoyolabException(-1, "Url does not fit the requirement."); 102 | } 103 | wishlogUrl = match.Groups[1].Value; 104 | var auth = wishlogUrl.Substring(wishlogUrl.IndexOf('?')).Replace("#/log", ""); 105 | if (wishlogUrl.Contains("webstatic-sea")) 106 | { 107 | return SeaUrl + auth; 108 | } 109 | else 110 | { 111 | return CnUrl + auth; 112 | } 113 | } 114 | 115 | 116 | /// 117 | /// 获取一页祈愿记录 118 | /// 119 | /// 120 | /// 121 | /// 没有数据时返回空集合 122 | /// 123 | private async Task> GetWishlogByParamAsync(string baseString, QueryParam param) 124 | { 125 | var url = $"{baseString}&{param}"; 126 | await Task.Delay(Random.Next(200, 300)); 127 | #if NativeAOT 128 | var response = await _httpClient.GetFromJsonAsync(url, WishlogJsonContext.Default.HoyolabBaseWrapperWishlogWrapper); 129 | #else 130 | var response = await _httpClient.GetFromJsonAsync>(url); 131 | #endif 132 | if (response is null) 133 | { 134 | throw new HoyolabException(-1, "Cannot parse the return data."); 135 | } 136 | if (response.ReturnCode != 0) 137 | { 138 | throw new HoyolabException(response.ReturnCode, response.Message ?? "No return meesage."); 139 | } 140 | return response.Data?.List ?? new List(0); 141 | } 142 | 143 | 144 | /// 145 | /// 获取一种卡池类型的祈愿数据 146 | /// 147 | /// 148 | /// 获取的祈愿id小于最新id即停止 149 | /// 每次api请求获取几条数据,不超过20,默认6 150 | /// 没有数据返回空集合 151 | /// api请求返回值不为零时抛出异常 152 | private async Task> GetWishlogByTypeAsync(string baseString, WishType queryType, long lastId = 0, int size = 20) 153 | { 154 | var param = new QueryParam(queryType, 1, size); 155 | var result = new List(); 156 | while (true) 157 | { 158 | ProgressChanged?.Invoke(this, (queryType, param.Page)); 159 | var list = await GetWishlogByParamAsync(baseString, param); 160 | result.AddRange(list); 161 | if (list.Count == size && list.Last().Id > lastId) 162 | { 163 | param.Page++; 164 | param.EndId = list.Last().Id; 165 | } 166 | else 167 | { 168 | break; 169 | } 170 | } 171 | foreach (var item in result) 172 | { 173 | item.QueryType = queryType; 174 | } 175 | return result; 176 | } 177 | 178 | 179 | /// 180 | /// 获取所有的祈愿数据 181 | /// 182 | /// 183 | /// 184 | /// 一次获取几条记录,[1,20] 185 | /// 以 id 顺序排列,没有数据返回空集合 186 | public async Task> GetAllWishlogAsync(string wishlogUrl, long lastId = 0, int size = 20) 187 | { 188 | var baseUrl = GetBaseAndAuthString(wishlogUrl); 189 | lastId = lastId < 0 ? 0 : lastId; 190 | size = Math.Clamp(size, 1, 20); 191 | var result = new List(); 192 | result.AddRange(await GetWishlogByTypeAsync(baseUrl, WishType.Novice, lastId, size)); 193 | result.AddRange(await GetWishlogByTypeAsync(baseUrl, WishType.Permanent, lastId, size)); 194 | result.AddRange(await GetWishlogByTypeAsync(baseUrl, WishType.CharacterEvent, lastId, size)); 195 | result.AddRange(await GetWishlogByTypeAsync(baseUrl, WishType.WeaponEvent, lastId, size)); 196 | return result.OrderBy(x => x.Id).ToList(); 197 | } 198 | 199 | 200 | /// 201 | /// 获取祈愿记录网址关联的 uid 202 | /// 203 | /// 204 | /// 没有祈愿记录则返回 0 205 | public async Task GetUidAsync(string wishlogUrl) 206 | { 207 | var baseUrl = GetBaseAndAuthString(wishlogUrl); 208 | var param = new QueryParam(WishType.CharacterEvent, 1); 209 | var list = await GetWishlogByParamAsync(baseUrl, param); 210 | if (list.Any()) 211 | { 212 | return list.First().Uid; 213 | } 214 | param.WishType = WishType.Permanent; 215 | list = await GetWishlogByParamAsync(baseUrl, param); 216 | if (list.Any()) 217 | { 218 | return list.First().Uid; 219 | } 220 | param.WishType = WishType.WeaponEvent; 221 | list = await GetWishlogByParamAsync(baseUrl, param); 222 | if (list.Any()) 223 | { 224 | return list.First().Uid; 225 | } 226 | param.WishType = WishType.Novice; 227 | list = await GetWishlogByParamAsync(baseUrl, param); 228 | if (list.Any()) 229 | { 230 | return list.First().Uid; 231 | } 232 | return 0; 233 | } 234 | 235 | } 236 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Wishlog/WishlogItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Wishlog 5 | { 6 | /// 7 | /// 祈愿记录数据 8 | /// 9 | /// 属性已用 标注,使用 序列化时格式与官方一致 10 | /// 11 | public class WishlogItem : IEquatable, IJsonOnSerializing, IJsonOnDeserialized 12 | { 13 | /// 14 | /// 用户Uid 15 | /// 16 | [JsonPropertyName("uid"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] 17 | public int Uid { get; set; } 18 | 19 | /// 20 | /// 祈愿类型(卡池类型) 21 | /// 22 | [JsonPropertyName("gacha_type"), JsonConverter(typeof(WishTypeJsonConverter))] 23 | public WishType WishType { get; set; } 24 | 25 | /// 26 | /// 此值为空 27 | /// 28 | [JsonPropertyName("item_id")] 29 | public string ItemId { get; set; } 30 | 31 | /// 32 | /// 物品数量(暂时都是1) 33 | /// 34 | [JsonPropertyName("count"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] 35 | public int Count { get; set; } = 1; 36 | 37 | /// 38 | /// 时间 39 | /// 40 | [JsonIgnore] 41 | public DateTimeOffset Time { get; set; } 42 | 43 | 44 | /// 45 | /// 字符串形式的时间,时区与账号服务器所在地理位置相关,不要修改此值 46 | /// 47 | [JsonInclude, JsonPropertyName("time")] 48 | #if NativeAOT 49 | public string _TimeString { get; set; } 50 | #else 51 | public string _TimeString { get; private set; } 52 | #endif 53 | 54 | /// 55 | /// 物品名称 56 | /// 57 | [JsonPropertyName("name")] 58 | public string Name { get; set; } 59 | 60 | /// 61 | /// 语言(如zh-cn) 62 | /// 63 | [JsonPropertyName("lang")] 64 | public string Language { get; set; } 65 | 66 | /// 67 | /// 物品类型(角色、武器) 68 | /// 69 | [JsonPropertyName("item_type")] 70 | public string ItemType { get; set; } 71 | 72 | /// 73 | /// 星级 74 | /// 75 | [JsonPropertyName("rank_type"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] 76 | public int RankType { get; set; } 77 | 78 | /// 79 | /// 祈愿Id,这个值很重要,全服唯一 80 | /// 81 | [JsonPropertyName("id"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)] 82 | public long Id { get; set; } 83 | 84 | 85 | /// 86 | /// 查询类型,此值为自行添加的值 87 | /// 88 | [JsonPropertyName("query_type"), JsonConverter(typeof(WishTypeJsonConverter))] 89 | public WishType QueryType { get; set; } 90 | 91 | 92 | public bool Equals(WishlogItem other) 93 | { 94 | return (Uid, Id) == (other?.Uid, other?.Id); 95 | } 96 | 97 | public override int GetHashCode() 98 | { 99 | return (Id, Uid).GetHashCode(); 100 | } 101 | 102 | public void OnSerializing() 103 | { 104 | int offset; 105 | switch (Uid.ToString()[0]) 106 | { 107 | case '6': 108 | offset = -5; 109 | break; 110 | case '7': 111 | offset = -1; 112 | break; 113 | default: 114 | offset = 8; 115 | break; 116 | } 117 | _TimeString = Time.UtcDateTime.AddHours(offset).ToString("yyyy-MM-dd HH:mm:ss"); 118 | } 119 | 120 | public void OnDeserialized() 121 | { 122 | int offset; 123 | switch (Uid.ToString()[0]) 124 | { 125 | case '6': 126 | offset = -5; 127 | break; 128 | case '7': 129 | offset = -1; 130 | break; 131 | default: 132 | offset = 8; 133 | break; 134 | } 135 | var time = DateTime.Parse(_TimeString); 136 | Time = new DateTimeOffset(time, TimeSpan.FromHours(offset)); 137 | } 138 | } 139 | } -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Wishlog/WishlogJsonContext.cs: -------------------------------------------------------------------------------- 1 | #if NativeAOT 2 | 3 | namespace Xunkong.Hoyolab.Wishlog; 4 | 5 | 6 | [JsonSerializable(typeof(WishType[]))] 7 | [JsonSerializable(typeof(HoyolabBaseWrapper))] 8 | [JsonSerializable(typeof(WishlogItem))] 9 | internal partial class WishlogJsonContext : JsonSerializerContext { } 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /Xunkong.Widget/Hoyolab/Wishlog/WishlogWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Xunkong.Widget.Hoyolab.Wishlog 5 | { 6 | internal class WishlogWrapper 7 | { 8 | [JsonPropertyName("page"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)] 9 | public int Page { get; set; } 10 | 11 | [JsonPropertyName("size"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)] 12 | public int Size { get; set; } 13 | 14 | [JsonPropertyName("total"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)] 15 | public int Total { get; set; } 16 | 17 | [JsonPropertyName("list")] 18 | public List List { get; set; } 19 | 20 | [JsonPropertyName("region")] 21 | public string Region { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /Xunkong.Widget/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |