-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathEconomy.cs
More file actions
68 lines (63 loc) · 2.75 KB
/
Economy.cs
File metadata and controls
68 lines (63 loc) · 2.75 KB
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
namespace EddiDataDefinitions
{
/// <summary>
/// Economy types
/// </summary>
public class Economy : ResourceBasedLocalizedEDName<Economy>
{
static Economy()
{
resourceManager = Properties.Economies.ResourceManager;
resourceManager.IgnoreCase = false;
missingEDNameHandler = (edname) => new Economy(edname);
None = new Economy("None");
Agriculture = new Economy("Agri");
Colony = new Economy("Colony");
Damaged = new Economy("Damaged");
Engineer = new Economy("Engineer");
Extraction = new Economy("Extraction");
Refinery = new Economy("Refinery");
Repair = new Economy("Repair");
Rescue = new Economy("Rescue");
Industrial = new Economy("Industrial");
Terraforming = new Economy("Terraforming");
HighTech = new Economy("HighTech");
Service = new Economy("Service");
Tourism = new Economy("Tourism");
Military = new Economy("Military");
Prison = new Economy("Prison");
Carrier = new Economy("Carrier");
}
public static readonly Economy None;
public static readonly Economy Agriculture;
public static readonly Economy Colony;
public static readonly Economy Damaged;
public static readonly Economy Engineer;
public static readonly Economy Extraction;
public static readonly Economy Refinery;
public static readonly Economy Repair;
public static readonly Economy Rescue;
public static readonly Economy Industrial;
public static readonly Economy Terraforming;
public static readonly Economy HighTech;
public static readonly Economy Service;
public static readonly Economy Tourism;
public static readonly Economy Military;
public static readonly Economy Prison;
public static readonly Economy Carrier;
// dummy used to ensure that the static constructor has run
public Economy() : this("")
{ }
private Economy(string edname) : base(edname, edname)
{ }
public new static Economy FromEDName(string edname)
{
// Economy names from the journal are prefixed with "$economy_" and sufficed with ";" while economy names from the Frontier API are not.
// We occasionally see undefined economies appear in the journal. Treat these as null / not set.
if (string.IsNullOrEmpty(edname)) { return None; }
var tidiedName = edname.Replace("$economy_", "").Replace(";", "");
return tidiedName == "Undefined" ? null : ResourceBasedLocalizedEDName<Economy>.FromEDName(tidiedName);
}
}
}