public static string getOriginal(this TurretChassisDef def) { if (originals.TryGetValue(def.GetType(), out Dictionary <string, string> origs) == false) { return(def.ToJSON()); } if (origs.TryGetValue(def.Description.Id, out string result) == false) { return(def.ToJSON()); } return(result); }
public static void setOriginal(this TurretChassisDef def, string json) { if (originals.TryGetValue(def.GetType(), out Dictionary <string, string> origs) == false) { origs = new Dictionary <string, string>(); originals.Add(def.GetType(), origs); } if (origs.ContainsKey(def.Description.Id)) { origs[def.Description.Id] = json; } else { origs.Add(def.Description.Id, json); } }