-
Notifications
You must be signed in to change notification settings - Fork 0
/
PocoyoData.cs
53 lines (47 loc) · 1.74 KB
/
PocoyoData.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
using System;
using System.Collections.Generic;
namespace Pocoyo
{
public class PocoyoData
{
public string DefaultNamespace { get; set; }
public List<string> Excluded { get; set; }
public List<string> ExcludedAttributes { get; set; }
public List<string> KnownTypes { get; set; }
public List<string> Namespaces { get; set; }
public Dictionary<string, string> DiscoveredTypes { get; set; }
public Dictionary<string, string> ExcludedTypes { get; set; }
public static void LoadFromData(string filePath)
{
var data = Json.DeserializeFromFile<PocoyoData>(filePath);
if (data != null)
{
Pocoyo.DefaultNamespace = data.DefaultNamespace;
Pocoyo.Excluded = data.Excluded;
Pocoyo.ExcludedAttributes = data.ExcludedAttributes;
Pocoyo.KnownTypes = data.KnownTypes;
Pocoyo.Namespaces = data.Namespaces;
Pocoyo.DiscoveredTypes = data.DiscoveredTypes;
Pocoyo.ExcludedTypes = data.ExcludedTypes;
}
}
public void SaveToData(string filePath)
{
try
{
DefaultNamespace = Pocoyo.DefaultNamespace;
Excluded = Pocoyo.Excluded;
ExcludedAttributes = Pocoyo.ExcludedAttributes;
KnownTypes = Pocoyo.KnownTypes;
Namespaces = Pocoyo.Namespaces;
DiscoveredTypes = Pocoyo.DiscoveredTypes;
ExcludedTypes = Pocoyo.ExcludedTypes;
Json.SerializeToFile(this, filePath);
}
catch (Exception ex)
{
Log.Exception(ex);
}
}
}
}