-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMinecraftFontProviderProperty.cs
55 lines (41 loc) · 1.43 KB
/
MinecraftFontProviderProperty.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
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;
namespace FontJsonGenerator;
[Serializable]
public class MinecraftFontProviderProperty
{
[JsonProperty("type")]
public string Type { get; set; } = ProviderType.NoType;
[JsonProperty("file")]
public string ResourcePath { get; set; } = string.Empty;
[JsonProperty("ascent")]
public int Ascent { get; set; } = -1;
[JsonProperty("height")]
public int? Height { get; set; }
[JsonProperty("chars")]
public string[] Charaters { get; set; } = Array.Empty<string>();
[AllowNull]
[JsonProperty("sizes", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Sizes { get; set; }
[AllowNull]
[JsonProperty("template", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Template { get; set; }
public bool IsVaild()
{
return Type == ProviderType.NoType
|| ResourcePath == string.Empty
|| Ascent <= -1
|| Height <= -1
|| Charaters.Length == 0
|| Sizes == string.Empty
|| Template == string.Empty;
}
public override string ToString() => JsonConvert.SerializeObject(this);
}
public class ProviderType
{
public static string Bitmap = "bitmap";
public static string TrueTypeFont = "ttf";
public static string LegacyUnicode = "legacy_unicode";
public static string NoType = string.Empty;
}