-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHazeronWatcherSettings.cs
94 lines (77 loc) · 2.63 KB
/
HazeronWatcherSettings.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
namespace HazeronWatcher
{
[Serializable]
[XmlRoot(ElementName = "HazeronWatcherSettings", Namespace = "")]
public class HazeronWatcherSettings
{
[XmlElement]
public HazeronWatcherSettingsOptions Options { get; set; }
[XmlArray("AvatarList")]
[XmlArrayItem("Avatar")]
public List<Avatar> AvatarList { get; set; }
[XmlArray("EmpireList")]
[XmlArrayItem("Empire")]
public List<Empire> EmpireList { get; set; }
[XmlArray("WatchGroupList")]
[XmlArrayItem("WatchGroup")]
public List<WatchGroup> WatchGroupList { get; set; }
public HazeronWatcherSettings()
{
Options = new HazeronWatcherSettingsOptions();
AvatarList = new List<Avatar>();
EmpireList = new List<Empire>();
WatchGroupList = new List<WatchGroup>();
}
public void Save(string filePath)
{
XmlSerializer serializer = new XmlSerializer(typeof(HazeronWatcherSettings));
TextWriter textWriter = new StreamWriter(filePath);
serializer.Serialize(textWriter, this);
textWriter.Close();
}
public static HazeronWatcherSettings Load(string filePath)
{
XmlSerializer serializer = new XmlSerializer(typeof(HazeronWatcherSettings));
TextReader reader = new StreamReader(filePath);
HazeronWatcherSettings data = (HazeronWatcherSettings)serializer.Deserialize(reader);
reader.Close();
return data;
}
}
public class HazeronWatcherSettingsOptions
{
[XmlAttribute]
public int Version { get; set; }
[XmlElement]
public bool ShowIdColumn { get; set; }
[XmlElement]
public bool ShowWatchHighlight { get; set; }
[XmlElement]
public bool ShowWatchList { get; set; }
[XmlElement]
public bool ShowRecentList { get; set; }
[XmlElement]
public bool PlaySound { get; set; }
[XmlElement]
public bool BallonTip { get; set; }
[XmlElement]
public bool MinimizeToTray { get; set; }
public HazeronWatcherSettingsOptions()
{
Version = 2;
ShowIdColumn = false;
ShowWatchHighlight = true;
ShowWatchList = true;
ShowRecentList = true;
PlaySound = true;
BallonTip = true;
MinimizeToTray = false;
}
}
}