-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameDictionary.cs
129 lines (117 loc) · 3.19 KB
/
GameDictionary.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ZwiftPower
{
public class GameDictionary
{
static GameDictionary()
{
string fileName = "GameDictionary.json";
string jsonString = File.ReadAllText(fileName);
var options = new JsonSerializerOptions
{
NumberHandling = JsonNumberHandling.AllowReadingFromString,
IncludeFields = true,
};
options.Converters.Add(new UnixDateTimeConverter());
options.Converters.Add(new NumberBooleanConverter());
options.Converters.Add(new NullableNumberAsStringConverter());
options.Converters.Add(new NullableFloatAsStringConverter());
options.Converters.Add(new IntAsStringArrayConverter());
Data = JsonSerializer.Deserialize<GameDictionaryData>(jsonString, options);
}
public static GameDictionaryData Data;
}
public record GameDictionaryData(
Dictionary.Route[] Routes,
Dictionary.Segment[] Segments,
Dictionary.ImageItem[] Jerseys,
Dictionary.ImageItem[] RunShirts,
Dictionary.ImageItem[] RunShorts,
Dictionary.ImageItem[] RunShoes,
Dictionary.ImageItem[] BikeShoes,
Dictionary.ImageItem[] BikeFrontWheels,
Dictionary.ImageItem[] BikeRearWheels,
Dictionary.BikeFrame[] BikeFrames,
Dictionary.Item[] PaintJobs,
Dictionary.ImageItem[] Socks,
Dictionary.ImageItem[] Glasses,
Dictionary.ImageItem[] HeadGear,
Dictionary.ImageItem[] Achievements,
Dictionary.ImageItem[] Challenges,
Dictionary.NotableMomentType[] NotableMomentTypes,
Dictionary.ImageItem[] TrainingPlans,
Dictionary.Item[] UnlockableCategories
);
namespace Dictionary
{
public record Item(
string name,
string signature);
public record ImageItem(
string imageName,
string name,
string signature
) : Item(name, signature);
public record BikeFrame(
string isTT,
string modelYear,
string name,
string signature) : Item(name, signature);
public record NotableMomentType(
string imageName,
string name,
string priority,
string signature
) : ImageItem(imageName, name, signature);
public record Route(
string ascentBetweenFirstLastLrCPsInMeters,
string ascentInMeters,
string blockedForMeetups,
string difficulty,
string distanceBetweenFirstLastLrCPsInMeters,
string distanceInMeters,
string duration,
string eventOnly,
string eventPaddocks,
string freeRideLeadinAscentInMeters,
string freeRideLeadinDistanceInMeters,
string imageName,
string leadinAscentInMeters,
string leadinDistanceInMeters,
string levelLocked,
string locKey,
string map,
string meetupLeadinAscentInMeters,
string meetupLeadinDistanceInMeters,
string name,
string sports,
string supportedLaps,
string supportsTimeTrialMode,
string xp,
long signature,
long routeSignature,
string defaultLeadinAscentInMeters,
string defaultLeadinDistanceInMeters,
string rowRec,
string runRec,
string bikeRec,
string bikeType
);
public record Segment(
string archFriendlyFemaleNameR,
string archFriendlyNameR,
string archId,
string direction,
string jerseyIconPath,
string name,
string roadId,
string roadTime,
string world,
string signature,
string jerseyName,
string onRoutes
);
}
}