private void listView1_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { e.Item = new ListViewItem(); if (listViewEntries.View != View.Details) { return; } e.Item.ImageIndex = 5; ThumbCache.ThumbInfo img = null; try { img = cache.GetImage(e.ItemIndex, false); } catch { } if (img == null) { e.Item.Text = ""; e.Item.SubItems.Add(""); e.Item.SubItems.Add(""); e.Item.SubItems.Add(""); e.Item.SubItems.Add(""); e.Item.SubItems.Add(""); e.Item.SubItems.Add(""); return; } e.Item.Text = img.fileOffset.ToString(); e.Item.SubItems.Add(img.entrySize.ToString()); e.Item.SubItems.Add(img.entryHash.ToString("X16")); e.Item.SubItems.Add(img.fileNameLength.ToString()); e.Item.SubItems.Add(img.dataLength.ToString()); e.Item.SubItems.Add(img.dataChecksum.ToString("X16")); e.Item.SubItems.Add(img.headerChecksum.ToString("X16")); }
private void mnuSaveSelected_Click(object sender, EventArgs e) { if (listViewEntries.SelectedIndices.Count == 0) { MessageBox.Show(this, "Please select one or more images to save.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } string selectedPath = ""; using (FolderBrowserDialog dlg = new FolderBrowserDialog()) { dlg.ShowNewFolderButton = true; dlg.Description = "Select the folder where the images will be saved:"; if (dlg.ShowDialog(this) != DialogResult.OK) { return; } selectedPath = dlg.SelectedPath; } try { int filesSaved = 0; foreach (int itemIndex in listViewEntries.SelectedIndices) { ThumbCache.ThumbInfo img = null; try { img = cache.GetImage(itemIndex, true); } catch { } if (img == null) { continue; } string fileName = "image"; fileName = img.entryHash.ToString("X16"); img.image.Save(selectedPath + Path.DirectorySeparatorChar + fileName + ".bmp"); filesSaved++; } MessageBox.Show(this, "Successfully saved " + filesSaved + " files.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(this, "Error while saving file: " + ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }