public ShipInformationList() { Ships = new Dictionary <int, ShipInformation>(); StoredModules = new ModulesInStore(); itemlocalisation = new Dictionary <string, string>(); currentid = -1; }
public ModulesInStore StoreModule(string item, string itemlocalised) { ModulesInStore mis = this.ShallowClone(); mis.StoredModules.Add(new JournalLoadout.ShipModule("", "", item, "", itemlocalised)); return(mis); }
public ModulesInStore StoreModule(ModuleItem[] items, Dictionary <string, string> itemlocalisation) { ModulesInStore mis = this.ShallowClone(); foreach (ModuleItem it in items) { string local = itemlocalisation.ContainsKey(it.Name) ? itemlocalisation[it.Name] : ""; mis.StoredModules.Add(new JournalLoadout.ShipModule("", "", it.Name, "", local)); } return(mis); }
public ModulesInStore RemoveModule(string item) { int index = StoredModules.FindIndex(x => x.Item.Equals(item, StringComparison.InvariantCultureIgnoreCase)); // if we have an item of this name if (index != -1) { ModulesInStore mis = this.ShallowClone(); mis.StoredModules.RemoveAt(index); return(mis); } else { return(this); } }
public ModulesInStore ShallowClone() // shallow clone.. does not clone the ship modules, just the dictionary { ModulesInStore mis = new ModulesInStore(this.StoredModules); return(mis); }