-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.cs
81 lines (70 loc) · 2.04 KB
/
Settings.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
using System;
using System.Xml;
using System.Xml.Serialization;
namespace Shrek_2_team_action_tools
{
[Serializable()]
public class Settings
{
public static void Save(Settings settings)
{
string xmlPath = System.AppDomain.CurrentDomain.BaseDirectory + "config.xml";
XmlSerializer xmlS = new XmlSerializer(typeof(Settings));
System.IO.TextWriter xmlW = new System.IO.StreamWriter(xmlPath);
xmlS.Serialize(xmlW, settings);
xmlW.Flush();
xmlW.Close();
}
public static void Load(Settings settings)
{
string xmlPath = System.AppDomain.CurrentDomain.BaseDirectory + "config.xml";
XmlReader xmlReader = new XmlTextReader(xmlPath);
XmlSerializer xmlS = new XmlSerializer(typeof(Settings));
MainForm.settings = (Settings)xmlS.Deserialize(xmlReader);
xmlReader.Close();
}
private int _ascii;
private string _inputPath;
private string _outputPath;
[XmlAttribute("ASCII")]
public int ASCII
{
get
{
return _ascii;
}
set
{
_ascii = value;
}
}
[XmlAttribute("inputPath")]
public string inputPath
{
get
{
return _inputPath;
}
set
{
_inputPath = value;
}
}
[XmlAttribute("outputPath")]
public string outputPath
{
get
{
return _outputPath;
}
set { _outputPath = value; }
}
public Settings() { }
public Settings(int _ascii, string _inputPath, string _outputPath)
{
this.ASCII = _ascii;
this.inputPath = _inputPath;
this.outputPath = _outputPath;
}
}
}