static public ShipCargoSpaceTypeEnum?CargoSpaceTypeFromTreeEntry( this MemoryStruct.ITreeViewEntry entryShip, MemoryStruct.ITreeViewEntry entryCargoSpace) => FromShipExtractSetCargoSpaceTypeAndTreeEntry(entryShip) ?.Where(cargoShipTypeAndTreeEntry => cargoShipTypeAndTreeEntry.Value == entryCargoSpace) ?.Select(cargoShipTypeAndTreeEntry => cargoShipTypeAndTreeEntry.Key) ?.CastToNullable() ?.FirstOrDefault();
static public IEnumerable <KeyValuePair <ShipCargoSpaceTypeEnum, MemoryStruct.ITreeViewEntry> > FromShipExtractSetCargoSpaceTypeAndTreeEntry( this MemoryStruct.ITreeViewEntry shipTreeEntry) => new[] { new KeyValuePair <ShipCargoSpaceTypeEnum, MemoryStruct.ITreeViewEntry>(ShipCargoSpaceTypeEnum.General, shipTreeEntry) } .ConcatNullable(InventoryCargoTypeAndSetLabel?.Select(cargoTypeAndSetLabel => new KeyValuePair <ShipCargoSpaceTypeEnum, MemoryStruct.ITreeViewEntry>( cargoTypeAndSetLabel.Key, shipTreeEntry?.EnumerateChildNodeTransitive() ?.FirstOrDefault(node => node?.Text?.FromIventoryLabelParseShipCargoSpaceType() == cargoTypeAndSetLabel.Key)))) ?.Where(treeEntryForCargoSpaceType => null != treeEntryForCargoSpaceType.Value);
public WindowInventoryTreeViewShip(MemoryStruct.ITreeViewEntry raw) { this.Raw = raw; if (null == raw) { return; } SetCargoSpaceTypeAndTreeEntry = raw.FromShipExtractSetCargoSpaceTypeAndTreeEntry()?.ToArray(); }
public WindowInventory(MemoryStruct.IWindowInventory raw) { this.Raw = raw; if (null == raw) { return; } ActiveShipEntry = raw.TreeEntryActiveShip()?.ParseAsInventoryTreeEntryShip(); SelectedRightInventoryCapacityMilli = raw?.SelectedRightInventoryCapacity?.Text?.ParseAsInventoryCapacityGaugeMilli(); ItemHangarEntry = raw?.LeftTreeListEntry?.FirstOrDefault(c => c?.Text?.RegexMatchSuccess(@"item\s*hangar", RegexOptions.IgnoreCase) ?? false); }
public WindowInventory(MemoryStruct.IWindowInventory Raw) { this.Raw = Raw; if (null == Raw) { return; } ActiveShipEntry = Raw.TreeEntryActiveShip()?.ParseAsInventoryTreeEntryShip(); SelectedRightInventoryCapacityMilli = Raw?.SelectedRightInventoryCapacity?.Text?.ParseAsInventoryCapacityGaugeMilli(); ItemHangarEntry = Raw?.LeftTreeListEntry?.FirstOrDefault(c => c?.Text?.RegexMatchSuccess(@"item\s*hangar", RegexOptions.IgnoreCase) ?? false); }
static public IInventoryTreeViewEntryShip ParseAsInventoryTreeEntryShip(this MemoryStruct.ITreeViewEntry treeViewEntry) => null == treeViewEntry ? null : new WindowInventoryTreeViewShip(treeViewEntry);
static public MemoryStruct.ITreeViewEntry TreeEntryFromCargoSpaceType( this MemoryStruct.ITreeViewEntry shipTreeEntry, ShipCargoSpaceTypeEnum cargoSpaceType) => FromShipExtractSetCargoSpaceTypeAndTreeEntry(shipTreeEntry) ?.FirstOrDefault(treeEntryForCargoShipType => treeEntryForCargoShipType.Key == cargoSpaceType).Value;