-
Notifications
You must be signed in to change notification settings - Fork 2
/
DamageAttributesManager.cs
45 lines (41 loc) · 1.24 KB
/
DamageAttributesManager.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
using Newtonsoft.Json;
namespace AoM
{
/// <summary>
/// The database and getter of attributes
/// </summary>
public class DamageAttributesManager : IdentificableManager<DamageAttribute>
{
/// <summary>
/// Gets the attribute with a given name
/// </summary>
public DamageAttribute this [string name]
{
get { return Get (name); }
}
[JsonConstructor]
DamageAttributesManager (DamageAttribute [] Collection)
: base (Collection)
{
}
readonly static JsonSerializerSettings Sets = new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto,
TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple,
NullValueHandling = NullValueHandling.Ignore,
ReferenceLoopHandling = ReferenceLoopHandling.Error,
PreserveReferencesHandling = PreserveReferencesHandling.None,
ObjectCreationHandling = ObjectCreationHandling.Auto,
MetadataPropertyHandling = MetadataPropertyHandling.Default,
Formatting = Formatting.Indented
};
/// <summary>
/// Loads the data from the file
/// </summary>
/// <seealso cref="FileNames"/>
public static DamageAttributesManager FromFile ()
{
return FromFile<DamageAttributesManager> (FileNames.DamageAttributes, Sets);
}
}
}