static public IListViewAndControl <OutEntryT> Map <InEntryT, OutEntryT>( this IListViewAndControl <InEntryT> listViewAndControl, Func <InEntryT, OutEntryT> entryMap) where InEntryT : MemoryStruct.IListEntry where OutEntryT : class, MemoryStruct.IListEntry { if (null == listViewAndControl) { return(null); } return(new ListViewAndControl <OutEntryT>(listViewAndControl) { ColumnHeader = listViewAndControl?.ColumnHeader, Scroll = listViewAndControl?.Scroll, Entry = listViewAndControl?.Entry?.Select(entryMap)?.ToArray(), }); }
static public BotEngine.EveOnline.Interface.MemoryStruct.ListViewport AsOld(this IListViewAndControl listView) => AsOldListView(listView);
static public BotEngine.EveOnline.Interface.MemoryStruct.ListViewport AsOldListView(this IListViewAndControl listView) { // this is a case of the graph probably not being a tree since the entries refer to the column headers too. if (listView == null) { return(null); } var toDrone = listView?.Entry?.Any(entry => entry is IDroneViewEntryItem) ?? false; return(new BotEngine.EveOnline.Interface.MemoryStruct.ListViewport() { Scroll = listView?.Scroll?.AsOld(), Entry = listView?.Entry?.Select(entry => entry?.AsOldListEntry(toDrone))?.ToArray(), ColumnHeader = listView?.ColumnHeader?.Select(AsOld)?.ToArray(), }); }