Uh oh!
There was an error while loading. Please reload this page.
forked from TehCheat/PassiveSkillTreePlanter
- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTreeConfig.cs
More file actions
Latest commit
62 lines (51 loc) · 1.82 KB
/
Copy pathTreeConfig.cs
File metadata and controls
62 lines (51 loc) · 1.82 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
usingSystem.Collections.Generic;
usingSystem.IO;
usingSystem.Linq;
usingNewtonsoft.Json;
namespacePassiveSkillTreePlanter;
publicclassTreeConfig
{
publicstaticList<string>GetBuilds(stringbuildDirectory)
{
vardirInfo=newDirectoryInfo(buildDirectory);
varfiles=dirInfo.GetFiles("*.json").Select(x =>Path.GetFileNameWithoutExtension(x.Name)).ToList();
returnfiles;
}
publicstaticSkillTreeDataLoadBuild(stringbuildDirectory,stringbuildName)
{
varbuildFile=Path.Join(buildDirectory,$"{buildName}.json");
returnLoadSettingFile<SkillTreeData>(buildFile);
}
publicstaticTSettingTypeLoadSettingFile<TSettingType>(stringfileName)
{
if(!File.Exists(fileName))
returndefault(TSettingType);
returnJsonConvert.DeserializeObject<TSettingType>(File.ReadAllText(fileName));
}
publicstaticvoidSaveSettingFile<TSettingType>(stringfileName,TSettingTypesetting)
{
varbuildFile=$"{fileName}.json";
varserialized=JsonConvert.SerializeObject(setting,Formatting.Indented);
File.WriteAllText(buildFile,serialized);
}
publicclassTree
{
publicstringTag="";
publicstringSkillTreeUrl="";
privateESkillTreeType?_type;
[JsonIgnore]
publicESkillTreeTypeType=>_type??=TreeEncoder.DecodeUrl(SkillTreeUrl)switch
{
(not null,vartype)=>type,
_ =>ESkillTreeType.Unknown
};
publicvoidResetType()=>_type=null;
}
publicclassSkillTreeData
{
publicstringNotes{get;set;}="";
publicList<Tree>Trees{get;set;}=newList<Tree>();
publicstringBuildLink{get;set;}="";
internalboolModified{get;set;}
}
}