-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPluginSettings.cs
38 lines (35 loc) · 1.28 KB
/
PluginSettings.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ColorlightPlugin
{
public class PluginSettings
{
string _showFolder;
public void SetShowFolder(string showFolder)
{
_showFolder = showFolder;
}
public List<PanelSettings> Load()
{
var path = _showFolder + "//ColorlightPlugin2.xml";
if (!System.IO.File.Exists(path))
return new List<PanelSettings>();
System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(List<PanelSettings>));
System.IO.StreamReader file = new System.IO.StreamReader(path);
var setting = (List<PanelSettings>)reader.Deserialize(file);
file.Close();
return setting;
}
public void Save(List<PanelSettings> settings)
{
System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(List<PanelSettings>));
var path = _showFolder + "//ColorlightPlugin2.xml";
System.IO.FileStream file = System.IO.File.Create(path);
writer.Serialize(file, settings);
file.Close();
}
}
}