返回提交历史
Modified
HaloPixelToolBox/HaloPixelToolBox.Core/Models/HaloPixelUIModel.cs
+30
-0
Modified
HaloPixelToolBox/HaloPixelToolBox.Core/Utilities/CloudLyricsReader.cs
+3
-0
Modified
HaloPixelToolBox/HaloPixelToolBox/Profiles/CrossVersionProfiles/CloudMusicLyricsProfile.cs
+10
-0
Modified
HaloPixelToolBox/HaloPixelToolBox/ViewModels/CloudMusicLyricsToolPageViewModel.cs
+23
-1
Modified
HaloPixelToolBox/HaloPixelToolBox/Views/CloudMusicLyricsToolPage.xaml
+10
-4
XFEstudio/HaloPixelToolBox
add-添加手动输入解析地址的功能
7bba6d2
代码差异
5 个文件
+76
-5
@@ -1,14 +1,44 @@
1
1
namespace HaloPixelToolBox.Core.Models;
2
2
3
/// <summary>
4
/// 花再像素UI模型
5
/// </summary>
3
6
public enum HaloPixelUIModel
4
7
{
8
/// <summary>
9
/// 时钟
10
/// </summary>
5
11
Clock = 0,
12
/// <summary>
13
/// 游戏
14
/// </summary>
6
15
Game = 1,
16
/// <summary>
17
/// 工作
18
/// </summary>
7
19
Work = 2,
20
/// <summary>
21
/// 阅读
22
/// </summary>
8
23
Read = 3,
24
/// <summary>
25
/// 猫咪
26
/// </summary>
9
27
Cats = 4,
28
/// <summary>
29
/// 狗狗
30
/// </summary>
10
31
Dogs = 5,
32
/// <summary>
33
/// 热门梗图
34
/// </summary>
11
35
Memes = 6,
36
/// <summary>
37
/// 赛博
38
/// </summary>
12
39
Cyber = 7,
40
/// <summary>
41
/// 波
42
/// </summary>
13
43
Waves = 8
14
44
}
@@ -8,6 +8,7 @@ namespace HaloPixelToolBox.Core.Utilities;
8
8
public class CloudMusicLyricsReader
9
9
{
10
10
public nint Address { get; set; }
11
public bool UseInputedAddress { get; set; }
11
12
public FileVersionInfo? VersionInfo { get; set; }
12
13
public Version Version { get; set; } = new();
13
14
public MemoryEditor Editor { get; set; } = new();
@@ -69,6 +70,8 @@ public class CloudMusicLyricsReader
69
70
{
70
71
if (Version.MajorRevision == 0)
71
72
return false;
73
if (UseInputedAddress)
74
return true;
72
75
nint address = 0;
73
76
if (VersionResolverDictionary.TryGetValue(Version.ToString(3), out var resolver))
74
77
address = resolver(Editor);
@@ -23,6 +23,16 @@ public partial class CloudMusicLyricsProfile : XFEProfile
23
23
[ProfileProperty]
24
24
private bool switchBackWhenPause = true;
25
25
/// <summary>
26
/// 使用输入的内存地址
27
/// </summary>
28
[ProfileProperty]
29
private bool useInputedAddress = false;
30
/// <summary>
31
/// 输入的内存地址
32
/// </summary>
33
[ProfileProperty]
34
private string inputedAddress = string.Empty;
35
/// <summary>
26
36
/// 默认歌词显示布局
27
37
/// </summary>
28
38
[ProfileProperty]
@@ -20,24 +20,46 @@ public partial class CloudMusicLyricsToolPageViewModel : ServiceBaseViewModelBas
20
20
[ObservableProperty]
21
21
private bool switchBackWhenPause = CloudMusicLyricsProfile.SwitchBackWhenPause;
22
22
[ObservableProperty]
23
private bool useInputedAddress = CloudMusicLyricsProfile.UseInputedAddress;
24
[ObservableProperty]
25
private string inputedAddress = CloudMusicLyricsProfile.InputedAddress;
26
[ObservableProperty]
23
27
private int switchBackTimeout = CloudMusicLyricsProfile.SwitchBackTimeout;
24
28
[ObservableProperty]
25
29
private string cloudMusicVersion = string.Empty;
26
30
[ObservableProperty]
27
31
private string supportedVersion = CloudMusicLyricsReader.VersionResolverDictionary.Keys.FirstOrDefault() ?? string.Empty;
28
32
public HaloPixelDevice Device { get; set; } = new();
29
public CloudMusicLyricsReader Reader { get; set; } = new();
33
public CloudMusicLyricsReader Reader { get; set; }
30
34
31
35
public ISettingService SettingService { get; } = ServiceManager.GetService<ISettingService>();
32
36
33
37
partial void OnEnableCloudMusicLyricsChanged(bool value) => CloudMusicLyricsProfile.EnableCloudMusicLyrics = value;
34
38
39
partial void OnUseInputedAddressChanged(bool value)
40
{
41
CloudMusicLyricsProfile.UseInputedAddress = value;
42
Reader.UseInputedAddress = value;
43
}
44
45
partial void OnInputedAddressChanged(string value)
46
{
47
CloudMusicLyricsProfile.InputedAddress = value;
48
Reader.Address = value.IsNullOrWhiteSpace() ? 0 : new nint(Convert.ToInt64(value, 16));
49
}
50
35
51
partial void OnSwitchBackWhenPauseChanged(bool value) => CloudMusicLyricsProfile.SwitchBackWhenPause = value;
36
52
37
53
partial void OnSwitchBackTimeoutChanged(int value) => CloudMusicLyricsProfile.SwitchBackTimeout = value;
38
54
39
55
public CloudMusicLyricsToolPageViewModel()
40
56
{
57
Console.WriteLine("初始化网易云歌词读取器");
58
Reader = new CloudMusicLyricsReader
59
{
60
UseInputedAddress = UseInputedAddress,
61
Address = InputedAddress.IsNullOrWhiteSpace() ? 0 : new nint(Convert.ToInt64(InputedAddress, 16))
62
};
41
63
Console.WriteLine("准备启动网易云后台线程");
42
64
Task.Run(async () =>
43
65
{
@@ -44,18 +44,24 @@
44
44
</Grid>
45
45
<TextBlock Text="{x:Bind ViewModel.SupportedVersion, Mode=OneWay, Converter={StaticResource StringFormatConverter}, ConverterParameter='网易云版本 (当前支持版本 (0) )'}" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
46
46
<TextBlock Text="{x:Bind ViewModel.CloudMusicVersion, Mode=OneWay}" Style="{StaticResource BodyTextBlockStyle}"/>
47
<TextBlock Text="启用状态" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
47
<TextBlock Text="功能" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
48
48
<controls:SettingsCard Header="启用歌词同步" Description="启用后,网易云的歌词会实时显示在花再 Halo Pixel 音响上">
49
49
<ToggleSwitch IsOn="{x:Bind ViewModel.EnableCloudMusicLyrics, Mode=TwoWay}"/>
50
50
</controls:SettingsCard>
51
<controls:SettingsExpander Header="手动输入内存地址" Description="解析使用手动输入的内存地址">
52
<ToggleSwitch x:Name="useInputedAddressToggleSwitch" IsOn="{x:Bind ViewModel.UseInputedAddress, Mode=TwoWay}"/>
53
<controls:SettingsExpander.Items>
54
<controls:SettingsCard Header="内存地址" Description="设置要解析的内存地址" IsEnabled="{x:Bind useInputedAddressToggleSwitch.IsOn, Mode=OneWay}">
55
<TextBox Text="{x:Bind ViewModel.InputedAddress, Mode=TwoWay}"/>
56
</controls:SettingsCard>
57
</controls:SettingsExpander.Items>
58
</controls:SettingsExpander>
51
59
<TextBlock Text="个性化" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
52
60
<controls:SettingsExpander Header="暂停后切换回默认界面" Description="一段时间后自动切换回时钟界面等音响自带页面">
53
61
<ToggleSwitch x:Name="switchBackWhenPauseToggleSwitch" IsOn="{x:Bind ViewModel.SwitchBackWhenPause, Mode=TwoWay}"/>
54
62
<controls:SettingsExpander.Items>
55
63
<controls:SettingsCard Header="暂停延迟" Description="设置多长时间后,音响切换回默认界面" IsEnabled="{x:Bind switchBackWhenPauseToggleSwitch.IsOn, Mode=OneWay}">
56
<StackPanel Orientation="Horizontal" Spacing="20">
57
<NumberBox SpinButtonPlacementMode="Compact" Value="{x:Bind ViewModel.SwitchBackTimeout, Mode=TwoWay}"/>
58
</StackPanel>
64
<NumberBox SpinButtonPlacementMode="Compact" Value="{x:Bind ViewModel.SwitchBackTimeout, Mode=TwoWay}"/>
59
65
</controls:SettingsCard>
60
66
<controls:SettingsCard Header="暂停界面" Description="设置暂停后切换回的默认界面" IsEnabled="{x:Bind switchBackWhenPauseToggleSwitch.IsOn, Mode=OneWay}">
61
67
<ComboBox x:Name="defaultHaloPixelUIModelComboBox" Tag="HaloPixelToolBox.Profiles.CrossVersionProfiles.CloudMusicLyricsProfile.DefaultHaloPixelUIModel">