Skip to content

Commit

Permalink
Fix & Feat: Support dynamic webCache directory
Browse files Browse the repository at this point in the history
  • Loading branch information
TremblingMoeNew committed Jul 19, 2023
1 parent 33a822c commit c935416
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 35 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更新日志

## V1.2.1

- 修复无法获取1.2以上版本《崩坏:星穹铁道》缓存信息的错误

## V1.2.0

- 添加“设置->用户”页;允许切换用户以及移除用户
Expand Down
3 changes: 3 additions & 0 deletions DodocoTales.StarRail/DodocoTales.StarRail.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileSystemGlobbing.7.0.0\lib\net462\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Win32.Registry, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Win32.Registry.5.0.0\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
</Reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,17 @@ public void Import()
private Dictionary<string, string> KnownApplication = new Dictionary<string, string>
{
{ "DodocoTales.StarRail", "星穹铁道跃迁观测工具" },
{ "star-rail-warp-export", "崩坏:星穹铁道跃迁记录导出工具 (biuuu)" },
{ "star-rail-gacha" , "崩坏:星穹铁道抽卡导出工具 (DancingSnow0517)" },
{ "StarRailTools", "崩坏:星穹铁道跃迁记录导出工具 (cntvc)" },
{ "star-rail-warp-export", "崩坏星穹铁道跃迁记录导出工具 (biuuu)" },
{ "star-rail-gacha" , "崩坏星穹铁道抽卡导出工具 (DancingSnow0517)" },
{ "StarRailTools", "崩坏星穹铁道跃迁记录导出工具 (cntvc)" },
{ "StarRailToolkit", "《崩坏:星穹铁道》工具箱 (LittleNyima)" },
{ "asta", "Asta (AuroraZiling)" },
{ "SRCat", "SRCat (BoxCatTeam)" },
{ "star-rail-gacha-export", "「崩坏 · 星穹铁道」 跃迁记录导出脚本 (vikiboss)" },
{ "star-rail-gacha-export", "「崩坏·星穹铁道」 跃迁记录导出脚本 (vikiboss)" },
{ "com.lgou2w.hoyo.gacha", "HoYo.Gacha (lgou2w)" },
{ "Starward", "Starward (Scighost)" },
{ "PaiGram", "PaiGram (PaiGramTeam)" },
{ "SRTools", "星轨工具箱 (JamXi233)" },
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class DDCLUserDataLibrary
public readonly string UserDataFileSearchPattern = "userlog_*.json";
public readonly string UserDataFileRegexPattern = @"userlog_(\d+)\.json";
public readonly string UserDataFileOpenPattern = "userdata/userlog_{0}.json";
public readonly string UserBackupFileOpenPattern = "userdata/backup_{0}_{1}.json";
public readonly string UserBackupFileOpenPattern = "userdata/backup_{0}_{1:yyyyMMddhhmmss}.json";
public Dictionary<long, DDCLUserGachaLog> U { get; set; }

public DDCLUserDataLibrary()
Expand Down
14 changes: 12 additions & 2 deletions DodocoTales.StarRail/Loader/DDCGGameClientLoader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using DodocoTales.SR.Library;
using DodocoTales.SR.Library.Enums;
using DodocoTales.SR.Library.GameClient.Models;
using Microsoft.Extensions.FileSystemGlobbing;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -101,15 +102,24 @@ public DDCLGameClientItem LoadGameClientItemFromExecutablePath(string execpath)
}


readonly string WebCachePath = @"/webCaches/Cache/Cache_Data/data_2";
readonly string WebCachePath = @"./webCaches/**/Cache_Data/data_2";
// 用CN API强行获取OS或反之,会获得缺失name、item_type与rank_type的记录,造成解析错误
readonly string authkey_pattern_cn = @"1/0/\S+\?(\S+&game_biz=hkrpg_cn)";
readonly string authkey_pattern_os = @"1/0/\S+\?(\S+&game_biz=hkrpg_global)";

public string GetNewestWebCache(string dirpath)
{
Matcher matcher = new Matcher();
matcher.AddInclude(WebCachePath);
return matcher.GetResultsInFullPath(dirpath).Select(x => new { Path = x, LastModifiedTime = new FileInfo(x).LastWriteTimeUtc })
.OrderByDescending(x => x.LastModifiedTime).FirstOrDefault()?.Path ?? null;
}

public string GetAuthkeyFromWebCache(DDCLGameClientItem client)
{
string authkey = null;
string path = client.Path + WebCachePath;
string path = GetNewestWebCache(client.Path);
if (path == null) return null;
string authkey_pattern;
switch (client.ClientType)
{
Expand Down
2 changes: 1 addition & 1 deletion DodocoTales.StarRail/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:local="clr-namespace:DodocoTales"
xmlns:vm="clr-namespace:DodocoTales.SR.Gui.ViewModels"
mc:Ignorable="d"
Title="星穹铁道跃迁观测工具 - 1.2.0" Height="760" Width="1160"
Title="星穹铁道跃迁观测工具 - 1.2.1" Height="760" Width="1160"
Unloaded="Window_Unloaded">
<Window.DataContext>
<vm:DDCVMainWindowVM x:Name="VM"/>
Expand Down
4 changes: 2 additions & 2 deletions DodocoTales.StarRail/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
1 change: 1 addition & 0 deletions DodocoTales.StarRail/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<package id="LiveChartsCore.SkiaSharpView" version="2.0.0-beta.240" targetFramework="net472" />
<package id="LiveChartsCore.SkiaSharpView.WPF" version="2.0.0-beta.240" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net472" />
<package id="Microsoft.Extensions.FileSystemGlobbing" version="7.0.0" targetFramework="net472" />
<package id="Microsoft.Win32.Registry" version="5.0.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="Panuon.UI.Silver" version="1.1.3.4" targetFramework="net472" />
Expand Down
38 changes: 13 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
# 星穹铁道跃迁观测工具

基于开发中止的原神祈愿记录导出工具[“嘟嘟可故事集”(重制版本)](https://github.com/TremblingMoeNew/DodocoTales) 开发的崩坏:星穹铁道跃迁(抽卡)记录导出工具
星穹铁道跃迁观测工具(Star Rail Warp Observe), 简称Starwo,是一款针对游戏《崩坏:星穹铁道》开发的抽卡历史记录导出与管理工具

正式名称“星穹铁道跃迁观测工具” (Star Rail Warp Observe),代号*DodocoTales - Star Rail*
*本工具为基于为游戏《原神》所设计、但开发暂停的祈愿记录导出工具[“嘟嘟可故事集”重制版本](https://github.com/TremblingMoeNew/DodocoTales)所改造而来的姊妹版本。Codename: DodocoTales.StarRail.*

本工具的主要特色为,采用游戏版本-卡池-轮次的三级结构对玩家的跃迁历史记录进行整理与展示,帮助玩家更好的梳理抽取概率提升的五星单位的过程中的抽取情况。同时,仪表盘中也对您的四星与五星单位抽取概率相对于期望值的高低进行了展示。

本工具仅支持简体中文语言的界面及跃迁历史记录项。

由于其基于的原始代码并未完成“设置 - 用户管理”页面以及导入导出界面,本工具在早期版本将不具备用户切换以及导入导出功能。

当前仅简体中文语言。



## 迁移状态

- [ ] ~~单位数据库(移除)~~
- [x] 卡池数据库
- [x] 从缓存获取Authkey
- [x] 代理模式获取Authkey
- [x] 通过历史记录页API获取用户跃迁记录并保存
- [x] 首页UI
- [x] 按版本统计页
- [x] 卡池抽取情况详情页
- [x] (迁移完毕)
---

- [x] 自动更新
- [x] 跃迁记录导入
- [x] 跃迁记录导出
- [x] 国际服支持(未测试)
---
本工具基于.NET Framework 4.7.2构建,依赖以下项目:

- [JamesNK/Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)
- [Mochengvia/PanuonUI.Silver](https://github.com/Mochengvia/PanuonUI.Silver)
- [beto-rodriguez/LiveCharts2](https://github.com/beto-rodriguez/LiveCharts2)
- [CommunityToolkit/dotnet](https://github.com/CommunityToolkit/dotnet)
- [CommunityToolkit/WindowsCommunityToolkit](https://github.com/CommunityToolkit/WindowsCommunityToolkit)
- [justcoding121/titanium-web-proxy](https://github.com/justcoding121/Titanium-Web-Proxy)

- [ ] 记录账号管理(待开发)
本工具为[UIGF组织](https://uigf.org/zh)的成员。

0 comments on commit c935416

Please sign in to comment.