static public List <EngEntry> GetEng(string rootpath) { List <EngEntry> list = new List <EngEntry>(); try { string modulespath = Path.Combine(rootpath, "modules.json"); string moduletext = File.ReadAllText(modulespath); JObject modulesjo = JObject.Parse(moduletext); foreach (JProperty m in modulesjo.Children()) { string clsname = m.Name; JObject jm = (JObject)m.First; JObject blueprints = (JObject)jm["blueprints"]; foreach (JProperty bc in blueprints.Children()) { string bpname = bc.Name; JObject jp = (JObject)bc.First; JObject grades = (JObject)jp["grades"]; foreach (JProperty gr in grades.Children()) { string grname = gr.Name; JObject gradeinfo = (JObject)gr.Value; JArray engs = (JArray)gradeinfo["engineers"]; string englist = ""; foreach (string s in engs) { englist = englist.AppendPrePad(s, ","); } NameConvert namec = Array.Find(conversions, x => x.c == clsname); list.Add(new EngEntry() { corolisclass = clsname, corolisclasstext = namec.cnv, corolisfrontierid = namec.frontier, fdname = bpname, grade = grname, englist = englist }); // Console.WriteLine("Eng " + clsname + " : " + namec.frontier + ":" + bpname + " : " + grname + " : " + englist); } } } } catch { } return(list); }
public static string ToDisplayFormat(this string name) { return(string.IsNullOrEmpty(name) ? String.Empty : NameConvert.Replace(source, " $1")); }