public static void setOriginal(this VehicleDef 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); } }
public static string getOriginal(this VehicleDef 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); }