corrade-vassal – Diff between revs 21 and 22
?pathlinks?
Rev 21 | Rev 22 | |||
---|---|---|---|---|
Line 6... | Line 6... | |||
6 | |
6 | |
|
7 | using System; |
7 | using System; |
|
8 | using System.Collections.Generic; |
8 | using System.Collections.Generic; |
|
9 | using System.ComponentModel; |
9 | using System.ComponentModel; |
|
10 | using System.IO; |
- | ||
11 | using System.Linq; |
10 | using System.IO; |
|
12 | using System.Text; |
11 | using System.Text; |
|
Line 13... | Line 12... | |||
13 | using System.Xml.Serialization; |
12 | using System.Xml.Serialization; |
|
14 | |
13 | |
|
Line 40... | Line 39... | |||
40 | |
39 | |
|
41 | [Serializable] |
40 | [Serializable] |
|
42 | public class VassalConfiguration |
41 | public class VassalConfiguration |
|
43 | { |
42 | { |
|
44 | private static readonly object VassalConfigurationLock = new object(); |
- | ||
Line 45... | Line 43... | |||
45 | private uint _servicesTimeout = 60000; |
43 | private static readonly object VassalConfigurationLock = new object(); |
|
46 | |
44 | |
|
47 | private ENIGMA _enigma = new ENIGMA |
45 | private ENIGMA _enigma = new ENIGMA |
|
48 | { |
46 | { |
|
Line 55... | Line 53... | |||
55 | private string _HTTPServerURL = @"http://127.0.0.1:8080/"; |
53 | private string _HTTPServerURL = @"http://127.0.0.1:8080/"; |
|
56 | private List<Filter> _inputFilters = new List<Filter>(); |
54 | private List<Filter> _inputFilters = new List<Filter>(); |
|
57 | private List<Filter> _outputFilters = new List<Filter>(); |
55 | private List<Filter> _outputFilters = new List<Filter>(); |
|
58 | private string _password = string.Empty; |
56 | private string _password = string.Empty; |
|
59 | private uint _regionRestartDelay = 120; |
57 | private uint _regionRestartDelay = 120; |
|
- | 58 | private uint _servicesTimeout = 60000; |
||
60 | private uint _teleportTimeout = 30000; |
59 | private uint _teleportTimeout = 30000; |
|
61 | private string _vigenereSecret = string.Empty; |
60 | private string _vigenereSecret = string.Empty; |
|
Line 62... | Line 61... | |||
62 | |
61 | |
|
63 | public string Group |
62 | public string Group |
|
Line 242... | Line 241... | |||
242 | |
241 | |
|
243 | public static void Save(string file, ref VassalConfiguration configuration) |
242 | public static void Save(string file, ref VassalConfiguration configuration) |
|
244 | { |
243 | { |
|
245 | lock (VassalConfigurationLock) |
244 | lock (VassalConfigurationLock) |
|
246 | { |
245 | { |
|
247 | using (StreamWriter writer = new StreamWriter(file, false, Encoding.UTF8)) |
246 | using (var writer = new StreamWriter(file, false, Encoding.UTF8)) |
|
248 | { |
247 | { |
|
249 | XmlSerializer serializer = new XmlSerializer(typeof (VassalConfiguration)); |
248 | var serializer = new XmlSerializer(typeof(VassalConfiguration)); |
|
250 | serializer.Serialize(writer, configuration); |
249 | serializer.Serialize(writer, configuration); |
|
251 | //writer.Flush(); |
250 | //writer.Flush(); |
|
252 | } |
251 | } |
|
253 | } |
252 | } |
|
Line 254... | Line 253... | |||
254 | } |
253 | } |
|
255 | |
254 | |
|
256 | public static void Load(string file, ref VassalConfiguration configuration) |
255 | public static void Load(string file, ref VassalConfiguration configuration) |
|
257 | { |
256 | { |
|
258 | lock (VassalConfigurationLock) |
257 | lock (VassalConfigurationLock) |
|
259 | { |
258 | { |
|
260 | using (StreamReader stream = new StreamReader(file, Encoding.UTF8)) |
259 | using (var stream = new StreamReader(file, Encoding.UTF8)) |
|
261 | { |
260 | { |
|
262 | XmlSerializer serializer = |
261 | var serializer = |
|
263 | new XmlSerializer(typeof (VassalConfiguration)); |
262 | new XmlSerializer(typeof(VassalConfiguration)); |
|
264 | configuration = (VassalConfiguration) serializer.Deserialize(stream); |
263 | configuration = (VassalConfiguration) serializer.Deserialize(stream); |
|
265 | } |
264 | } |