This repository has been archived by the owner on May 11, 2018. It is now read-only.
forked from Provissy/HoppoPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HoppoPluginSettings.cs
253 lines (209 loc) · 6.53 KB
/
HoppoPluginSettings.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
using Grabacr07.KanColleViewer.Models;
using Grabacr07.KanColleViewer.Models.Data.Xml;
using MetroRadiance;
using System;
using System.IO;
using Livet.Messaging;
using Livet;
using Livet.Commands;
using Livet.EventListeners;
using Livet.Behaviors;
using Livet.Converters;
using System.Windows.Forms;
using System.Diagnostics;
namespace HoppoPlugin
{
[Serializable]
public class HoppoPluginSettings : NotificationObject
{
public static readonly string KCVSettingsPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"grabacr.net",
"KanColleViewer\\");
public static readonly string HPSettingsPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"grabacr.net",
"KanColleViewer",
"HoppoPluginSettings.xml");
public static readonly string UsageRecordPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"grabacr.net",
"KanColleViewer",
"HoppoPluginUsageRecordOf5.0Plus");
public static HoppoPluginSettings Current { get; set; }
public static void Load()
{
try
{
// Load settings to instance from XML file.
Current = HPSettingsPath.ReadXml<HoppoPluginSettings>();
}
catch
{
Current = new HoppoPluginSettings();
}
}
public void Save()
{
try
{
// Save settings to XML file.
this.WriteXml(HPSettingsPath);
}
catch { }
}
public void FirstTimeSave()
{
try
{
StreamWriter s = new StreamWriter(UsageRecordPath);
s.WriteLine("6.0");
s.Close();
}
catch (Exception ex)
{
MessageBox.Show("ERROR" + ex.ToString());
}
this.WriteXml(HPSettingsPath);
MessageBox.Show("即将关闭KanColleViewer!\n请重新启动KanColleViewer!\n在“Sounds”文件夹内可设置声音文件");
(Process.GetProcessesByName("KanColleViewer")[0]).Kill();
}
#region EnableSoundNotify 変更通知プロパティ
private bool _EnableSoundNotify = false;
public bool EnableSoundNotify
{
get { return this._EnableSoundNotify; }
set
{
if (this._EnableSoundNotify != value)
{
this._EnableSoundNotify = value;
this.RaisePropertyChanged();
}
}
}
#endregion
#region IsDarkTheme 変更通知プロパティ
private bool _IsDarkTheme = true;
public bool IsDarkTheme
{
get { return this._IsDarkTheme; }
set
{
if (this._IsDarkTheme != value)
{
this._IsDarkTheme = value;
if (value) ThemeService.Current.ChangeTheme(Theme.Dark);
this.RaisePropertyChanged();
}
}
}
#endregion
#region IsLightTheme 変更通知プロパティ
private bool _IsLightTheme;
public bool IsLightTheme
{
get { return this._IsLightTheme; }
set
{
if (this._IsLightTheme != value)
{
this._IsLightTheme = value;
if (value) ThemeService.Current.ChangeTheme(Theme.Light);
this.RaisePropertyChanged();
}
}
}
#endregion
#region EnableNotifyIcon 変更通知プロパティ
private bool _EnableNotifyIcon = true;
public bool EnableNotifyIcon
{
get { return this._EnableNotifyIcon; }
set
{
if (this._EnableNotifyIcon != value)
{
this._EnableNotifyIcon = value;
this.RaisePropertyChanged();
}
}
}
#endregion
#region EnableNAS 変更通知プロパティ
private bool _EnableNAS = true;
public bool EnableNAS
{
get { return this._EnableNAS; }
set
{
if (this._EnableNAS != value)
{
this._EnableNAS = value;
this.RaisePropertyChanged();
}
}
}
#endregion
#region CurrentSettingsVersion 変更通知プロパティ
private string _CurrentSettingsVersion = "3.1.4";
public string CurrentSettingsVersion
{
get { return this._CurrentSettingsVersion; }
set
{
if (this._CurrentSettingsVersion != value)
{
this._CurrentSettingsVersion = value;
this.RaisePropertyChanged();
}
}
}
#endregion
#region EnableNullDropLogging 変更通知プロパティ
private bool _EnableNullDropLogging = false;
public bool EnableNullDropLogging
{
get { return this._EnableNullDropLogging; }
set
{
if (this._EnableNullDropLogging != value)
{
this._EnableNullDropLogging = value;
this.RaisePropertyChanged();
}
}
}
#endregion
#region UsernameOfPT 変更通知プロパティ
private string _UsernameOfPT = "";
public string UsernameOfPT
{
get { return this._UsernameOfPT; }
set
{
if (this._UsernameOfPT != value)
{
this._UsernameOfPT = value;
this.RaisePropertyChanged();
}
}
}
#endregion
#region Volume 変更通知プロパティ
private double _Volume = 100;
public double Volume
{
get { return this._Volume; }
set
{
if (this._Volume != value)
{
this._Volume = value;
this.RaisePropertyChanged();
}
}
}
#endregion
}
}