-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathExportConfiguration.xaml.cs
391 lines (369 loc) · 20.6 KB
/
ExportConfiguration.xaml.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
/*
* Author: © voc0der
* Project: NWNLogRotator
* GitHub: https://github.com/voc0der/NWNLogRotator
* Date: 3/3/2021
* License: MIT
* Purpose: This program is designed used alongside the Neverwinter Nights game, either Enhanced Edition, or 1.69.
* This program does not come with a warranty. Any support may be found on the GitHub page.
*/
using NWNLogRotator.Classes;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace NWNLogRotator
{
public partial class ExportConfiguration : Window
{
public Settings _settings;
public bool _closed = true;
/*
* Setters and Getters
*/
public ExportConfiguration(Settings __settings)
{
InitializeComponent();
SetupApplication(Settings_Set(__settings));
}
public Settings Settings_Get()
{
CurrentSettings_Get();
return _settings;
}
public Settings Settings_Set(Settings __settings)
{
_settings = __settings;
return _settings;
}
private Settings CurrentSettings_Get()
{
string OutputDirectory = _settings.OutputDirectory;
string PathToLog = _settings.PathToLog;
int MinimumRowsToInteger = _settings.MinimumRowsCount;
string ServerName = ServerNameTextBox.Text;
string ServerNameColor = new ColorConverter().ConvertToString(ServerNameColorTextBox.SelectedColor).Substring(3);
bool EventText = _settings.EventText;
bool CombatText = _settings.CombatText;
string UseTheme = _settings.UseTheme;
bool Silent = _settings.Silent;
bool Tray = _settings.Tray;
bool SaveBackup = _settings.SaveBackup;
bool SaveBackupOnly = _settings.SaveBackupOnly;
bool SaveOnLaunch = _settings.SaveOnLaunch;
bool Notifications = _settings.Notifications;
string OOCColor = new ColorConverter().ConvertToString(OOCColorTextBox.SelectedColor).Substring(3);
string FilterLines = _settings.FilterLines;
string PathToClient = _settings.PathToClient;
bool RunClientOnLaunch = _settings.RunClientOnLaunch;
bool CloseOnLogGenerated = _settings.CloseOnLogGenerated;
string ServerAddress = _settings.ServerAddress;
string ServerPassword = _settings.ServerPassword;
bool DM = _settings.DM;
bool ServerMode = _settings.ServerMode;
string BackgroundColor = new ColorConverter().ConvertToString(BackgroundColorTextBox.SelectedColor).Substring(3);
string TimestampColor = new ColorConverter().ConvertToString(TimestampColorTextBox.SelectedColor).Substring(3);
string DefaultColor = new ColorConverter().ConvertToString(DefaultColorTextBox.SelectedColor).Substring(3);
string ActorColor = new ColorConverter().ConvertToString(ActorColorTextBox.SelectedColor).Substring(3);
string PartyColor = new ColorConverter().ConvertToString(PartyColorTextBox.SelectedColor).Substring(3);
string EmoteColor = new ColorConverter().ConvertToString(EmoteColorTextBox.SelectedColor).Substring(3);
string ShoutColor = new ColorConverter().ConvertToString(ShoutColorTextBox.SelectedColor).Substring(3);
string TellColor = new ColorConverter().ConvertToString(TellColorTextBox.SelectedColor).Substring(3);
string WhisperColor = new ColorConverter().ConvertToString(WhisperColorTextBox.SelectedColor).Substring(3);
string MyColor = new ColorConverter().ConvertToString(MyColorTextBox.SelectedColor).Substring(3);
string MyCharacters = MyCharactersTextBox.Text;
string FontName = FontNameTextBox.Text;
string FontSize = FontSizeTextBox.Text.ToLower();
string CustomEmoteOne = CustomEmoteOneTextBox.Text;
string CustomEmoteOneColor = new ColorConverter().ConvertToString(CustomEmoteOneColorTextBox.SelectedColor).Substring(3);
string CustomEmoteTwo = CustomEmoteTwoTextBox.Text;
string CustomEmoteTwoColor = new ColorConverter().ConvertToString(CustomEmoteTwoColorTextBox.SelectedColor).Substring(3);
string CustomEmoteThree = CustomEmoteThreeTextBox.Text;
string CustomEmoteThreeColor = new ColorConverter().ConvertToString(CustomEmoteThreeColorTextBox.SelectedColor).Substring(3);
_settings = new Settings(OutputDirectory,
PathToLog,
MinimumRowsToInteger,
ServerName,
ServerNameColor,
EventText,
CombatText,
UseTheme,
Silent,
Tray,
SaveBackup,
SaveBackupOnly,
SaveOnLaunch,
Notifications,
OOCColor,
FilterLines,
PathToClient,
RunClientOnLaunch,
CloseOnLogGenerated,
ServerAddress,
ServerPassword,
DM,
ServerMode,
BackgroundColor,
TimestampColor,
DefaultColor,
ActorColor,
PartyColor,
EmoteColor,
ShoutColor,
TellColor,
WhisperColor,
MyColor,
MyCharacters,
FontName,
FontSize,
CustomEmoteOne,
CustomEmoteOneColor,
CustomEmoteTwo,
CustomEmoteTwoColor,
CustomEmoteThree,
CustomEmoteThreeColor
);
return _settings;
}
public bool Closed_Get()
{
return _closed;
}
/*
* Functions
*/
private void SetupApplication(Settings _settings)
{
if (_settings.UseTheme == "light")
{
ActivateLightTheme();
}
else if (_settings.UseTheme == "dark")
{
ActivateDarkTheme();
}
LoadSettings_Handler(_settings);
}
public void ActivateDarkTheme()
{
/*
* Black -> Purple -> Black
*/
LinearGradientBrush myBrush = new LinearGradientBrush();
myBrush.GradientStops.Add(new GradientStop(Colors.Black, 0.0));
myBrush.GradientStops.Add(new GradientStop(Colors.Purple, 0.5));
myBrush.GradientStops.Add(new GradientStop(Colors.Black, 1.0));
Grid.Background = myBrush;
/*
* Background
*/
ServerNameTextBox.Background = Brushes.Black;
ServerNameColorTextBox.Background = Brushes.Black;
MyCharactersTextBox.Background = Brushes.Black;
MyColorTextBox.Background = Brushes.Black;
FontNameTextBox.Background = Brushes.Black;
FontSizeTextBox.Background = Brushes.Black;
ActorColorTextBox.Background = Brushes.Black;
PartyColorTextBox.Background = Brushes.Black;
EmoteColorTextBox.Background = Brushes.Black;
TimestampColorTextBox.Background = Brushes.Black;
ShoutColorTextBox.Background = Brushes.Black;
TellColorTextBox.Background = Brushes.Black;
WhisperColorTextBox.Background = Brushes.Black;
BackgroundColorTextBox.Background = Brushes.Black;
DefaultColorTextBox.Background = Brushes.Black;
CustomEmoteOneTextBox.Background = Brushes.Black;
CustomEmoteOneColorTextBox.Background = Brushes.Black;
CustomEmoteTwoTextBox.Background = Brushes.Black;
CustomEmoteTwoColorTextBox.Background = Brushes.Black;
CustomEmoteThreeTextBox.Background = Brushes.Black;
CustomEmoteTwoColorTextBox.Background = Brushes.Black;
OOCColorTextBox.Background = Brushes.Black;
ResetSettingsButton.Background = Brushes.Black;
SaveSettingsButton.Background = Brushes.Black;
/*
* Foreground
*/
ServerNameTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
ServerNameColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
ServerNameTextBox.Foreground = new SolidColorBrush(Colors.White);
ServerNameLabelTwo.Foreground = new SolidColorBrush(Colors.White);
ServerNameColorLabelTwo.Foreground = new SolidColorBrush(Colors.White);
HintLabelCSSOne.Foreground = new SolidColorBrush(Colors.White);
HintLabelCSSTwo.Foreground = new SolidColorBrush(Colors.White);
MyCharactersTextBox.Foreground = new SolidColorBrush(Colors.White);
MyCharactersTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
MyColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
FontNameTextBox.Foreground = new SolidColorBrush(Colors.White);
FontSizeTextBox.Foreground = new SolidColorBrush(Colors.White);
FontNameTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
FontSizeTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
ActorColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
PartyColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
EmoteColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
TimestampColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
ShoutColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
TellColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
WhisperColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
BackgroundColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
DefaultColorTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
CustomEmoteOneCheckBox.Foreground = new SolidColorBrush(Colors.White);
CustomEmoteOneTextBox.Foreground = new SolidColorBrush(Colors.White);
CustomEmoteTwoCheckBox.Foreground = new SolidColorBrush(Colors.White);
CustomEmoteTwoTextBox.Foreground = new SolidColorBrush(Colors.White);
CustomEmoteThreeCheckBox.Foreground = new SolidColorBrush(Colors.White);
CustomEmoteThreeTextBox.Foreground = new SolidColorBrush(Colors.White);
OOCTextBoxLabel.Foreground = new SolidColorBrush(Colors.White);
DefaultColorTextBox.Foreground = new SolidColorBrush(Colors.White);
ResetSettingsButton.Foreground = new SolidColorBrush(Colors.White);
SaveSettingsButton.Foreground = new SolidColorBrush(Colors.White);
}
public void ActivateLightTheme()
{
/*
* Lavender -> White -> Light Gray
*/
LinearGradientBrush myBrush = new LinearGradientBrush();
myBrush.GradientStops.Add(new GradientStop(Colors.Lavender, 0.0));
myBrush.GradientStops.Add(new GradientStop(Colors.White, 0.5));
myBrush.GradientStops.Add(new GradientStop(Colors.LightGray, 1.0));
Grid.Background = myBrush;
/*
* Background
*/
ServerNameTextBox.Background = Brushes.White;
ServerNameColorTextBox.Background = Brushes.White;
ResetSettingsButton.Background = Brushes.White;
SaveSettingsButton.Background = Brushes.White;
/*
* Foreground
*/
ServerNameTextBox.Foreground = new SolidColorBrush(Colors.Black);
ServerNameColorTextBox.Foreground = new SolidColorBrush(Colors.Black);
ResetSettingsButton.Foreground = new SolidColorBrush(Colors.Black);
SaveSettingsButton.Foreground = new SolidColorBrush(Colors.Black);
}
private void LoadSettings_Handler(Settings _settings)
{
ServerNameTextBox.Text = _settings.ServerName;
ServerNameColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.ServerNameColor);
BackgroundColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.BackgroundColor);
TimestampColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.TimestampColor);
DefaultColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.DefaultColor);
ActorColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.ActorColor);
PartyColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.PartyColor);
EmoteColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.EmoteColor);
ShoutColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.ShoutColor);
TellColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.TellColor);
WhisperColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.WhisperColor);
MyColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.MyColor);
MyCharactersTextBox.Text = _settings.MyCharacters;
FontNameTextBox.Text = _settings.FontName;
FontSizeTextBox.Text = _settings.FontSize;
CustomEmoteOneColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.CustomEmoteOneColor);
CustomEmoteTwoColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.CustomEmoteTwoColor);
CustomEmoteThreeColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.CustomEmoteThreeColor);
OOCColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + _settings.OOCColor);
if (_settings.CustomEmoteOne != "")
{
CustomEmoteOneCheckBox.IsChecked = true;
CustomEmoteOneTextBox.Text = _settings.CustomEmoteOne;
}
if (_settings.CustomEmoteTwo != "")
{
CustomEmoteTwoCheckBox.IsChecked = true;
CustomEmoteTwoTextBox.Text = _settings.CustomEmoteTwo;
}
if (_settings.CustomEmoteThree != "")
{
CustomEmoteThreeCheckBox.IsChecked = true;
CustomEmoteThreeTextBox.Text = _settings.CustomEmoteThree;
}
}
/*
* Event Handlers
*/
private void Button_Click_Save_Settings(object sender, RoutedEventArgs e)
{
_settings = CurrentSettings_Get();
if (_settings.BackgroundColor.Length == 6 &&
_settings.TimestampColor.Length == 6 &&
_settings.DefaultColor.Length == 6 &&
_settings.ActorColor.Length == 6 &&
_settings.PartyColor.Length == 6 &&
_settings.EmoteColor.Length == 6 &&
_settings.ShoutColor.Length == 6 &&
_settings.TellColor.Length == 6 &&
_settings.WhisperColor.Length == 6 &&
_settings.CustomEmoteOneColor.Length == 6 &&
_settings.CustomEmoteTwoColor.Length == 6 &&
_settings.CustomEmoteThreeColor.Length == 6 &&
_settings.OOCColor.Length == 6
)
{
_closed = false;
this.Close();
}
else
{
MessageBoxResult _messageBoxResult = MessageBox.Show("Please make sure every color in the Export Options is six characters long.",
"Invalid Export Color!",
MessageBoxButton.OK,
MessageBoxImage.Warning);
}
}
private void Button_Click_Reset(object sender, RoutedEventArgs e)
{
var __settings = new Settings();
ServerNameColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.ServerNameColor);
BackgroundColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.BackgroundColor);
TimestampColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.TimestampColor);
DefaultColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.DefaultColor);
ActorColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.ActorColor);
PartyColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.PartyColor);
EmoteColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.EmoteColor);
ShoutColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.ShoutColor);
TellColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.TellColor);
WhisperColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.WhisperColor);
MyColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.MyColor);
FontNameTextBox.Text = __settings.FontName;
FontSizeTextBox.Text = __settings.FontSize;
CustomEmoteOneColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.CustomEmoteOneColor);
CustomEmoteTwoColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.CustomEmoteTwoColor);
CustomEmoteThreeColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.CustomEmoteThreeColor);
OOCColorTextBox.SelectedColor = (Color)ColorConverter.ConvertFromString("#" + __settings.OOCColor);
}
private void CustomEmoteOneCheckBox_Checked(object sender, RoutedEventArgs e)
{
CustomEmoteOneTextBox.Visibility = Visibility.Visible;
CustomEmoteOneColorTextBox.Visibility = Visibility.Visible;
}
private void CustomEmoteOneCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
CustomEmoteOneTextBox.Text = "";
CustomEmoteOneTextBox.Visibility = Visibility.Collapsed;
CustomEmoteOneColorTextBox.Visibility = Visibility.Collapsed;
}
private void CustomEmoteTwoCheckBox_Checked(object sender, RoutedEventArgs e)
{
CustomEmoteTwoTextBox.Visibility = Visibility.Visible;
CustomEmoteTwoColorTextBox.Visibility = Visibility.Visible;
}
private void CustomEmoteTwoCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
CustomEmoteTwoTextBox.Text = "";
CustomEmoteTwoTextBox.Visibility = Visibility.Collapsed;
CustomEmoteTwoColorTextBox.Visibility = Visibility.Collapsed;
}
private void CustomEmoteThreeCheckBox_Checked(object sender, RoutedEventArgs e)
{
CustomEmoteThreeTextBox.Visibility = Visibility.Visible;
CustomEmoteThreeColorTextBox.Visibility = Visibility.Visible;
}
private void CustomEmoteThreeCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
CustomEmoteThreeTextBox.Text = "";
CustomEmoteThreeTextBox.Visibility = Visibility.Collapsed;
CustomEmoteThreeColorTextBox.Visibility = Visibility.Collapsed;
}
}
}