static public ShipCargoSpaceTypeEnum?ActiveShipSelectedCargoSpaceType( this MemoryStruct.IWindowInventory windowInventory) => windowInventory?.TreeEntryActiveShip()?.FromShipExtractSetCargoSpaceTypeAndTreeEntry() ?.Where(cargoTypeAndTreeEntry => windowInventory?.SetLeftTreeEntrySelected()?.Contains(cargoTypeAndTreeEntry.Value) ?? false) ?.Select(cargoTypeAndTreeEntry => cargoTypeAndTreeEntry.Key) ?.CastToNullable() ?.FirstOrDefault();
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 IWindowInventory Parse(this MemoryStruct.IWindowInventory windowInventory) => null == windowInventory ? null : new WindowInventory(windowInventory);
static public IEnumerable <MemoryStruct.ITreeViewEntry> SetLeftTreeEntrySelected( this MemoryStruct.IWindowInventory windowInventory) => windowInventory?.LeftTreeListEntry?.Select(rootTreeEntry => rootTreeEntry?.EnumerateChildNodeTransitive()).ConcatNullable() ?.Where(treeEntry => treeEntry?.IsSelected ?? false);
static public MemoryStruct.ITreeViewEntry TreeEntryActiveShip( this MemoryStruct.IWindowInventory inventory) => // Topmost entry which is a root and has a conforming Label. inventory?.LeftTreeListEntry?.OrderByCenterVerticalDown() ?.FirstOrDefault(treeEntry => 0 < treeEntry?.Text?.ParseTreeEntryLabelShipNameAndType()?.Value?.Length);