|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
| 1 | +using System; |
3 | 2 | using Common.BasicHelper.Graphics.Screen; |
4 | 3 | using KitX.Core.Contract.Configuration; |
5 | 4 | using Serilog.Events; |
@@ -52,309 +51,4 @@ public class AppConfig : IAppConfig, IConfigWithMetadata |
52 | 51 | IIOConf IAppConfig.IO { get => IO; set => IO = (Config_IO?)value ?? new(); } |
53 | 52 | IActivityConf IAppConfig.Activity { get => Activity; set => Activity = (Config_Activity?)value ?? new(); } |
54 | 53 | ILoadersConf IAppConfig.Loaders { get => Loaders; set => Loaders = (Config_Loaders?)value ?? new(); } |
55 | | - |
56 | | - /// <summary> |
57 | | - /// Application configuration section |
58 | | - /// </summary> |
59 | | - public class Config_App : IAppConf |
60 | | - { |
61 | | - public string IconFileName { get; set; } = "KitX-Icon-1920x-margin-2x.png"; |
62 | | - |
63 | | - public string CoverIconFileName { get; set; } = "KitX-Icon-Background.png"; |
64 | | - |
65 | | - public string AppLanguage { get; set; } = "zh-cn"; |
66 | | - |
67 | | - public string Theme { get; set; } = "Follow"; |
68 | | - |
69 | | - public string ThemeColor { get; set; } = "#FF3873D9"; |
70 | | - |
71 | | - public Dictionary<string, string> SurpportLanguages { get; set; } = |
72 | | - new() |
73 | | - { |
74 | | - { "zh-cn", "中文 (简体)" }, |
75 | | - { "zh-tw", "中文 (繁體)" }, |
76 | | - { "ru-ru", "Русский" }, |
77 | | - { "en-us", "English (US)" }, |
78 | | - { "fr-fr", "Français" }, |
79 | | - { "ja-jp", "日本語" }, |
80 | | - { "ko-kr", "한국어" }, |
81 | | - }; |
82 | | - |
83 | | - public string LocalPluginsFileFolder { get; set; } = "./Plugins/"; |
84 | | - |
85 | | - public string LocalPluginsDataFolder { get; set; } = "./PluginsDatas/"; |
86 | | - |
87 | | - public bool DeveloperSetting { get; set; } = false; |
88 | | - |
89 | | - public bool ShowAnnouncementWhenStart { get; set; } = true; |
90 | | - |
91 | | - public ulong RanTime { get; set; } = 0; |
92 | | - |
93 | | - public int LastBreakAfterExit { get; set; } = 2000; |
94 | | - } |
95 | | - |
96 | | - /// <summary> |
97 | | - /// Windows configuration section |
98 | | - /// </summary> |
99 | | - public class Config_Windows : IWindowsConf |
100 | | - { |
101 | | - public Config_MainWindow MainWindow { get; set; } = new(); |
102 | | - |
103 | | - public Config_AnnouncementWindow AnnouncementWindow { get; set; } = new(); |
104 | | - |
105 | | - // Explicit interface implementation with setters |
106 | | - IMainWindowConf IWindowsConf.MainWindow { get => MainWindow; set => MainWindow = (Config_MainWindow?)value ?? new(); } |
107 | | - IAnnouncementWindowConf IWindowsConf.AnnouncementWindow { get => AnnouncementWindow; set => AnnouncementWindow = (Config_AnnouncementWindow?)value ?? new(); } |
108 | | - |
109 | | - /// <summary> |
110 | | - /// Main window configuration |
111 | | - /// </summary> |
112 | | - public class Config_MainWindow : IMainWindowConf |
113 | | - { |
114 | | - private Resolution _size = Resolution.Parse("1280x720"); |
115 | | - private Distances _location = new(left: -1, top: -1); |
116 | | - |
117 | | - /// <summary> |
118 | | - /// Window size (strong type) |
119 | | - /// </summary> |
120 | | - public Resolution Size |
121 | | - { |
122 | | - get => _size; |
123 | | - set => _size = value; |
124 | | - } |
125 | | - |
126 | | - /// <summary> |
127 | | - /// Window location (strong type) |
128 | | - /// </summary> |
129 | | - public Distances Location |
130 | | - { |
131 | | - get => _location; |
132 | | - set => _location = value; |
133 | | - } |
134 | | - |
135 | | - /// <summary> |
136 | | - /// Window state (strong type) |
137 | | - /// </summary> |
138 | | - public WindowState WindowState { get; set; } = WindowState.Normal; |
139 | | - |
140 | | - public bool IsHidden { get; set; } = false; |
141 | | - |
142 | | - public Dictionary<string, string> Tags { get; set; } = new() { { "SelectedPage", "Page_Home" } }; |
143 | | - |
144 | | - public bool EnabledMica { get; set; } = true; |
145 | | - |
146 | | - public int GreetingTextCount_Morning { get; set; } = 5; |
147 | | - |
148 | | - public int GreetingTextCount_Noon { get; set; } = 3; |
149 | | - |
150 | | - public int GreetingTextCount_AfterNoon { get; set; } = 3; |
151 | | - |
152 | | - public int GreetingTextCount_Evening { get; set; } = 2; |
153 | | - |
154 | | - public int GreetingTextCount_Night { get; set; } = 4; |
155 | | - |
156 | | - public int GreetingUpdateInterval { get; set; } = 10; |
157 | | - } |
158 | | - |
159 | | - /// <summary> |
160 | | - /// Announcement window configuration |
161 | | - /// </summary> |
162 | | - public class Config_AnnouncementWindow : IAnnouncementWindowConf |
163 | | - { |
164 | | - private Resolution _size = Resolution.Parse("1280x720"); |
165 | | - private Distances _location = new(left: -1, top: -1); |
166 | | - |
167 | | - /// <summary> |
168 | | - /// Window size (strong type) |
169 | | - /// </summary> |
170 | | - public Resolution Size |
171 | | - { |
172 | | - get => _size; |
173 | | - set => _size = value; |
174 | | - } |
175 | | - |
176 | | - /// <summary> |
177 | | - /// Window location (strong type) |
178 | | - /// </summary> |
179 | | - public Distances Location |
180 | | - { |
181 | | - get => _location; |
182 | | - set => _location = value; |
183 | | - } |
184 | | - } |
185 | | - } |
186 | | - |
187 | | - /// <summary> |
188 | | - /// Pages configuration section |
189 | | - /// </summary> |
190 | | - public class Config_Pages : IPagesConf |
191 | | - { |
192 | | - public Config_HomePage Home { get; set; } = new(); |
193 | | - |
194 | | - public Config_DevicePage Device { get; set; } = new(); |
195 | | - |
196 | | - public Config_MarketPage Market { get; set; } = new(); |
197 | | - |
198 | | - public Config_SettingsPage Settings { get; set; } = new(); |
199 | | - |
200 | | - // Explicit interface implementation with setters |
201 | | - IHomePageConf IPagesConf.Home { get => Home; set => Home = (Config_HomePage?)value ?? new(); } |
202 | | - IDevicePageConf IPagesConf.Device { get => Device; set => Device = (Config_DevicePage?)value ?? new(); } |
203 | | - IMarketPageConf IPagesConf.Market { get => Market; set => Market = (Config_MarketPage?)value ?? new(); } |
204 | | - ISettingsPageConf IPagesConf.Settings { get => Settings; set => Settings = (Config_SettingsPage?)value ?? new(); } |
205 | | - |
206 | | - /// <summary> |
207 | | - /// Home page configuration |
208 | | - /// </summary> |
209 | | - public class Config_HomePage : IHomePageConf |
210 | | - { |
211 | | - public NavigationViewPaneDisplayMode NavigationViewPaneDisplayMode { get; set; } = NavigationViewPaneDisplayMode.Auto; |
212 | | - |
213 | | - public string SelectedViewName { get; set; } = "View_Recent"; |
214 | | - |
215 | | - public bool IsNavigationViewPaneOpened { get; set; } = true; |
216 | | - |
217 | | - public bool UseAreaExpanded { get; set; } = true; |
218 | | - } |
219 | | - |
220 | | - /// <summary> |
221 | | - /// Device page configuration |
222 | | - /// </summary> |
223 | | - public class Config_DevicePage : IDevicePageConf { } |
224 | | - |
225 | | - /// <summary> |
226 | | - /// Market page configuration |
227 | | - /// </summary> |
228 | | - public class Config_MarketPage : IMarketPageConf { } |
229 | | - |
230 | | - /// <summary> |
231 | | - /// Settings page configuration |
232 | | - /// </summary> |
233 | | - public class Config_SettingsPage : ISettingsPageConf |
234 | | - { |
235 | | - public NavigationViewPaneDisplayMode NavigationViewPaneDisplayMode { get; set; } = NavigationViewPaneDisplayMode.Auto; |
236 | | - |
237 | | - public string SelectedViewName { get; set; } = "View_General"; |
238 | | - |
239 | | - public bool PaletteAreaExpanded { get; set; } = false; |
240 | | - |
241 | | - public bool WebRelatedAreaExpanded { get; set; } = true; |
242 | | - |
243 | | - public bool WebRelatedAreaOfNetworkInterfacesExpanded { get; set; } = false; |
244 | | - |
245 | | - public bool LogRelatedAreaExpanded { get; set; } = true; |
246 | | - |
247 | | - public bool UpdateRelatedAreaExpanded { get; set; } = true; |
248 | | - |
249 | | - public bool AboutAreaExpanded { get; set; } = false; |
250 | | - |
251 | | - public bool AuthorsAreaExpanded { get; set; } = false; |
252 | | - |
253 | | - public bool LinksAreaExpanded { get; set; } = false; |
254 | | - |
255 | | - public bool ThirdPartyLicensesAreaExpanded { get; set; } = false; |
256 | | - |
257 | | - public bool IsNavigationViewPaneOpened { get; set; } = true; |
258 | | - } |
259 | | - } |
260 | | - |
261 | | - /// <summary> |
262 | | - /// Web configuration section |
263 | | - /// </summary> |
264 | | - public class Config_Web : IWebConf |
265 | | - { |
266 | | - public double DelayStartSeconds { get; set; } = 0.5; |
267 | | - |
268 | | - public string ApiServer { get; set; } = "api.catrol.cn"; |
269 | | - |
270 | | - public string ApiPath { get; set; } = "/apps/kitx/"; |
271 | | - |
272 | | - public int DevicesViewRefreshDelay { get; set; } = 1000; |
273 | | - |
274 | | - public List<string>? AcceptedNetworkInterfaces { get; set; } = null; |
275 | | - |
276 | | - public int? UserSpecifiedDevicesServerPort { get; set; } = null; |
277 | | - |
278 | | - public int? UserSpecifiedPluginsServerPort { get; set; } = null; |
279 | | - |
280 | | - public int UdpPortSend { get; set; } = 23404; |
281 | | - |
282 | | - public int UdpPortReceive { get; set; } = 24040; |
283 | | - |
284 | | - public int UdpSendFrequency { get; set; } = 1000; |
285 | | - |
286 | | - public string UdpBroadcastAddress { get; set; } = "224.0.0.0"; |
287 | | - |
288 | | - public string IPFilter { get; set; } = "192.168"; |
289 | | - |
290 | | - public int SocketBufferSize { get; set; } = 1024 * 100; |
291 | | - |
292 | | - public int DeviceInfoTTLSeconds { get; set; } = 7; |
293 | | - |
294 | | - public bool DisableRemovingOfflineDeviceCard { get; set; } = false; |
295 | | - |
296 | | - public string UpdateServer { get; set; } = "api.catrol.cn"; |
297 | | - |
298 | | - public string UpdatePath { get; set; } = "/apps/kitx/%platform%/"; |
299 | | - |
300 | | - public string UpdateDownloadPath { get; set; } = "/apps/kitx/update/%platform%/"; |
301 | | - |
302 | | - public string UpdateChannel { get; set; } = "stable"; |
303 | | - |
304 | | - public string UpdateSource { get; set; } = "latest-components.json"; |
305 | | - |
306 | | - public int DebugServicesServerPort { get; set; } = 7777; |
307 | | - } |
308 | | - |
309 | | - /// <summary> |
310 | | - /// Log configuration section |
311 | | - /// </summary> |
312 | | - public class Config_Log : ILogConf |
313 | | - { |
314 | | - public long LogFileSingleMaxSize { get; set; } = 1024 * 1024 * 10; // 10MB |
315 | | - |
316 | | - public string LogFilePath { get; set; } = "./Log/"; |
317 | | - |
318 | | - public string LogTemplate { get; set; } = "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] {Message:lj}{NewLine}{Exception}"; |
319 | | - |
320 | | - public int LogFileMaxCount { get; set; } = 50; |
321 | | - |
322 | | - public int LogFileFlushInterval { get; set; } = 30; |
323 | | - |
324 | | -#if DEBUG |
325 | | - |
326 | | - public LogEventLevel LogLevel { get; set; } = LogEventLevel.Information; |
327 | | - |
328 | | -#else |
329 | | - |
330 | | - public LogEventLevel LogLevel { get; set; } = LogEventLevel.Warning; |
331 | | - |
332 | | -#endif |
333 | | - } |
334 | | - |
335 | | - /// <summary> |
336 | | - /// IO configuration section |
337 | | - /// </summary> |
338 | | - public class Config_IO : IIOConf |
339 | | - { |
340 | | - public int UpdatingCheckPerThreadFilesCount { get; set; } = 20; |
341 | | - |
342 | | - public int OperatingSystemVersionUpdateInterval { get; set; } = 60; |
343 | | - } |
344 | | - |
345 | | - /// <summary> |
346 | | - /// Activity configuration section |
347 | | - /// </summary> |
348 | | - public class Config_Activity : IActivityConf |
349 | | - { |
350 | | - public int TotalRecorded { get; set; } = 0; |
351 | | - } |
352 | | - |
353 | | - /// <summary> |
354 | | - /// Loaders configuration section |
355 | | - /// </summary> |
356 | | - public class Config_Loaders : ILoadersConf |
357 | | - { |
358 | | - public string InstallPath { get; set; } = "./Loaders/"; |
359 | | - } |
360 | 54 | } |
0 commit comments