public void Go(ListView lv, WhichResults which) { Missing = new System.Collections.Generic.List <ItemMissing>(); RSS = new System.Collections.Generic.List <ActionTDownload>(); CopyMove = new System.Collections.Generic.List <ActionCopyMoveRename>(); Rename = new System.Collections.Generic.List <ActionCopyMoveRename>(); Download = new System.Collections.Generic.List <ActionDownloadImage>(); NFO = new System.Collections.Generic.List <ActionNfo>(); PyTivoMeta = new System.Collections.Generic.List <ActionPyTivoMeta>(); FlatList = new ItemList(); System.Collections.Generic.List <ListViewItem> sel = new System.Collections.Generic.List <ListViewItem>(); if (which == WhichResults.Checked) { ListView.CheckedListViewItemCollection ss = lv.CheckedItems; foreach (ListViewItem lvi in ss) { sel.Add(lvi); } } else if (which == WhichResults.Selected) { ListView.SelectedListViewItemCollection ss = lv.SelectedItems; foreach (ListViewItem lvi in ss) { sel.Add(lvi); } } else // all { foreach (ListViewItem lvi in lv.Items) { sel.Add(lvi); } } Count = sel.Count; if (sel.Count == 0) { return; } System.Type firstType = ((Item)(sel[0].Tag)).GetType(); foreach (ListViewItem lvi in sel) { if (lvi == null) { continue; } Item action = (Item)(lvi.Tag); if (action != null) { FlatList.Add(action); } if (action is ActionCopyMoveRename cmr) { if (cmr.Operation == ActionCopyMoveRename.Op.rename) { Rename.Add(cmr); } else // copy/move { CopyMove.Add(cmr); } } else if (action is ActionDownloadImage item) { Download.Add(item); } else if (action is ActionTDownload rss) { RSS.Add(rss); } else if (action is ItemMissing missing) { Missing.Add(missing); } else if (action is ActionNfo nfo) { NFO.Add(nfo); } else if (action is ActionPyTivoMeta meta) { PyTivoMeta.Add(meta); } } }
public void Go(ListView lv, WhichResults which) { //this.uTorrenting = new System.Collections.Generic.List<ItemuTorrenting>(); this.Missing = new System.Collections.Generic.List <ItemMissing>(); this.RSS = new System.Collections.Generic.List <ActionRSS>(); this.CopyMove = new System.Collections.Generic.List <ActionCopyMoveRename>(); this.Rename = new System.Collections.Generic.List <ActionCopyMoveRename>(); this.Download = new System.Collections.Generic.List <ActionDownloadImage>(); this.NFO = new System.Collections.Generic.List <ActionNFO>(); this.PyTivoMeta = new System.Collections.Generic.List <ActionPyTivoMeta>(); this.FlatList = new ItemList(); System.Collections.Generic.List <ListViewItem> sel = new System.Collections.Generic.List <ListViewItem>(); if (which == WhichResults.Checked) { ListView.CheckedListViewItemCollection ss = lv.CheckedItems; foreach (ListViewItem lvi in ss) { sel.Add(lvi); } } else if (which == WhichResults.Selected) { ListView.SelectedListViewItemCollection ss = lv.SelectedItems; foreach (ListViewItem lvi in ss) { sel.Add(lvi); } } else // all { foreach (ListViewItem lvi in lv.Items) { sel.Add(lvi); } } this.Count = sel.Count; if (sel.Count == 0) { return; } System.Type firstType = ((Item)(sel[0].Tag)).GetType(); this.AllSameType = true; foreach (ListViewItem lvi in sel) { if (lvi == null) { continue; } Item action = (Item)(lvi.Tag); if (action is Item) { this.FlatList.Add(action as Item); } if (action.GetType() != firstType) { this.AllSameType = false; } if (action is ActionCopyMoveRename) { ActionCopyMoveRename cmr = action as ActionCopyMoveRename; if (cmr.Operation == ActionCopyMoveRename.Op.Rename) { this.Rename.Add(cmr); } else // copy/move { this.CopyMove.Add(cmr); } } else if (action is ActionDownloadImage) { this.Download.Add((ActionDownloadImage)(action)); } else if (action is ActionRSS) { this.RSS.Add((ActionRSS)(action)); } else if (action is ItemMissing) { this.Missing.Add((ItemMissing)(action)); } else if (action is ActionNFO) { this.NFO.Add((ActionNFO)(action)); } else if (action is ActionPyTivoMeta) { this.PyTivoMeta.Add((ActionPyTivoMeta)(action)); } //else if (action is ItemuTorrenting) // this.uTorrenting.Add((ItemuTorrenting) (action)); } }
public LVResults(ListView lv, WhichResults which) { Go(lv, which); }
public void Go(ListView lv, WhichResults which) { //this.uTorrenting = new System.Collections.Generic.List<ItemuTorrenting>(); this.Missing = new System.Collections.Generic.List<ItemMissing>(); this.RSS = new System.Collections.Generic.List<ActionRSS>(); this.CopyMove = new System.Collections.Generic.List<ActionCopyMoveRename>(); this.Rename = new System.Collections.Generic.List<ActionCopyMoveRename>(); this.Download = new System.Collections.Generic.List<ActionDownload>(); this.NFO = new System.Collections.Generic.List<ActionNFO>(); this.PyTivoMeta = new System.Collections.Generic.List<ActionPyTivoMeta>(); this.FlatList = new ScanListItemList(); System.Collections.Generic.List<ListViewItem> sel = new System.Collections.Generic.List<ListViewItem>(); if (which == WhichResults.Checked) { ListView.CheckedListViewItemCollection ss = lv.CheckedItems; foreach (ListViewItem lvi in ss) sel.Add(lvi); } else if (which == WhichResults.Selected) { ListView.SelectedListViewItemCollection ss = lv.SelectedItems; foreach (ListViewItem lvi in ss) sel.Add(lvi); } else // all { foreach (ListViewItem lvi in lv.Items) sel.Add(lvi); } this.Count = sel.Count; if (sel.Count == 0) return; System.Type firstType = ((Item) (sel[0].Tag)).GetType(); this.AllSameType = true; foreach (ListViewItem lvi in sel) { if (lvi == null) continue; Item action = (Item) (lvi.Tag); if (action is ScanListItem) this.FlatList.Add(action as ScanListItem); if (action.GetType() != firstType) this.AllSameType = false; if (action is ActionCopyMoveRename) { ActionCopyMoveRename cmr = action as ActionCopyMoveRename; if (cmr.Operation == ActionCopyMoveRename.Op.Rename) this.Rename.Add(cmr); else // copy/move this.CopyMove.Add(cmr); } else if (action is ActionDownload) this.Download.Add((ActionDownload) (action)); else if (action is ActionRSS) this.RSS.Add((ActionRSS) (action)); else if (action is ItemMissing) this.Missing.Add((ItemMissing) (action)); else if (action is ActionNFO) this.NFO.Add((ActionNFO) (action)); else if (action is ActionPyTivoMeta) this.PyTivoMeta.Add((ActionPyTivoMeta) (action)); //else if (action is ItemuTorrenting) // this.uTorrenting.Add((ItemuTorrenting) (action)); } }
public LVResults(ListView lv, WhichResults which) { this.Go(lv, which); }
private void Go([NotNull] ListView lv, WhichResults which) { Missing = new List <ItemMissing>(); WriteMetadatas = new List <ActionWriteMetadata>(); CopyMove = new List <ActionCopyMoveRename>(); Rename = new List <ActionCopyMoveRename>(); SaveImages = new List <ActionDownloadImage>(); DownloadTorrents = new List <ActionTDownload>(); Downloading = new List <ItemDownloading>(); ModifyMetadatas = new List <ActionFileMetaData>(); Deletes = new List <ActionDelete>(); FlatList = new ItemList(); List <ListViewItem> sel = new List <ListViewItem>(); sel.AddRange(GetSelectionCollection(lv, which)); Count = sel.Count; if (sel.Count == 0) { return; } foreach (ListViewItem lvi in sel) { if (lvi is null) { continue; } Item action = (Item)lvi.Tag; if (action != null) { FlatList.Add(action); } switch (action) { case ActionCopyMoveRename cmr when cmr.Operation == ActionCopyMoveRename.Op.rename: Rename.Add(cmr); break; // copy/move case ActionCopyMoveRename cmr: CopyMove.Add(cmr); break; case ActionDownloadImage item: SaveImages.Add(item); break; case ActionTDownload rss: DownloadTorrents.Add(rss); break; case ItemMissing missing: Missing.Add(missing); break; case ActionWriteMetadata nfo: WriteMetadatas.Add(nfo); break; case ActionFileMetaData meta: ModifyMetadatas.Add(meta); break; case ActionDelete delete: Deletes.Add(delete); break; case ItemDownloading down: Downloading.Add(down); break; default: throw new InvalidOperationException("Unexpected value of action " + action?.GetType()); } } }
public LvResults([NotNull] ListView lv, WhichResults which) { Go(lv, which); }
private static IEnumerable <ListViewItem> GetSelectionCollection([NotNull] ListView lv, WhichResults which) { switch (which) { case WhichResults.Checked: return(lv.CheckedItems.Cast <ListViewItem>()); case WhichResults.selected: return(lv.SelectedItems.Cast <ListViewItem>()); case WhichResults.all: return(lv.Items.Cast <ListViewItem>()); default: throw new ArgumentOutOfRangeException(nameof(which), which, null); } }