-
Notifications
You must be signed in to change notification settings - Fork 11
/
ConfigManager.cs
171 lines (149 loc) · 5.17 KB
/
ConfigManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
using System.IO;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
namespace SinmaiAssist
{
public class ConfigManager
{
private Config _config;
// 初始化方法,加载配置文件
public void Initialize(string yamlFilePath)
{
var deserializer = new DeserializerBuilder()
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.Build();
_config = deserializer.Deserialize<Config>(File.ReadAllText(yamlFilePath));
}
// 提供公共属性访问
public CommonConfig Common => _config.Common;
public CheatConfig Cheat => _config.Cheat;
public FixConfig Fix => _config.Fix;
public ModSettingConfig ModSetting => _config.ModSetting;
public string GetConfigAsYaml()
{
var serializer = new SerializerBuilder().Build();
return serializer.Serialize(_config);
}
}
public class Config
{
public CommonConfig Common { get; set; }
public CheatConfig Cheat { get; set; }
public FixConfig Fix { get; set; }
public ModSettingConfig ModSetting { get; set; }
}
public class DummyLoginConfig
{
public bool Enable { get; set; }
public int DefaultUserId { get; set; }
}
public class CustomCameraIdConfig
{
public bool Enable { get; set; }
public int ChimeCameraId { get; set; }
public int LeftQrCameraId { get; set; }
public int RightQrCameraId { get; set; }
public int PhotoCameraId { get; set; }
}
public class CommonConfig
{
public bool InfinityTimer { get; set; }
public bool DisableMask { get; set; }
public bool DisableBackground { get; set; }
public bool ShowFPS { get; set; }
public bool ForceQuickRetry { get; set; }
public bool ForwardATouchRegionToButton { get; set; }
public bool SkipFade { get; set; }
public bool SkipWarningScreen { get; set; }
public bool QuickBoot { get; set; }
public bool BlockCoin { get; set; }
public bool IgnoreAnyGameInformation { get; set; }
public bool ChangeDefaultOption { get; set; }
public bool ChangeFadeStyle { get; set; }
public SinglePlayerConfig SinglePlayer { get; set; }
public NetworkLoggerConfig NetworkLogger { get; set; }
public CustomVersionTextConfig CustomVersionText { get; set; }
public DummyLoginConfig DummyLogin { get; set; }
public CustomCameraIdConfig CustomCameraId { get; set; }
public ChangeGameSettingsConfig ChangeGameSettings { get; set; }
}
public class SinglePlayerConfig
{
public bool Enable { get; set; }
public bool HideSubMonitor { get; set; }
}
public class NetworkLoggerConfig
{
public bool Enable { get; set; }
public bool PrintToConsole { get; set; }
}
public class CustomVersionTextConfig
{
public bool Enable { get; set; }
public string VersionText { get; set; }
}
public class ChangeGameSettingsConfig
{
public bool Enable { get; set; }
public bool CodeRead { get; set; }
public bool IconPhoto { get; set; }
public bool UploadPhoto { get; set; }
public bool CharaSelect { get; set; }
}
public class CheatConfig
{
public bool AutoPlay { get; set; }
public bool FastSkip { get; set; }
public bool ChartTimer { get; set; }
public bool AllCollection { get; set; }
public bool UnlockEvent { get; set; }
public bool UnlockMusic { get; set; }
public bool UnlockMaster { get; set; }
public bool SaveUnlockMusic { get; set; }
public bool SaveUnlockMaster { get; set; }
public bool ResetLoginBonusRecord { get; set; }
public bool ForceCurrentIsBest { get; set; }
public bool SetAllCharacterAsSameAndLock { get; set; }
public RewriteLoginBonusStampConfig RewriteLoginBonusStamp { get; set; }
}
public class FixConfig
{
public bool DisableEncryption { get; set; }
public bool DisableReboot { get; set; }
public bool SkipVersionCheck { get; set; }
public RewriteNoteJudgeTimingConfig RewriteNoteJudgeTiming { get; set; }
}
public class RewriteNoteJudgeTimingConfig
{
public bool Enable { get; set; }
public float AdjustTiming { get; set; }
public float JudgeTiming { get; set; }
}
public class ModSettingConfig
{
public bool ShowInfo { get; set; }
public bool ShowPanel { get; set; }
public bool LogUnity { get; set; }
public bool SafeMode { get; set; }
}
public class RewriteLoginBonusStampConfig
{
public bool Enable { get; set; }
private uint _point;
public uint Point
{
get => _point;
set
{
if (value is > 0 and < 10)
{
_point = value;
}
else
{
_point = 0;
}
}
}
}
}