public ShipInformationList() { Ships = new Dictionary <string, ShipInformation>(); StoredModules = new ModulesInStore(); itemlocalisation = new Dictionary <string, string>(); currentid = null; }
public ModulesInStore StoreModule(string item, string itemlocalised) { ModulesInStore mis = this.ShallowClone(); mis.StoredModules.Add(new JournalLoadout.ShipModule("", "", item, "", itemlocalised)); return(mis); }
public ModulesInStore StoreModule(string item, string itemlocalised) { ModulesInStore mis = this.ShallowClone(); mis.StoredModules.Add(new StoredModule(item, itemlocalised)); return(mis); }
public ModulesInStore StoreModule(JournalMassModuleStore.ModuleItem[] items, Dictionary <string, string> itemlocalisation) { ModulesInStore mis = this.ShallowClone(); foreach (var 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 RemoveModule(string item) { int index = StoredModules.FindIndex(x => x.Name.Equals(item, StringComparison.InvariantCultureIgnoreCase)); // if we have an item of this name if (index != -1) { //System.Diagnostics.Debug.WriteLine("Remove module '" + item + "' '" + StoredModules[index].Name_Localised + "'"); ModulesInStore mis = this.ShallowClone(); mis.StoredModules.RemoveAt(index); return(mis); } else { return(this); } }
public void UpdateShipStoredModules(ModulesInStore ms) { StoredModules = ms; }
public ModulesInStore ShallowClone() // shallow clone.. does not clone the ship modules, just the dictionary { ModulesInStore mis = new ModulesInStore(this.StoredModules); return(mis); }
public ModulesInStore UpdateStoredModules(StoredModule[] newlist) { ModulesInStore mis = new ModulesInStore(newlist.ToList()); // copy constructor .. return(mis); }