static void ShowFilterForm() { var mockTags = new TreeGridItemCollection(); var parentA = new OSMTag("website"); var itemA = new OSMTreeGridItem(parentA, 0, 0, false, false); var AChildA = new OSMTreeGridItem(new OSMTag("website=http://www.google.com"), 1, 2, true, false); itemA.Children.Add(AChildA); var AChildB = new OSMTreeGridItem(new OSMTag("website=http://www.test.com"), 1, 2, true, false); itemA.Children.Add(AChildB); mockTags.Add(itemA); var parentB = new OSMTag("height"); var itemB = new OSMTreeGridItem(parentB, 0, 0, false, false); var BChildA = new OSMTreeGridItem(new OSMTag("height=10"), 2, 2, true, false); itemB.Children.Add(BChildA); var BChildB = new OSMTreeGridItem(new OSMTag("height=5"), 1, 1, true, false); itemB.Children.Add(BChildB); var CChildC = new OSMTreeGridItem(new OSMTag("height=11"), 3, 3, true, false); itemB.Children.Add(CChildC); var BChildD = new OSMTreeGridItem(new OSMTag("height=2"), 3, 3, true, false); itemB.Children.Add(BChildD); var CChildE = new OSMTreeGridItem(new OSMTag("height=20"), 3, 3, true, false); itemB.Children.Add(CChildE); mockTags.Add(itemB); new Application(Eto.Platforms.Wpf).Run(new FilterTagsForm(mockTags, HideObscure)); }
public MyForm() { // sets the client (inner) size of the window for your content this.ClientSize = new Eto.Drawing.Size(600, 400); this.Title = "Hello, Eto.Forms"; Content = new Label { Text = "Some content", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center }; TreeGridView view = new TreeGridView(); view.Columns.Add(new GridColumn() { HeaderText = "Test", DataCell = new TextBoxCell(0), AutoSize = true, Resizable = true, Editable = false }); view.Columns.Add(new GridColumn() { HeaderText = "Id", DataCell = new TextBoxCell(1), AutoSize = true, Resizable = true, Editable = false }); TreeGridItemCollection data = new TreeGridItemCollection(); TreeGridItem child = new TreeGridItem() { Values = new object[] { "Testing1", "Testing2" } }; TreeGridItem child2 = new TreeGridItem() { Values = new object[] { "Testing3", "Testing4" } }; TreeGridItem child3 = new TreeGridItem() { Values = new object[] { "Testing3", "Testing4" } }; child.Children.Add(new TreeGridItem() { Values = new object[] { "1", "2" } }); child2.Children.Add(new TreeGridItem() { Values = new object[] { "3", "4" } }); child3.Children.Add(new TreeGridItem() { Values = new object[] { "5", "6" } }); data.Add(child); data.Add(child2); child2.Children.Add(child3); view.DataStore = data; Content = view; }
public void Update(IEnumerable <libexeinfo.NE.ResourceType> resourceTypes, libexeinfo.NE.TargetOS os) { TreeGridItemCollection treeData = new TreeGridItemCollection(); foreach (libexeinfo.NE.ResourceType resourceType in resourceTypes.OrderBy(r => r.name)) { TreeGridItem root = new TreeGridItem { Values = new object[] { $"{resourceType.name}", null, null, null, os, null } }; foreach (libexeinfo.NE.Resource resource in resourceType.resources.OrderBy(r => r.name)) { root.Children.Add(new TreeGridItem { Values = new object[] { $"{resource.name}", $"{resource.data.Length}", $"{(libexeinfo.NE.ResourceFlags)((ushort)resource.flags & libexeinfo.NE.KNOWN_RSRC_FLAGS)}", $"{resourceType.name}", os, resource } }); } treeData.Add(root); } treeResources.DataStore = treeData; }
private void LoadMachines() { Machines = Machine.GetAll(); MachineSelectorItems.Clear(); var machineIcon = Icons.Get("vm", IconSize.Large); foreach (Machine machine in Machines) { var machineTreeGridItem = new TreeGridItem() { Expanded = false, Values = new object[] { machineIcon, machine.Name }, }; MachineSelectorItems.Add(machineTreeGridItem); } MachineSelector.DataStore = MachineSelectorItems; if (MachineSelectorItems.Count > 0) { MachineSelector.SelectedRow = 0; } MachinesLoaded = true; UpdateTitle(); }
public void Update(IEnumerable <ResourceTypeBlock> resources, bool bigEndian) { TreeGridItemCollection treeData = new TreeGridItemCollection(); foreach (ResourceTypeBlock type in resources.OrderBy(r => r.type)) { TreeGridItem root = new TreeGridItem { Values = new object[] { $"{type.type}", null, null, null, null } }; foreach (Resource resource in type.resources.OrderBy(r => r.name).ThenBy(r => r.id).ThenBy(r => r.index)) { TreeGridItem child = new TreeGridItem { Values = new object[] { $"{resource.name}", $"{resource.id}", resource.data == null ? null : $"{resource.data.Length}", $"{type.type}", resource.data } }; root.Children.Add(child); } treeData.Add(root); } treeResources.DataStore = treeData; this.bigEndian = bigEndian; }
public void Update(IEnumerable <libexeinfo.NE.ResourceType> resourceTypes) { treeData = new TreeGridItemCollection(); foreach (libexeinfo.NE.ResourceType resourceType in resourceTypes.OrderBy(r => r.name)) { TreeGridItem root = new TreeGridItem { Values = new object[] { $"{resourceType.name}", null, null, null } }; foreach (libexeinfo.NE.Resource resource in resourceType.resources.OrderBy(r => r.name)) { root.Children.Add(new TreeGridItem { Values = new object[] { $"{resource.name}", $"{resource.data.Length}", $"{resourceType.name}", resource } }); } treeData.Add(root); } treeResources.DataStore = treeData; }
public void DrawableCellAsFirstColumnShouldNotBeWhite() { ManualForm("Both cells should show the same", form => { TreeGridView tree = new TreeGridView(); // add first drawable (it will be rendered all white! var drawableCell1 = new DrawableCell(); drawableCell1.Paint += drawableCell_Paint; tree.Columns.Add(new GridColumn { HeaderText = "not working", DataCell = drawableCell1, Width = 200 }); // add the second drawable var drawableCell2 = new DrawableCell(); drawableCell2.Paint += drawableCell_Paint; tree.Columns.Add(new GridColumn { HeaderText = "working", DataCell = drawableCell2, Width = 200 }); // add some data to the tree just to populate it TreeGridItemCollection model = new TreeGridItemCollection(); TreeGridItem item1 = new TreeGridItem(); item1.Values = new object[] { "text" }; TreeGridItem item2 = new TreeGridItem(); item2.Values = new object[] { "text" }; item1.Children.Add(item2); item1.Expanded = true; model.Add(item1); tree.DataStore = model; return(tree); }); }
private void PopulateResultExplorerMatch(MatchCollection matches, string[] groupNames) { tvwResultExplorer.SuspendLayout(); ResetResultExplorer(); var treeGridItemCollection = new TreeGridItemCollection(); foreach (Match match in matches) { var item = new TreeGridItem() { Values = new string[] { match.Value }, Tag = match }; foreach (string groupName in groupNames.Where(g => g != "0")) { Group group = match.Groups[groupName]; item.Children.Add(new TreeGridItem() { Values = new string[] { $"{groupName}: {group.Value}" }, Tag = group }); } treeGridItemCollection.Add(item); } tvwResultExplorer.DataStore = treeGridItemCollection; tvwResultExplorer.ResumeLayout(); }
public void SettingWidthShouldDisableAutosize() { ManualForm("Width of column should be 300px and not change when scrolling", form => { var control = new T(); control.Width = 400; control.Height = 200; var column = new GridColumn { DataCell = new TextBoxCell(0), AutoSize = true, Width = 300, // setting width should set AutoSize to false HeaderText = "Cell" }; control.Columns.Add(column); Assert.IsFalse(column.AutoSize, "#1"); var dd = new TreeGridItemCollection(); for (int i = 0; i < 1000; i++) { dd.Add(new TreeGridItem { Values = new[] { "Row " + i } }); } SetDataStore(control, dd); return(control); }); }
private TreeGridItemCollection GetTree(List <FullStory> stories) { TreeGridItemCollection data = new TreeGridItemCollection(); foreach (FullStory story in stories) { TreeGridItem tgiParent = new TreeGridItem() { Values = new object[] { WebUtility.HtmlDecode(story.title) } }; string all5 = string.Empty; foreach (string s in story.GetTopNWords(5)) { all5 += s + " "; } tgiParent.Children.Add(new TreeGridItem() { Values = new object[] { WebUtility.HtmlDecode(all5) } }); data.Add(tgiParent); foreach (children child in story.children) { TreeGridItem tgi = GetCommentTree(child); if (tgi.Tag != "empty") { tgiParent.Children.Add(tgi); } } } return(data); }
public void Update(libexeinfo.PE.ResourceNode root) { TreeGridItemCollection treeData = new TreeGridItemCollection(); foreach (libexeinfo.PE.ResourceNode rootChild in root.children) { treeData.Add(GetChildren(rootChild, rootChild.name)); } treeResources.DataStore = treeData; }
public IEnumerable <object> CreateDataStore(int rows = 20) { var list = new TreeGridItemCollection(); for (int i = 0; i < rows; i++) { list.Add(new GridTestItem { Text = $"Item {i}", Values = new[] { $"col {i}.2", $"col {i}.3", $"col {i}.4" } }); } return(list); }
public FileHierarchy() { this.Size = new Size(-1, 500); this.Columns.Add(new GridColumn { DataCell = new TextBoxCell(0) }); TreeGridItemCollection _collection = new TreeGridItemCollection(); TreeGridItem child = new TreeGridItem("Select a file to start"); _collection.Add(child); this.DataStore = _collection; }
private TreeGridItemCollection GetTree(Story story) { TreeGridItemCollection data = new TreeGridItemCollection(); foreach (Comment comment in story.Comments) { TreeGridItem tgi = GetCommentTree(comment); if (tgi.Tag != "empty") { data.Add(tgi); } } return(data); }
/// <summary>Parse the Grasshopper data tree into the form's data tree</summary> protected TreeGridItemCollection GetSelectableTagsFromInputTree(OSMListWithPaths requests) { var indexOfParents = new Dictionary <string, int>(); var sortedTags = requests.items.OrderBy(t => t.ToString()).ToList(); var selectableTags = new TreeGridItemCollection(); foreach (var tag in sortedTags) { if (tag.Key != null) { if (!indexOfParents.ContainsKey(tag.Key.Value)) { var parentItem = new OSMTreeGridItem(tag.Key, 0, 0, true, false); selectableTags.Add(parentItem); indexOfParents[parentItem.OSMData.Value] = selectableTags.Count - 1; } } var nodeCount = 0; var wayCount = 0; if (ProvidedNodes) { nodeCount = requests.pathsPerItem[tag].Count(); } else { wayCount = requests.pathsPerItem[tag].Count(); } var childItem = new OSMTreeGridItem(tag, nodeCount, wayCount, true, false); if (childItem.OSMData.Key != null) { var parentKey = indexOfParents[childItem.OSMData.Key.Value]; var parent = selectableTags[parentKey] as OSMTreeGridItem; parent.Children.Add(childItem); } } foreach (OSMTreeGridItem tag in selectableTags) // Hack to sort numeric data properly { if (OSMSpecialTags.numericTags.ContainsKey(tag.OSMData.Value)) { var childrenCopy = tag.Children.Cast <OSMTreeGridItem>().OrderBy( item => TreeGridUtilities.MayBeIntSort(item)).ToList(); tag.Children.Clear(); tag.Children.AddRange(childrenCopy); } } return(selectableTags); }
public frmMain(bool debug, bool verbose) { XamlReader.Load(this); lblError = new Label(); grdFiles = new GridView(); ConsoleHandler.Init(); ConsoleHandler.Debug = debug; ConsoleHandler.Verbose = verbose; treeImagesItems = new TreeGridItemCollection(); treeImages.Columns.Add(new GridColumn { HeaderText = "Name", DataCell = new TextBoxCell(0) }); treeImages.AllowMultipleSelection = false; treeImages.ShowHeader = false; treeImages.DataStore = treeImagesItems; imagesRoot = new TreeGridItem { Values = new object[] { "Images" } }; devicesRoot = new TreeGridItem { Values = new object[] { "Devices" } }; treeImagesItems.Add(imagesRoot); treeImagesItems.Add(devicesRoot); placeholderItem = new TreeGridItem { Values = new object[] { "You should not be seeing this" } }; Closing += OnClosing; }
void CreateTreeData(TreeGridItemCollection coll, int level, string parentString = "Item") { for (int i = 0; i < 10; i++) { var itemText = $"{parentString}-{i}"; var item = new TreeGridItem { Values = new[] { itemText } }; if (level < 2 && (i % 4) != 0) { CreateTreeData(item.Children, level + 1, itemText); } coll.Add(item); } }
private void updateTree() { var collection = new TreeGridItemCollection(); var children = new TreeGridItemCollection(); foreach (var info in this.fileInformation.children) { var tempItem = new TreeGridItem(Path.GetFileName(info.filename)); children.Add(tempItem); } var topLevelItem = new TreeGridItem(children, Path.GetFileName(currentState.currentlySelectedFile)); collection.Add(topLevelItem); this.treeView.DataStore = collection; }
private static TreeGridItemCollection GetCodeTree(IEnumerable <object> rootItems, object executingItem, ref TreeGridItem executingTreeGridViewItem) { TreeGridItemCollection result = new TreeGridItemCollection(); foreach (object currentItem in rootItems) { TreeGridItem newTreeViewItem = currentItem is Mira.Items currentItems ? new TreeGridItem(GetCodeTree(currentItems, executingItem, ref executingTreeGridViewItem), "(Items)") : new TreeGridItem(currentItem.ToString(), currentItem.GetType().Name); newTreeViewItem.Tag = currentItem; newTreeViewItem.Expanded = true; result.Add(newTreeViewItem); if (currentItem == executingItem) { executingTreeGridViewItem = newTreeViewItem; } } return(result); }
public void Update(libexeinfo.GEM.TreeObjectNode[] roots, libexeinfo.GEM.ColorIcon[] cicons) { treeData = new TreeGridItemCollection(); for (int i = 0; i < roots.Length; i++) { TreeGridItem root = new TreeGridItem { Values = new object[] { $"Root {i}", null } }; AddObjectToTree(root, roots[i]); treeData.Add(root); } treeResources.DataStore = treeData; colorIcons = cicons; }
/// <summary>Given a pre-existing tree grid collection, show/hide items based on if obscure features should be hidden </summary> public static TreeGridItemCollection FilterByObscurity(TreeGridItemCollection selectableData, bool hideObscureFeatures, TreeGridItemCollection currentSelectableData = null) { // Need to clone the items and make a new list to preserve the original Collection as unfiltered var newSelectableData = new TreeGridItemCollection(); for (var i = 0; i < selectableData.Count; i++) { // Try to preserve open/close and selected/unselected state during filtering var previousItem = selectableData[i] as OSMTreeGridItem; if (currentSelectableData != null) { var currentItem = currentSelectableData.Where(t => t.ToString() == previousItem.ToString()).First(); if (currentItem != null) { previousItem = currentItem as OSMTreeGridItem; } } var currentTagExpanded = previousItem.Expanded; var currentTagSelected = previousItem.IsSelected(); var originalTag = selectableData[i] as OSMTreeGridItem; if (originalTag.IsObscure && hideObscureFeatures) { continue; } var newTag = new OSMTreeGridItem(originalTag.OSMData, originalTag.OSMData.NodeCount, originalTag.OSMData.WayCount, originalTag.IsParsed, currentTagSelected, currentTagExpanded); foreach (OSMTreeGridItem originalChild in originalTag.Children) { if (!originalChild.IsObscure || !hideObscureFeatures) { newTag.Children.Add(originalChild); } } newSelectableData.Add(newTag); } return(newSelectableData); }
public void ClickingWithEmptyDataShouldNotCrash(bool allowEmptySelection, bool allowMultipleSelection) { Exception exception = null; Form(form => { var dd = new TreeGridItemCollection(); dd.Add(new TreeGridItem { Values = new[] { "Hello" } }); var control = new TreeGridView(); control.AllowEmptySelection = allowEmptySelection; control.AllowMultipleSelection = allowMultipleSelection; control.Columns.Add(new GridColumn { DataCell = new TextBoxCell(0), Width = 100, HeaderText = "Text Cell" }); control.DataStore = dd; Application.Instance.AsyncInvoke(() => { // can crash when had selection initially but no selection after. try { control.DataStore = new TreeGridItemCollection(); } catch (Exception ex) { exception = ex; } Application.Instance.AsyncInvoke(form.Close); }); form.Content = control; }); if (exception != null) { ExceptionDispatchInfo.Capture(exception).Throw(); } }
private void PopulateResultExplorerSplit(string[] splitTexts) { tvwResultExplorer.SuspendLayout(); ResetResultExplorer(); var treeGridItemCollection = new TreeGridItemCollection(); foreach (string splitText in splitTexts) { var item = new TreeGridItem() { Values = new string[] { splitText }, Tag = splitText }; treeGridItemCollection.Add(item); } tvwResultExplorer.DataStore = treeGridItemCollection; tvwResultExplorer.ResumeLayout(); }
public static TreeGridItemCollection GetTreeCollection() { var selectableOSMs = new TreeGridItemCollection(); var indexOfParents = new Dictionary <string, int>(); var primaryFeatures = new List <OSMTag>(OSMPrimaryTypes.Keys.Values); for (var i = 0; i < primaryFeatures.Count; i++) { var parentItem = new OSMTreeGridItem(primaryFeatures[i], 0, 0, false, false); selectableOSMs.Add(parentItem); indexOfParents[primaryFeatures[i].Value] = i; } var secondaryFeatures = OSMPrimaryTypes.Values; foreach (var keyValue in secondaryFeatures.Keys) { var item = secondaryFeatures[keyValue]; var parentItem = selectableOSMs[indexOfParents[item["key"]]] as OSMTreeGridItem; var childOSM = new OSMTag(item["value"], null, item["description"], parentItem.OSMData); var childItem = new OSMTreeGridItem(childOSM, int.Parse(item["nodes"]), int.Parse(item["ways"]), false, false); if (childItem.OSMData.Value == "yes") { parentItem.Children.Insert(0, childItem); } else { parentItem.Children.Add(childItem); } } return(selectableOSMs); }
public dlgStatistics() { XamlReader.Load(this); DicContext ctx = DicContext.Create(Settings.Settings.LocalDbPath); if (ctx.Commands.Any()) { if (ctx.Commands.Any(c => c.Name == "analyze")) { ulong count = ctx.Commands.Where(c => c.Name == "analyze" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "analyze" && !c.Synchronized); lblAnalyze.Visible = true; lblAnalyze.Text = $"You have called the Analyze command {count} times"; } if (ctx.Commands.Any(c => c.Name == "benchmark")) { ulong count = ctx.Commands.Where(c => c.Name == "benchmark" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "benchmark" && !c.Synchronized); lblBenchmark.Visible = true; lblBenchmark.Text = $"You have called the Benchmark command {count} times"; } if (ctx.Commands.Any(c => c.Name == "checksum")) { ulong count = ctx.Commands.Where(c => c.Name == "checksum" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "checksum" && !c.Synchronized); lblChecksum.Visible = true; lblChecksum.Text = $"You have called the Checksum command {count} times"; } if (ctx.Commands.Any(c => c.Name == "compare")) { ulong count = ctx.Commands.Where(c => c.Name == "compare" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "compare" && !c.Synchronized); lblCompare.Visible = true; lblCompare.Text = $"You have called the Compare command {count} times"; } if (ctx.Commands.Any(c => c.Name == "convert-image")) { ulong count = ctx.Commands.Where(c => c.Name == "convert-image" && c.Synchronized) .Select(c => c.Count).FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "convert-image" && !c.Synchronized); lblConvertImage.Visible = true; lblConvertImage.Text = $"You have called the Convert-Image command {count} times"; } if (ctx.Commands.Any(c => c.Name == "create-sidecar")) { ulong count = ctx.Commands.Where(c => c.Name == "create-sidecar" && c.Synchronized) .Select(c => c.Count).FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "create-sidecar" && !c.Synchronized); lblCreateSidecar.Visible = true; lblCreateSidecar.Text = $"You have called the Create-Sidecar command {count} times"; } if (ctx.Commands.Any(c => c.Name == "decode")) { ulong count = ctx.Commands.Where(c => c.Name == "decode" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "decode" && !c.Synchronized); lblDecode.Visible = true; lblDecode.Text = $"You have called the Decode command {count} times"; } if (ctx.Commands.Any(c => c.Name == "device-info")) { ulong count = ctx.Commands.Where(c => c.Name == "device-info" && c.Synchronized) .Select(c => c.Count).FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-info" && !c.Synchronized); lblDeviceInfo.Visible = true; lblDeviceInfo.Text = $"You have called the Device-Info command {count} times"; } if (ctx.Commands.Any(c => c.Name == "device-report")) { ulong count = ctx.Commands.Where(c => c.Name == "device-report" && c.Synchronized) .Select(c => c.Count).FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-report" && !c.Synchronized); lblDeviceReport.Visible = true; lblDeviceReport.Text = $"You have called the Device-Report command {count} times"; } if (ctx.Commands.Any(c => c.Name == "dump-media")) { ulong count = ctx.Commands.Where(c => c.Name == "dump-media" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "dump-media" && !c.Synchronized); lblDumpMedia.Visible = true; lblDumpMedia.Text = $"You have called the Dump-Media command {count} times"; } if (ctx.Commands.Any(c => c.Name == "entropy")) { ulong count = ctx.Commands.Where(c => c.Name == "entropy" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "entropy" && !c.Synchronized); lblEntropy.Visible = true; lblEntropy.Text = $"You have called the Entropy command {count} times"; } if (ctx.Commands.Any(c => c.Name == "formats")) { ulong count = ctx.Commands.Where(c => c.Name == "formats" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "formats" && !c.Synchronized); lblFormats.Visible = true; lblFormats.Text = $"You have called the Formats command {count} times"; } if (ctx.Commands.Any(c => c.Name == "image-info")) { ulong count = ctx.Commands.Where(c => c.Name == "image-info" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "image-info" && !c.Synchronized); lblImageInfo.Visible = true; lblImageInfo.Text = $"You have called the Image-Info command {count} times"; } if (ctx.Commands.Any(c => c.Name == "media-info")) { ulong count = ctx.Commands.Where(c => c.Name == "media-info" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-info" && !c.Synchronized); lblMediaInfo.Visible = true; lblMediaInfo.Text = $"You have called the Media-Info command {count} times"; } if (ctx.Commands.Any(c => c.Name == "media-scan")) { ulong count = ctx.Commands.Where(c => c.Name == "media-scan" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-scan" && !c.Synchronized); lblMediaScan.Visible = true; lblMediaScan.Text = $"You have called the Media-Scan command {count} times"; } if (ctx.Commands.Any(c => c.Name == "printhex")) { ulong count = ctx.Commands.Where(c => c.Name == "printhex" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "printhex" && !c.Synchronized); lblPrintHex.Visible = true; lblPrintHex.Text = $"You have called the Print-Hex command {count} times"; } if (ctx.Commands.Any(c => c.Name == "verify")) { ulong count = ctx.Commands.Where(c => c.Name == "verify" && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Commands.LongCount(c => c.Name == "verify" && !c.Synchronized); lblVerify.Visible = true; lblVerify.Text = $"You have called the Verify command {count} times"; } tabCommands.Visible = lblAnalyze.Visible || lblBenchmark.Visible || lblChecksum.Visible || lblCompare.Visible || lblConvertImage.Visible || lblCreateSidecar.Visible || lblDecode.Visible || lblDeviceInfo.Visible || lblDeviceReport.Visible || lblDumpMedia.Visible || lblEntropy.Visible || lblFormats.Visible || lblImageInfo.Visible || lblMediaInfo.Visible || lblMediaScan.Visible || lblPrintHex.Visible || lblVerify.Visible; } if (ctx.Filters.Any()) { tabFilters.Visible = true; TreeGridItemCollection filterList = new TreeGridItemCollection(); treeFilters.Columns.Add(new GridColumn { HeaderText = "Filter", DataCell = new TextBoxCell(0) }); treeFilters.Columns.Add(new GridColumn { HeaderText = "Times found", DataCell = new TextBoxCell(1) }); treeFilters.AllowMultipleSelection = false; treeFilters.ShowHeader = true; treeFilters.DataStore = filterList; foreach (string nvs in ctx.Filters.Select(n => n.Name).Distinct()) { ulong count = ctx.Filters.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Filters.LongCount(c => c.Name == nvs && !c.Synchronized); filterList.Add(new TreeGridItem { Values = new object[] { nvs, count } }); } } if (ctx.MediaFormats.Any()) { tabFormats.Visible = true; TreeGridItemCollection formatList = new TreeGridItemCollection(); treeFormats.Columns.Add(new GridColumn { HeaderText = "Format", DataCell = new TextBoxCell(0) }); treeFormats.Columns.Add(new GridColumn { HeaderText = "Times found", DataCell = new TextBoxCell(1) }); treeFormats.AllowMultipleSelection = false; treeFormats.ShowHeader = true; treeFormats.DataStore = formatList; foreach (string nvs in ctx.MediaFormats.Select(n => n.Name).Distinct()) { ulong count = ctx.MediaFormats.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.MediaFormats.LongCount(c => c.Name == nvs && !c.Synchronized); formatList.Add(new TreeGridItem { Values = new object[] { nvs, count } }); } } if (ctx.Partitions.Any()) { tabPartitions.Visible = true; TreeGridItemCollection partitionList = new TreeGridItemCollection(); treePartitions.Columns.Add(new GridColumn { HeaderText = "Filter", DataCell = new TextBoxCell(0) }); treePartitions.Columns.Add(new GridColumn { HeaderText = "Times found", DataCell = new TextBoxCell(1) }); treePartitions.AllowMultipleSelection = false; treePartitions.ShowHeader = true; treePartitions.DataStore = partitionList; foreach (string nvs in ctx.Partitions.Select(n => n.Name).Distinct()) { ulong count = ctx.Partitions.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Partitions.LongCount(c => c.Name == nvs && !c.Synchronized); partitionList.Add(new TreeGridItem { Values = new object[] { nvs, count } }); } } if (ctx.Filesystems.Any()) { tabFilesystems.Visible = true; TreeGridItemCollection filesystemList = new TreeGridItemCollection(); treeFilesystems.Columns.Add(new GridColumn { HeaderText = "Filesystem", DataCell = new TextBoxCell(0) }); treeFilesystems.Columns.Add(new GridColumn { HeaderText = "Times found", DataCell = new TextBoxCell(1) }); treeFilesystems.AllowMultipleSelection = false; treeFilesystems.ShowHeader = true; treeFilesystems.DataStore = filesystemList; foreach (string nvs in ctx.Filesystems.Select(n => n.Name).Distinct()) { ulong count = ctx.Filesystems.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Filesystems.LongCount(c => c.Name == nvs && !c.Synchronized); filesystemList.Add(new TreeGridItem { Values = new object[] { nvs, count } }); } } if (ctx.SeenDevices.Any()) { tabDevices.Visible = true; TreeGridItemCollection deviceList = new TreeGridItemCollection(); treeDevices.Columns.Add(new GridColumn { HeaderText = "Device", DataCell = new TextBoxCell(0) }); treeDevices.Columns.Add(new GridColumn { HeaderText = "Manufacturer", DataCell = new TextBoxCell(1) }); treeDevices.Columns.Add(new GridColumn { HeaderText = "Revision", DataCell = new TextBoxCell(2) }); treeDevices.Columns.Add(new GridColumn { HeaderText = "Bus", DataCell = new TextBoxCell(3) }); treeDevices.AllowMultipleSelection = false; treeDevices.ShowHeader = true; treeDevices.DataStore = deviceList; foreach (DeviceStat ds in ctx.SeenDevices.OrderBy(n => n.Manufacturer).ThenBy(n => n.Manufacturer) .ThenBy(n => n.Revision) .ThenBy(n => n.Bus)) { deviceList.Add(new TreeGridItem { Values = new object[] { ds.Model, ds.Manufacturer, ds.Revision, ds.Bus } }); } } if (!ctx.Medias.Any()) { return; } tabMedias.Visible = true; TreeGridItemCollection mediaList = new TreeGridItemCollection(); treeMedias.Columns.Add(new GridColumn { HeaderText = "Media", DataCell = new TextBoxCell(0) }); treeMedias.Columns.Add(new GridColumn { HeaderText = "Times found", DataCell = new TextBoxCell(1) }); treeMedias.Columns.Add(new GridColumn { HeaderText = "Type", DataCell = new TextBoxCell(2) }); treeMedias.AllowMultipleSelection = false; treeMedias.ShowHeader = true; treeMedias.DataStore = mediaList; foreach (string media in ctx.Medias.OrderBy(ms => ms.Type).Select(ms => ms.Type).Distinct()) { ulong count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && c.Real).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && c.Real); if (count > 0) { mediaList.Add(new TreeGridItem { Values = new object[] { media, count, "real" } }); } count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && !c.Real).Select(c => c.Count) .FirstOrDefault(); count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && !c.Real); if (count == 0) { continue; } mediaList.Add(new TreeGridItem { Values = new object[] { media, count, "image" } }); } }
public void BeginEditShoudWorkOnCustomCells() { ManualForm("The custom cell should go in edit mode when clicking the BeginEdit button", form => { var grid = new T(); grid.ShowHeader = true; grid.AllowMultipleSelection = true; string CellInfo(GridViewCellEventArgs e) => $"Row: {e.Row}, Column: {e.Column}"; string CellEditInfo(CellEventArgs e) => $"Row: {e.Row}"; void AddLogging(CustomCell cell) { cell.BeginEdit += (sender, e) => Log.Write(sender, $"BeginEdit {CellEditInfo(e)}, Grid.IsEditing: {grid.IsEditing}"); cell.CommitEdit += (sender, e) => Log.Write(sender, $"CommitEdit {CellEditInfo(e)}, Grid.IsEditing: {grid.IsEditing}"); cell.CancelEdit += (sender, e) => Log.Write(sender, $"CancelEdit {CellEditInfo(e)}, Grid.IsEditing: {grid.IsEditing}"); if (!CustomCell.SupportsControlView) { cell.GetPreferredWidth = args => 100; cell.Paint += (sender, e) => { e.Graphics.DrawText(SystemFonts.Default(), Brushes.Black, e.ClipRectangle, "Cell", alignment: FormattedTextAlignment.Center); }; } } grid.CellEditing += (sender, e) => Log.Write(sender, $"CellEditing {CellInfo(e)}, Grid.IsEditing: {grid.IsEditing}"); grid.CellEdited += (sender, e) => Log.Write(sender, $"CellEdited {CellInfo(e)}, Grid.IsEditing: {grid.IsEditing}"); var customCell = new CustomCell(); customCell.CreateCell = args => { var textBox = new TextBox { ShowBorder = false, BackgroundColor = Colors.Transparent }; if (!Platform.Instance.IsMac) { textBox.GotFocus += (sender, e) => textBox.BackgroundColor = SystemColors.ControlBackground; textBox.LostFocus += (sender, e) => textBox.BackgroundColor = Colors.Transparent; // ugly, there should be a better way to do this.. var colorBinding = textBox.Bind(c => c.TextColor, args, Binding.Property((CellEventArgs a) => a.CellTextColor).Convert(c => args.IsEditing ? SystemColors.ControlText : c)); args.PropertyChanged += (sender, e) => { if (e.PropertyName == nameof(CellEventArgs.IsEditing)) { colorBinding.Update(); } }; } else { // macOS handles colors more automaticcally for a TextBox } textBox.TextBinding.BindDataContext((GridTestItem i) => i.Text); return(textBox); }; AddLogging(customCell); grid.Columns.Add(new GridColumn { DataCell = customCell, Editable = true, HeaderText = "CustomTextBox" }); var customCell2 = new CustomCell(); customCell2.CreateCell = args => { var dropDown = new DropDown { Items = { "Item 1", "Item 2", "Item 3" } }; return(dropDown); }; AddLogging(customCell2); grid.Columns.Add(new GridColumn { DataCell = customCell2, Editable = true, HeaderText = "CustomDropDown" }); var customCell3 = new CustomCell(); customCell3.CreateCell = args => { var checkBox = new CheckBox(); return(checkBox); }; AddLogging(customCell3); grid.Columns.Add(new GridColumn { DataCell = customCell3, Editable = true, HeaderText = "CustomCheckBox" }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell(nameof(GridTestItem.Text)), HeaderText = "TextBoxCell", Editable = true }); var list = new TreeGridItemCollection(); list.Add(new GridTestItem { Text = "Item 1" }); list.Add(new GridTestItem { Text = "Item 2" }); list.Add(new GridTestItem { Text = "Item 3" }); SetDataStore(grid, list); // using MouseDown so the buttons don't get focus var beginEditButton = new Button { Text = "BeginEdit" }; beginEditButton.MouseDown += (sender, e) => { grid.BeginEdit(1, 0); e.Handled = true; }; var commitEditButton = new Button { Text = "CommitEdit" }; commitEditButton.MouseDown += (sender, e) => { grid.CommitEdit(); e.Handled = true; }; var cancelEditButton = new Button { Text = "CancelEdit" }; cancelEditButton.MouseDown += (sender, e) => { grid.CancelEdit(); e.Handled = true; }; return(new TableLayout( TableLayout.Horizontal(4, beginEditButton, commitEditButton, cancelEditButton, null), grid )); }); }
public pnlScsiInfo(ScsiInfo scsiInfo) { XamlReader.Load(this); this.scsiInfo = scsiInfo; Stream logo = ResourceHandler.GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{scsiInfo.MediaType}.svg"); /* if(logo != null) * { * svgMediaLogo.SvgStream = logo; * svgMediaLogo.Visible = true; * } * else * {*/ logo = ResourceHandler.GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{scsiInfo.MediaType}.png"); if (logo != null) { imgMediaLogo.Image = new Bitmap(logo); imgMediaLogo.Visible = true; } //} switch (this.scsiInfo.MediaType) { case MediaType.HDDVDROM: case MediaType.HDDVDRAM: case MediaType.HDDVDR: case MediaType.HDDVDRW: case MediaType.HDDVDRDL: case MediaType.HDDVDRWDL: tabDvd.Text = "HD DVD"; break; default: tabDvd.Text = "DVD"; break; } switch (this.scsiInfo.MediaType) { case MediaType.DVDR: tabDvdr.Text = "DVD-R"; break; case MediaType.DVDRW: tabDvdr.Text = "DVD-RW"; break; case MediaType.DVDPR: tabDvdr.Text = "DVD+R"; break; case MediaType.DVDPRW: tabDvdr.Text = "DVD+RW"; break; case MediaType.DVDPRWDL: tabDvdr.Text = "DVD+RW DL"; break; case MediaType.DVDRDL: tabDvdr.Text = "DVD-R DL"; break; case MediaType.DVDPRDL: tabDvdr.Text = "DVD+R DL"; break; case MediaType.DVDRAM: tabDvdr.Text = "DVD-RAM"; break; case MediaType.DVDRWDL: tabDvdr.Text = "DVD-RW DL"; break; case MediaType.HDDVDRAM: tabDvdr.Text = "HD DVD-RAM"; break; case MediaType.HDDVDR: tabDvdr.Text = "HD DVD-R"; break; case MediaType.HDDVDRW: tabDvdr.Text = "HD DVD-RW"; break; case MediaType.HDDVDRDL: tabDvdr.Text = "HD DVD-R DL"; break; case MediaType.HDDVDRWDL: tabDvdr.Text = "HD DVD-RW DL"; break; } txtType.Text = scsiInfo.MediaType.ToString(); lblMediaSize.Text = $"Media has {scsiInfo.Blocks} blocks of {scsiInfo.BlockSize} bytes/each. (for a total of {scsiInfo.Blocks * scsiInfo.BlockSize} bytes)"; lblMediaSize.Visible = scsiInfo.Blocks != 0 && scsiInfo.BlockSize != 0; if (scsiInfo.MediaSerialNumber != null) { stkMediaSerial.Visible = true; StringBuilder sbSerial = new StringBuilder(); for (int i = 4; i < scsiInfo.MediaSerialNumber.Length; i++) { sbSerial.AppendFormat("{0:X2}", scsiInfo.MediaSerialNumber[i]); } txtMediaSerial.Text = sbSerial.ToString(); } btnSaveReadMediaSerial.Visible = this.scsiInfo.MediaSerialNumber != null; btnSaveReadCapacity.Visible = this.scsiInfo.ReadCapacity != null; btnSaveReadCapacity16.Visible = this.scsiInfo.ReadCapacity16 != null; btnSaveGetConfiguration.Visible = this.scsiInfo.MmcConfiguration != null; btnSaveRecognizedFormatLayers.Visible = this.scsiInfo.RecognizedFormatLayers != null; btnSaveWriteProtectionStatus.Visible = this.scsiInfo.WriteProtectionStatus != null; tabMmc.Visible = btnSaveGetConfiguration.Visible || btnSaveRecognizedFormatLayers.Visible || btnSaveWriteProtectionStatus.Visible; if (this.scsiInfo.DensitySupportHeader.HasValue) { grpDensitySupport.Visible = true; txtDensitySupport.Text = DensitySupport.PrettifyDensity(scsiInfo.DensitySupportHeader); } if (this.scsiInfo.MediaTypeSupportHeader.HasValue) { grpMediumSupport.Visible = true; txtMediumSupport.Text = DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupportHeader); } btnSaveDensitySupport.Visible = scsiInfo.DensitySupport != null; btnSaveMediumSupport.Visible = scsiInfo.MediaTypeSupport != null; tabSsc.Visible = grpDensitySupport.Visible || grpMediumSupport.Visible || btnSaveDensitySupport.Visible || btnSaveMediumSupport.Visible; if (this.scsiInfo.DecodedCompactDiscInformation.HasValue) { tabCdInformation.Visible = true; txtCdInformation.Text = DiscInformation.Prettify000b(scsiInfo.DecodedCompactDiscInformation); btnCdInformation.Visible = scsiInfo.CompactDiscInformation != null; } if (this.scsiInfo.DecodedToc.HasValue) { tabCdToc.Visible = true; txtCdToc.Text = TOC.Prettify(scsiInfo.DecodedToc); btnCdToc.Visible = scsiInfo.Toc != null; } if (this.scsiInfo.FullToc.HasValue) { tabCdFullToc.Visible = true; txtCdFullToc.Text = FullTOC.Prettify(scsiInfo.FullToc); btnCdFullToc.Visible = scsiInfo.RawToc != null; } if (this.scsiInfo.DecodedSession.HasValue) { tabCdSession.Visible = true; txtCdSession.Text = Session.Prettify(scsiInfo.DecodedSession); btnCdSession.Visible = scsiInfo.Session != null; } if (this.scsiInfo.DecodedCdTextLeadIn.HasValue) { tabCdText.Visible = true; txtCdText.Text = CDTextOnLeadIn.Prettify(this.scsiInfo.DecodedCdTextLeadIn); btnCdText.Visible = scsiInfo.CdTextLeadIn != null; } if (this.scsiInfo.DecodedAtip.HasValue) { tabCdAtip.Visible = true; txtCdAtip.Text = ATIP.Prettify(this.scsiInfo.Atip); btnCdAtip.Visible = scsiInfo.Atip != null; } if (!string.IsNullOrEmpty(scsiInfo.Mcn)) { stkMcn.Visible = true; txtMcn.Text = scsiInfo.Mcn; } if (this.scsiInfo.Isrcs != null && this.scsiInfo.Isrcs.Count > 0) { grpIsrcs.Visible = true; TreeGridItemCollection isrcsItems = new TreeGridItemCollection(); grdIsrcs.Columns.Add(new GridColumn { HeaderText = "ISRC", DataCell = new TextBoxCell(0) }); grdIsrcs.Columns.Add(new GridColumn { HeaderText = "Track", DataCell = new TextBoxCell(0) }); grdIsrcs.AllowMultipleSelection = false; grdIsrcs.ShowHeader = true; grdIsrcs.DataStore = isrcsItems; foreach (KeyValuePair <byte, string> isrc in this.scsiInfo.Isrcs) { isrcsItems.Add(new TreeGridItem { Values = new object[] { isrc.Key.ToString(), isrc.Value } }); } } btnCdPma.Visible = this.scsiInfo.Pma != null; tabCdMisc.Visible = stkMcn.Visible || grpIsrcs.Visible || btnCdPma.Visible; tabCd.Visible = tabCdInformation.Visible || tabCdToc.Visible || tabCdFullToc.Visible || tabCdSession.Visible || tabCdText.Visible || tabCdAtip.Visible || stkMcn.Visible || grpIsrcs.Visible || btnCdPma.Visible; if (this.scsiInfo.DecodedPfi.HasValue) { grpDvdPfi.Visible = true; txtDvdPfi.Text = PFI.Prettify(this.scsiInfo.DecodedPfi); } if (this.scsiInfo.DvdCmi != null) { grpDvdCmi.Visible = true; txtDvdCmi.Text = CSS_CPRM.PrettifyLeadInCopyright(this.scsiInfo.DvdCmi); btnSaveDvdCmi.Visible = true; } btnSaveDvdPfi.Visible = this.scsiInfo.DvdPfi != null; btnSaveDvdDmi.Visible = this.scsiInfo.DvdDmi != null; btnSaveDvdCmi.Visible = this.scsiInfo.DvdCmi != null; btnSaveHdDvdCmi.Visible = this.scsiInfo.HddvdCopyrightInformation != null; btnSaveDvdBca.Visible = this.scsiInfo.DvdBca != null; btnSaveDvdAacs.Visible = this.scsiInfo.DvdAacs != null; tabDvd.Visible = grpDvdPfi.Visible || grpDvdCmi.Visible || btnSaveDvdPfi.Visible || btnSaveDvdDmi.Visible || btnSaveDvdCmi.Visible || btnSaveHdDvdCmi.Visible || btnSaveDvdBca.Visible || btnSaveDvdAacs.Visible; if (this.scsiInfo.XgdInfo != null) { stkXboxInformation.Visible = true; txtXboxL0Video.Text = $"{this.scsiInfo.XgdInfo.L0Video} sectors"; txtXboxL1Video.Text = $"{this.scsiInfo.XgdInfo.L1Video} sectors"; txtXboxMiddleZone.Text = $"{this.scsiInfo.XgdInfo.MiddleZone} sectors"; txtXboxGameSize.Text = $"{this.scsiInfo.XgdInfo.GameSize} sectors"; txtXboxTotalSize.Text = $"{this.scsiInfo.XgdInfo.TotalSize} sectors"; txtXboxRealBreak.Text = this.scsiInfo.XgdInfo.LayerBreak.ToString(); } if (this.scsiInfo.DvdDmi != null) { if (DMI.IsXbox(scsiInfo.DvdDmi)) { grpXboxDmi.Visible = true; txtXboxDmi.Text = DMI.PrettifyXbox(scsiInfo.DvdDmi); } else if (DMI.IsXbox360(scsiInfo.DvdDmi)) { grpXboxDmi.Visible = true; txtXboxDmi.Text = DMI.PrettifyXbox360(scsiInfo.DvdDmi); } } if (this.scsiInfo.DecodedXboxSecuritySector.HasValue) { grpXboxSs.Visible = true; txtXboxSs.Text = SS.Prettify(this.scsiInfo.DecodedXboxSecuritySector); } btnSaveXboxSs.Visible = this.scsiInfo.XboxSecuritySector != null; tabXbox.Visible = stkXboxInformation.Visible || grpXboxDmi.Visible || grpXboxSs.Visible || btnSaveXboxSs.Visible; if (this.scsiInfo.DvdRamDds != null) { grpDvdRamDds.Visible = true; btnSaveDvdRamDds.Visible = true; txtDvdRamDds.Text = DDS.Prettify(this.scsiInfo.DvdRamDds); } if (this.scsiInfo.DvdRamCartridgeStatus != null) { grpDvdRamCartridgeStatus.Visible = true; btnSaveDvdRamCartridgeStatus.Visible = true; txtDvdRamCartridgeStatus.Text = Cartridge.Prettify(this.scsiInfo.DvdRamCartridgeStatus); } if (this.scsiInfo.DvdRamSpareArea != null) { grpDvdRamSpareAreaInformation.Visible = true; btnSaveDvdRamSpareAreaInformation.Visible = true; txtDvdRamSpareAreaInformation.Text = Spare.Prettify(this.scsiInfo.DvdRamSpareArea); } btnSaveDvdRamDds.Visible = this.scsiInfo.DvdRamDds != null; btnSaveDvdRamCartridgeStatus.Visible = this.scsiInfo.DvdRamCartridgeStatus != null; btnSaveDvdRamSpareAreaInformation.Visible = this.scsiInfo.DvdRamSpareArea != null; btnSaveLastBorderOutRmd.Visible = this.scsiInfo.LastBorderOutRmd != null; btnSaveDvdPreRecordedInfo.Visible = this.scsiInfo.DvdPreRecordedInfo != null; btnSaveDvdrMediaIdentifier.Visible = this.scsiInfo.DvdrMediaIdentifier != null; btnSaveDvdrPhysicalInformation.Visible = this.scsiInfo.DvdrPhysicalInformation != null; btnSaveHddvdrMediumStatus.Visible = this.scsiInfo.HddvdrMediumStatus != null; btnSaveHddvdrLastRmd.Visible = this.scsiInfo.HddvdrLastRmd != null; btnSaveDvdrLayerCapacity.Visible = this.scsiInfo.DvdrLayerCapacity != null; btnSaveDvdrDlMiddleZoneStart.Visible = this.scsiInfo.DvdrDlMiddleZoneStart != null; btnSaveDvdrDlJumpIntervalSize.Visible = this.scsiInfo.DvdrDlJumpIntervalSize != null; btnSaveDvdrDlManualLayerJumpStartLba.Visible = this.scsiInfo.DvdrDlManualLayerJumpStartLba != null; btnSaveDvdrDlRemapAnchorPoint.Visible = this.scsiInfo.DvdrDlRemapAnchorPoint != null; btnSaveDvdPlusAdip.Visible = this.scsiInfo.DvdPlusAdip != null; btnSaveDvdPlusDcb.Visible = this.scsiInfo.DvdPlusDcb != null; tabDvdr.Visible = grpDvdRamDds.Visible || grpDvdRamCartridgeStatus.Visible || grpDvdRamSpareAreaInformation.Visible || btnSaveDvdRamDds.Visible || btnSaveDvdRamCartridgeStatus.Visible || btnSaveDvdRamSpareAreaInformation.Visible || btnSaveLastBorderOutRmd.Visible || btnSaveDvdPreRecordedInfo.Visible || btnSaveDvdrMediaIdentifier.Visible || btnSaveDvdrPhysicalInformation.Visible || btnSaveHddvdrMediumStatus.Visible || btnSaveHddvdrLastRmd.Visible || btnSaveDvdrLayerCapacity.Visible || btnSaveDvdrDlMiddleZoneStart.Visible || btnSaveDvdrDlJumpIntervalSize.Visible || btnSaveDvdrDlManualLayerJumpStartLba.Visible || btnSaveDvdrDlRemapAnchorPoint.Visible || btnSaveDvdPlusAdip.Visible || btnSaveDvdPlusDcb.Visible; if (this.scsiInfo.BlurayDiscInformation != null) { grpBlurayDiscInformation.Visible = true; btnSaveBlurayDiscInformation.Visible = true; txtBlurayDiscInformation.Text = DI.Prettify(this.scsiInfo.BlurayDiscInformation); } if (this.scsiInfo.BlurayBurstCuttingArea != null) { grpBlurayBurstCuttingArea.Visible = true; btnSaveBlurayBurstCuttingArea.Visible = true; txtBlurayBurstCuttingArea.Text = BCA.Prettify(this.scsiInfo.BlurayBurstCuttingArea); } if (this.scsiInfo.BlurayDds != null) { grpBlurayDds.Visible = true; btnSaveBlurayDds.Visible = true; txtBlurayDds.Text = Decoders.Bluray.DDS.Prettify(this.scsiInfo.BlurayDds); } if (this.scsiInfo.BlurayCartridgeStatus != null) { grpBlurayCartridgeStatus.Visible = true; btnSaveBlurayCartridgeStatus.Visible = true; txtBlurayCartridgeStatus.Text = Decoders.Bluray.Cartridge.Prettify(this.scsiInfo.BlurayCartridgeStatus); } if (this.scsiInfo.BluraySpareAreaInformation != null) { grpBluraySpareAreaInformation.Visible = true; btnSaveBluraySpareAreaInformation.Visible = true; txtBluraySpareAreaInformation.Text = Decoders.Bluray.Spare.Prettify(this.scsiInfo.BluraySpareAreaInformation); } if (this.scsiInfo.BlurayPowResources != null) { grpBlurayPowResources.Visible = true; btnSaveBlurayPowResources.Visible = true; txtBlurayPowResources.Text = DiscInformation.Prettify(this.scsiInfo.BlurayPowResources); } if (this.scsiInfo.BlurayTrackResources != null) { grpBlurayTrackResources.Visible = true; btnSaveBlurayTrackResources.Visible = true; txtBlurayTrackResources.Text = DiscInformation.Prettify(this.scsiInfo.BlurayTrackResources); } btnSaveBlurayRawDfl.Visible = this.scsiInfo.BlurayRawDfl != null; btnSaveBlurayPac.Visible = this.scsiInfo.BlurayPac != null; tabBluray.Visible = grpBlurayDiscInformation.Visible || grpBlurayBurstCuttingArea.Visible || grpBlurayDds.Visible || grpBlurayCartridgeStatus.Visible || grpBluraySpareAreaInformation.Visible || grpBlurayPowResources.Visible || grpBlurayTrackResources.Visible || btnSaveBlurayRawDfl.Visible || btnSaveBlurayPac.Visible; }
public pnlImageInfo(string imagePath, IFilter filter, IMediaImage imageFormat) { this.imagePath = imagePath; this.filter = filter; this.imageFormat = imageFormat; XamlReader.Load(this); Stream logo = ResourceHandler .GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{imageFormat.Info.MediaType}.svg"); /* if(logo != null) * { * svgMediaLogo.SvgStream = logo; * svgMediaLogo.Visible = true; * } * else * {*/ logo = ResourceHandler .GetResourceStream($"DiscImageChef.Gui.Assets.Logos.Media.{imageFormat.Info.MediaType}.png"); if (logo != null) { imgMediaLogo.Image = new Bitmap(logo); imgMediaLogo.Visible = true; } //} lblImagePath.Text = $"Path: {imagePath}"; lblFilter.Text = $"Filter: {filter.Name}"; lblImageFormat.Text = $"Image format identified by {imageFormat.Name} ({imageFormat.Id})."; lblImageFormat.Text = !string.IsNullOrWhiteSpace(imageFormat.Info.Version) ? $"Format: {imageFormat.Format} version {imageFormat.Info.Version}" : $"Format: {imageFormat.Format}"; lblImageSize.Text = $"Image without headers is {imageFormat.Info.ImageSize} bytes long"; lblSectors.Text = $"Contains a media of {imageFormat.Info.Sectors} sectors with a maximum sector size of {imageFormat.Info.SectorSize} bytes (if all sectors are of the same size this would be {imageFormat.Info.Sectors * imageFormat.Info.SectorSize} bytes)"; lblMediaType.Text = $"Contains a media of type {imageFormat.Info.MediaType} and XML type {imageFormat.Info.XmlMediaType}"; lblHasPartitions.Text = $"{(imageFormat.Info.HasPartitions ? "Has" : "Doesn't have")} partitions"; lblHasSessions.Text = $"{(imageFormat.Info.HasSessions ? "Has" : "Doesn't have")} sessions"; if (!string.IsNullOrWhiteSpace(imageFormat.Info.Application)) { lblApplication.Visible = true; lblApplication.Text = !string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion) ? $"Was created with {imageFormat.Info.Application} version {imageFormat.Info.ApplicationVersion}" : $"Was created with {imageFormat.Info.Application}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.Creator)) { lblCreator.Visible = true; lblCreator.Text = $"Created by: {imageFormat.Info.Creator}"; } if (imageFormat.Info.CreationTime != DateTime.MinValue) { lblCreationTime.Visible = true; lblCreationTime.Text = $"Created on {imageFormat.Info.CreationTime}"; } if (imageFormat.Info.LastModificationTime != DateTime.MinValue) { lblLastModificationTime.Visible = true; lblLastModificationTime.Text = $"Last modified on {imageFormat.Info.LastModificationTime}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.Comments)) { grpComments.Visible = true; txtComments.Text = imageFormat.Info.Comments; } if (imageFormat.Info.MediaSequence != 0 && imageFormat.Info.LastMediaSequence != 0) { lblMediaSequence.Visible = true; lblMediaSequence.Text = $"Media is number {imageFormat.Info.MediaSequence} on a set of {imageFormat.Info.LastMediaSequence} medias"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle)) { lblMediaTitle.Visible = true; lblMediaTitle.Text = $"Media title: {imageFormat.Info.MediaTitle}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer)) { lblMediaManufacturer.Visible = true; lblMediaManufacturer.Text = $"Media manufacturer: {imageFormat.Info.MediaManufacturer}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel)) { lblMediaModel.Visible = true; lblMediaModel.Text = $"Media model: {imageFormat.Info.MediaModel}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber)) { lblMediaSerialNumber.Visible = true; lblMediaSerialNumber.Text = $"Media serial number: {imageFormat.Info.MediaSerialNumber}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaBarcode)) { lblMediaBarcode.Visible = true; lblMediaBarcode.Text = $"Media barcode: {imageFormat.Info.MediaBarcode}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaPartNumber)) { lblMediaPartNumber.Visible = true; lblMediaPartNumber.Text = $"Media part number: {imageFormat.Info.MediaPartNumber}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveManufacturer)) { lblDriveManufacturer.Visible = true; lblDriveManufacturer.Text = $"Drive manufacturer: {imageFormat.Info.DriveManufacturer}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveModel)) { lblDriveModel.Visible = true; lblDriveModel.Text = $"Drive model: {imageFormat.Info.DriveModel}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber)) { lblDriveSerialNumber.Visible = true; lblDriveSerialNumber.Text = $"Drive serial number: {imageFormat.Info.DriveSerialNumber}"; } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision)) { lblDriveFirmwareRevision.Visible = true; lblDriveFirmwareRevision.Text = $"Drive firmware info: {imageFormat.Info.DriveFirmwareRevision}"; } if (imageFormat.Info.Cylinders > 0 && imageFormat.Info.Heads > 0 && imageFormat.Info.SectorsPerTrack > 0 && imageFormat.Info.XmlMediaType != XmlMediaType.OpticalDisc && (!(imageFormat is ITapeImage tapeImage) || !tapeImage.IsTape)) { lblMediaGeometry.Visible = true; lblMediaGeometry.Text = $"Media geometry: {imageFormat.Info.Cylinders} cylinders, {imageFormat.Info.Heads} heads, {imageFormat.Info.SectorsPerTrack} sectors per track"; } grpMediaInfo.Visible = lblMediaSequence.Visible || lblMediaTitle.Visible || lblMediaManufacturer.Visible || lblMediaModel.Visible || lblMediaSerialNumber.Visible || lblMediaBarcode.Visible || lblMediaPartNumber.Visible; grpDriveInfo.Visible = lblDriveManufacturer.Visible || lblDriveModel.Visible || lblDriveSerialNumber.Visible || lblDriveFirmwareRevision.Visible || lblMediaGeometry.Visible; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Count > 0) { TreeGridItemCollection mediaTagList = new TreeGridItemCollection(); treeMediaTags.Columns.Add(new GridColumn { HeaderText = "Tag", DataCell = new TextBoxCell(0) }); treeMediaTags.AllowMultipleSelection = false; treeMediaTags.ShowHeader = false; treeMediaTags.DataStore = mediaTagList; foreach (MediaTagType tag in imageFormat.Info.ReadableMediaTags.OrderBy(t => t)) { mediaTagList.Add(new TreeGridItem { Values = new object[] { tag.ToString() } }); } grpMediaTags.Visible = true; } if (imageFormat.Info.ReadableSectorTags != null && imageFormat.Info.ReadableSectorTags.Count > 0) { TreeGridItemCollection sectorTagList = new TreeGridItemCollection(); treeSectorTags.Columns.Add(new GridColumn { HeaderText = "Tag", DataCell = new TextBoxCell(0) }); treeSectorTags.AllowMultipleSelection = false; treeSectorTags.ShowHeader = false; treeSectorTags.DataStore = sectorTagList; foreach (SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t)) { sectorTagList.Add(new TreeGridItem { Values = new object[] { tag.ToString() } }); } grpSectorTags.Visible = true; } PeripheralDeviceTypes scsiDeviceType = PeripheralDeviceTypes.DirectAccess; byte[] scsiInquiryData = null; Inquiry.SCSIInquiry?scsiInquiry = null; Modes.DecodedMode? scsiMode = null; byte[] scsiModeSense6 = null; byte[] scsiModeSense10 = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_INQUIRY)) { scsiInquiryData = imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); scsiDeviceType = (PeripheralDeviceTypes)(scsiInquiryData[0] & 0x1F); scsiInquiry = Inquiry.Decode(scsiInquiryData); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_6)) { scsiModeSense6 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6); scsiMode = Modes.DecodeMode6(scsiModeSense6, scsiDeviceType); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_10)) { scsiModeSense10 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10); scsiMode = Modes.DecodeMode10(scsiModeSense10, scsiDeviceType); } tabScsiInfo tabScsiInfo = new tabScsiInfo(); tabScsiInfo.LoadData(scsiInquiryData, scsiInquiry, null, scsiMode, scsiDeviceType, scsiModeSense6, scsiModeSense10, null); tabInfos.Pages.Add(tabScsiInfo); byte[] ataIdentify = null; byte[] atapiIdentify = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) { ataIdentify = imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATAPI_IDENTIFY)) { atapiIdentify = imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); } tabAtaInfo tabAtaInfo = new tabAtaInfo(); tabAtaInfo.LoadData(ataIdentify, atapiIdentify, null); tabInfos.Pages.Add(tabAtaInfo); byte[] toc = null; TOC.CDTOC? decodedToc = null; byte[] fullToc = null; FullTOC.CDFullTOC? decodedFullToc = null; byte[] pma = null; byte[] atip = null; ATIP.CDATIP? decodedAtip = null; byte[] cdtext = null; CDTextOnLeadIn.CDText?decodedCdText = null; string mediaCatalogueNumber = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TOC)) { toc = imageFormat.ReadDiskTag(MediaTagType.CD_TOC); if (toc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0)); if (dataLen + 2 != toc.Length) { byte[] tmp = new byte[toc.Length + 2]; Array.Copy(toc, 0, tmp, 2, toc.Length); tmp[0] = (byte)((toc.Length & 0xFF00) >> 8); tmp[1] = (byte)(toc.Length & 0xFF); toc = tmp; } decodedToc = TOC.Decode(toc); } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_FullTOC)) { fullToc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC); if (fullToc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(fullToc, 0)); if (dataLen + 2 != fullToc.Length) { byte[] tmp = new byte[fullToc.Length + 2]; Array.Copy(fullToc, 0, tmp, 2, fullToc.Length); tmp[0] = (byte)((fullToc.Length & 0xFF00) >> 8); tmp[1] = (byte)(fullToc.Length & 0xFF); fullToc = tmp; } decodedFullToc = FullTOC.Decode(fullToc); } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA)) { pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA); if (pma.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0)); if (dataLen + 2 != pma.Length) { byte[] tmp = new byte[pma.Length + 2]; Array.Copy(pma, 0, tmp, 2, pma.Length); tmp[0] = (byte)((pma.Length & 0xFF00) >> 8); tmp[1] = (byte)(pma.Length & 0xFF); pma = tmp; } } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP)) { atip = imageFormat.ReadDiskTag(MediaTagType.CD_ATIP); uint dataLen = Swapping.Swap(BitConverter.ToUInt32(atip, 0)); if (dataLen + 4 != atip.Length) { byte[] tmp = new byte[atip.Length + 4]; Array.Copy(atip, 0, tmp, 4, atip.Length); tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24); tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16); tmp[2] = (byte)((atip.Length & 0xFF00) >> 8); tmp[3] = (byte)(atip.Length & 0xFF); atip = tmp; } decodedAtip = ATIP.Decode(atip); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TEXT)) { cdtext = imageFormat.ReadDiskTag(MediaTagType.CD_TEXT); uint dataLen = Swapping.Swap(BitConverter.ToUInt32(cdtext, 0)); if (dataLen + 4 != cdtext.Length) { byte[] tmp = new byte[cdtext.Length + 4]; Array.Copy(cdtext, 0, tmp, 4, cdtext.Length); tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24); tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16); tmp[2] = (byte)((cdtext.Length & 0xFF00) >> 8); tmp[3] = (byte)(cdtext.Length & 0xFF); cdtext = tmp; } decodedCdText = CDTextOnLeadIn.Decode(cdtext); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_MCN)) { byte[] mcn = imageFormat.ReadDiskTag(MediaTagType.CD_MCN); mediaCatalogueNumber = Encoding.UTF8.GetString(mcn); } tabCompactDiscInfo tabCompactDiscInfo = new tabCompactDiscInfo(); tabCompactDiscInfo.LoadData(toc, atip, null, null, fullToc, pma, cdtext, decodedToc, decodedAtip, null, decodedFullToc, decodedCdText, null, mediaCatalogueNumber, null); tabInfos.Pages.Add(tabCompactDiscInfo); byte[] dvdPfi = null; byte[] dvdDmi = null; byte[] dvdCmi = null; byte[] hddvdCopyrightInformation = null; byte[] dvdBca = null; PFI.PhysicalFormatInformation?decodedPfi = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_PFI)) { dvdPfi = imageFormat.ReadDiskTag(MediaTagType.DVD_PFI); decodedPfi = PFI.Decode(dvdPfi); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_DMI)) { dvdDmi = imageFormat.ReadDiskTag(MediaTagType.DVD_DMI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_CMI)) { dvdCmi = imageFormat.ReadDiskTag(MediaTagType.DVD_CMI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.HDDVD_CPI)) { hddvdCopyrightInformation = imageFormat.ReadDiskTag(MediaTagType.HDDVD_CPI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_BCA)) { dvdBca = imageFormat.ReadDiskTag(MediaTagType.DVD_BCA); } tabDvdInfo tabDvdInfo = new tabDvdInfo(); tabDvdInfo.LoadData(imageFormat.Info.MediaType, dvdPfi, dvdDmi, dvdCmi, hddvdCopyrightInformation, dvdBca, null, decodedPfi); tabInfos.Pages.Add(tabDvdInfo); byte[] dvdRamDds = null; byte[] dvdRamCartridgeStatus = null; byte[] dvdRamSpareArea = null; byte[] lastBorderOutRmd = null; byte[] dvdPreRecordedInfo = null; byte[] dvdrMediaIdentifier = null; byte[] dvdrPhysicalInformation = null; byte[] hddvdrMediumStatus = null; byte[] dvdrLayerCapacity = null; byte[] dvdrDlMiddleZoneStart = null; byte[] dvdrDlJumpIntervalSize = null; byte[] dvdrDlManualLayerJumpStartLba = null; byte[] dvdPlusAdip = null; byte[] dvdPlusDcb = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_DDS)) { dvdRamDds = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_DDS); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_MediumStatus)) { dvdRamCartridgeStatus = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_MediumStatus); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_SpareArea)) { dvdRamSpareArea = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_SpareArea); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_RMD)) { lastBorderOutRmd = imageFormat.ReadDiskTag(MediaTagType.DVDR_RMD); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PreRecordedInfo)) { dvdPreRecordedInfo = imageFormat.ReadDiskTag(MediaTagType.DVDR_PreRecordedInfo); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_MediaIdentifier)) { dvdrMediaIdentifier = imageFormat.ReadDiskTag(MediaTagType.DVDR_MediaIdentifier); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PFI)) { dvdrPhysicalInformation = imageFormat.ReadDiskTag(MediaTagType.DVDR_PFI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.HDDVD_MediumStatus)) { hddvdrMediumStatus = imageFormat.ReadDiskTag(MediaTagType.HDDVD_MediumStatus); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_LayerCapacity)) { dvdrLayerCapacity = imageFormat.ReadDiskTag(MediaTagType.DVDDL_LayerCapacity); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_MiddleZoneAddress)) { dvdrDlMiddleZoneStart = imageFormat.ReadDiskTag(MediaTagType.DVDDL_MiddleZoneAddress); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_JumpIntervalSize)) { dvdrDlJumpIntervalSize = imageFormat.ReadDiskTag(MediaTagType.DVDDL_JumpIntervalSize); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_ManualLayerJumpLBA)) { dvdrDlManualLayerJumpStartLba = imageFormat.ReadDiskTag(MediaTagType.DVDDL_ManualLayerJumpLBA); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_ADIP)) { dvdPlusAdip = imageFormat.ReadDiskTag(MediaTagType.DVD_ADIP); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DCB)) { dvdPlusDcb = imageFormat.ReadDiskTag(MediaTagType.DCB); } tabDvdWritableInfo tabDvdWritableInfo = new tabDvdWritableInfo(); tabDvdWritableInfo.LoadData(imageFormat.Info.MediaType, dvdRamDds, dvdRamCartridgeStatus, dvdRamSpareArea, lastBorderOutRmd, dvdPreRecordedInfo, dvdrMediaIdentifier, dvdrPhysicalInformation, hddvdrMediumStatus, null, dvdrLayerCapacity, dvdrDlMiddleZoneStart, dvdrDlJumpIntervalSize, dvdrDlManualLayerJumpStartLba, null, dvdPlusAdip, dvdPlusDcb); tabInfos.Pages.Add(tabDvdWritableInfo); byte[] blurayBurstCuttingArea = null; byte[] blurayCartridgeStatus = null; byte[] blurayDds = null; byte[] blurayDiscInformation = null; byte[] blurayPowResources = null; byte[] bluraySpareAreaInformation = null; byte[] blurayTrackResources = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_BCA)) { blurayBurstCuttingArea = imageFormat.ReadDiskTag(MediaTagType.BD_BCA); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_CartridgeStatus)) { blurayCartridgeStatus = imageFormat.ReadDiskTag(MediaTagType.BD_CartridgeStatus); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DDS)) { blurayDds = imageFormat.ReadDiskTag(MediaTagType.BD_DDS); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DI)) { blurayDiscInformation = imageFormat.ReadDiskTag(MediaTagType.BD_DI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_POWResourcesInformation)) { blurayPowResources = imageFormat.ReadDiskTag(MediaTagType.MMC_POWResourcesInformation); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_SpareArea)) { bluraySpareAreaInformation = imageFormat.ReadDiskTag(MediaTagType.BD_SpareArea); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_TrackResourcesInformation)) { bluraySpareAreaInformation = imageFormat.ReadDiskTag(MediaTagType.MMC_TrackResourcesInformation); } tabBlurayInfo tabBlurayInfo = new tabBlurayInfo(); tabBlurayInfo.LoadData(blurayDiscInformation, blurayBurstCuttingArea, blurayDds, blurayCartridgeStatus, bluraySpareAreaInformation, blurayPowResources, blurayTrackResources, null, null); tabInfos.Pages.Add(tabBlurayInfo); byte[] xboxDmi = null; byte[] xboxSecuritySector = null; SS.SecuritySector?decodedXboxSecuritySector = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_DMI)) { xboxDmi = imageFormat.ReadDiskTag(MediaTagType.Xbox_DMI); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_SecuritySector)) { xboxSecuritySector = imageFormat.ReadDiskTag(MediaTagType.Xbox_SecuritySector); decodedXboxSecuritySector = SS.Decode(xboxSecuritySector); } tabXboxInfo tabXboxInfo = new tabXboxInfo(); tabXboxInfo.LoadData(null, xboxDmi, xboxSecuritySector, decodedXboxSecuritySector); tabInfos.Pages.Add(tabXboxInfo); byte[] pcmciaCis = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) { pcmciaCis = imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS); } tabPcmciaInfo tabPcmciaInfo = new tabPcmciaInfo(); tabPcmciaInfo.LoadData(pcmciaCis); tabInfos.Pages.Add(tabPcmciaInfo); DeviceType deviceType = DeviceType.Unknown; byte[] cid = null; byte[] csd = null; byte[] ocr = null; byte[] extendedCsd = null; byte[] scr = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CID)) { cid = imageFormat.ReadDiskTag(MediaTagType.SD_CID); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CSD)) { csd = imageFormat.ReadDiskTag(MediaTagType.SD_CSD); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_OCR)) { ocr = imageFormat.ReadDiskTag(MediaTagType.SD_OCR); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_SCR)) { scr = imageFormat.ReadDiskTag(MediaTagType.SD_SCR); deviceType = DeviceType.SecureDigital; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CID)) { cid = imageFormat.ReadDiskTag(MediaTagType.MMC_CID); deviceType = DeviceType.MMC; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CSD)) { csd = imageFormat.ReadDiskTag(MediaTagType.MMC_CSD); deviceType = DeviceType.MMC; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_OCR)) { ocr = imageFormat.ReadDiskTag(MediaTagType.MMC_OCR); deviceType = DeviceType.MMC; } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_ExtendedCSD)) { extendedCsd = imageFormat.ReadDiskTag(MediaTagType.MMC_ExtendedCSD); deviceType = DeviceType.MMC; } tabSdMmcInfo tabSdMmcInfo = new tabSdMmcInfo(); tabSdMmcInfo.LoadData(deviceType, cid, csd, ocr, extendedCsd, scr); tabInfos.Pages.Add(tabSdMmcInfo); if (imageFormat is IOpticalMediaImage opticalMediaImage) { try { if (opticalMediaImage.Sessions != null && opticalMediaImage.Sessions.Count > 0) { TreeGridItemCollection sessionList = new TreeGridItemCollection(); treeSessions.Columns.Add(new GridColumn { HeaderText = "Session", DataCell = new TextBoxCell(0) }); treeSessions.Columns.Add(new GridColumn { HeaderText = "First track", DataCell = new TextBoxCell(1) }); treeSessions.Columns.Add(new GridColumn { HeaderText = "Last track", DataCell = new TextBoxCell(2) }); treeSessions.Columns.Add(new GridColumn { HeaderText = "Start", DataCell = new TextBoxCell(3) }); treeSessions.Columns.Add(new GridColumn { HeaderText = "End", DataCell = new TextBoxCell(4) }); treeSessions.AllowMultipleSelection = false; treeSessions.ShowHeader = true; treeSessions.DataStore = sessionList; foreach (Session session in opticalMediaImage.Sessions) { sessionList.Add(new TreeGridItem { Values = new object[] { session.SessionSequence, session.StartTrack, session.EndTrack, session.StartSector, session.EndSector } }); } tabSessions.Visible = true; } } catch { // ignored } try { if (opticalMediaImage.Tracks != null && opticalMediaImage.Tracks.Count > 0) { TreeGridItemCollection tracksList = new TreeGridItemCollection(); treeTracks.Columns.Add(new GridColumn { HeaderText = "Track", DataCell = new TextBoxCell(0) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Type", DataCell = new TextBoxCell(1) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Bps", DataCell = new TextBoxCell(2) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Raw bps", DataCell = new TextBoxCell(3) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Subchannel", DataCell = new TextBoxCell(4) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Pregap", DataCell = new TextBoxCell(5) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "Start", DataCell = new TextBoxCell(6) }); treeTracks.Columns.Add(new GridColumn { HeaderText = "End", DataCell = new TextBoxCell(7) }); treeTracks.AllowMultipleSelection = false; treeTracks.ShowHeader = true; treeTracks.DataStore = tracksList; foreach (Track track in opticalMediaImage.Tracks) { tracksList.Add(new TreeGridItem { Values = new object[] { track.TrackSequence, track.TrackType, track.TrackBytesPerSector, track.TrackRawBytesPerSector, track.TrackSubchannelType, track.TrackPregap, track.TrackStartSector, track.TrackEndSector } }); } tabTracks.Visible = true; } } catch { // ignored } } if (imageFormat.DumpHardware == null) { return; } TreeGridItemCollection dumpHardwareList = new TreeGridItemCollection(); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Manufacturer", DataCell = new TextBoxCell(0) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Model", DataCell = new TextBoxCell(1) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Serial", DataCell = new TextBoxCell(2) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Software", DataCell = new TextBoxCell(3) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Version", DataCell = new TextBoxCell(4) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Operating system", DataCell = new TextBoxCell(5) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "Start", DataCell = new TextBoxCell(6) }); treeDumpHardware.Columns.Add(new GridColumn { HeaderText = "End", DataCell = new TextBoxCell(7) }); treeDumpHardware.AllowMultipleSelection = false; treeDumpHardware.ShowHeader = true; treeDumpHardware.DataStore = dumpHardwareList; foreach (DumpHardwareType dump in imageFormat.DumpHardware) { foreach (ExtentType extent in dump.Extents) { dumpHardwareList.Add(new TreeGridItem { Values = new object[] { dump.Manufacturer, dump.Model, dump.Serial, dump.Software.Name, dump.Software.Version, dump.Software.OperatingSystem, extent.Start, extent.End } }); } } tabDumpHardware.Visible = true; }
private TreeGridItemCollection GetTree(Story story) { TreeGridItemCollection data = new TreeGridItemCollection(); foreach (Comment comment in story.Comments) { TreeGridItem tgi = GetCommentTree(comment); if(tgi.Tag != "empty") { data.Add(tgi); } } return data; }
private TreeGridItemCollection GetTree(List<FullStory> stories) { TreeGridItemCollection data = new TreeGridItemCollection(); foreach (FullStory story in stories) { TreeGridItem tgiParent = new TreeGridItem() { Values = new object[] { WebUtility.HtmlDecode(story.title) } }; string all5 = string.Empty; foreach (string s in story.GetTopNWords(5)) { all5 += s + " "; } tgiParent.Children.Add(new TreeGridItem() { Values = new object[] { WebUtility.HtmlDecode(all5) } }); data.Add(tgiParent); foreach (children child in story.children) { TreeGridItem tgi = GetCommentTree(child); if (tgi.Tag != "empty") { tgiParent.Children.Add(tgi); } } } return data; }
void Finish() { stkOptions.Visible = false; btnClose.Visible = true; stkProgress.Visible = false; stkResults.Visible = true; if (chkSeparatedTracks.Checked == true) { TreeGridItemCollection entropyList = new TreeGridItemCollection(); treeTrackEntropy.Columns.Add(new GridColumn { HeaderText = "Track", DataCell = new TextBoxCell(0) }); treeTrackEntropy.Columns.Add(new GridColumn { HeaderText = "Entropy", DataCell = new TextBoxCell(1) }); if (chkDuplicatedSectors.Checked == true) { treeTrackEntropy.Columns.Add(new GridColumn { HeaderText = "Unique sectors", DataCell = new TextBoxCell(2) }); } treeTrackEntropy.AllowMultipleSelection = false; treeTrackEntropy.ShowHeader = true; treeTrackEntropy.DataStore = entropyList; foreach (EntropyResults trackEntropy in tracksEntropy) { entropyList.Add(new TreeGridItem { Values = new object[] { trackEntropy.Track, trackEntropy.Entropy, $"{trackEntropy.UniqueSectors} ({(double)trackEntropy.UniqueSectors / (double)trackEntropy.Sectors:P3})" } }); } grpTrackEntropy.Visible = true; } if (chkWholeDisc.Checked != true) { return; } lblMediaEntropy.Text = $"Entropy for disk is {entropy.Entropy:F4}."; lblMediaEntropy.Visible = true; if (entropy.UniqueSectors == null) { return; } lblMediaUniqueSectors.Text = $"Disk has {entropy.UniqueSectors} unique sectors ({(double)entropy.UniqueSectors / (double)entropy.Sectors:P3})"; lblMediaUniqueSectors.Visible = true; }
void DoWork() { IOpticalMediaImage opticalMediaImage = inputFormat as IOpticalMediaImage; bool formatHasTracks = false; if (opticalMediaImage != null) { try { formatHasTracks = opticalMediaImage.Tracks?.Count > 0; } catch { formatHasTracks = false; } } // Setup progress bars Application.Instance.Invoke(() => { stkProgress.Visible = true; prgProgress.MaxValue = 1; prgProgress2.MaxValue = (int)(inputFormat.Info.Sectors / SECTORS_TO_READ); if (formatHasTracks && chkChecksumTracks.Checked == true && opticalMediaImage != null) { prgProgress.MaxValue += opticalMediaImage.Tracks.Count; } else { prgProgress.MaxValue = 2; prgProgress2.Visible = false; lblProgress2.Visible = false; } }); EnableChecksum enabledChecksums = new EnableChecksum(); if (chkAdler32.Checked == true) { enabledChecksums |= EnableChecksum.Adler32; } if (chkCrc16.Checked == true) { enabledChecksums |= EnableChecksum.Crc16; } if (chkCrc32.Checked == true) { enabledChecksums |= EnableChecksum.Crc32; } if (chkCrc64.Checked == true) { enabledChecksums |= EnableChecksum.Crc64; } if (chkMd5.Checked == true) { enabledChecksums |= EnableChecksum.Md5; } if (chkSha1.Checked == true) { enabledChecksums |= EnableChecksum.Sha1; } if (chkSha256.Checked == true) { enabledChecksums |= EnableChecksum.Sha256; } if (chkSha384.Checked == true) { enabledChecksums |= EnableChecksum.Sha384; } if (chkSha512.Checked == true) { enabledChecksums |= EnableChecksum.Sha512; } if (chkSpamsum.Checked == true) { enabledChecksums |= EnableChecksum.SpamSum; } if (chkFletcher16.Checked == true) { enabledChecksums |= EnableChecksum.Fletcher16; } if (chkFletcher32.Checked == true) { enabledChecksums |= EnableChecksum.Fletcher32; } Checksum mediaChecksum = null; TreeGridItemCollection trackHashes = new TreeGridItemCollection(); TreeGridItemCollection mediaHashes = new TreeGridItemCollection(); if (opticalMediaImage != null) { try { Checksum trackChecksum = null; if (chkChecksumMedia.Checked == true) { mediaChecksum = new Checksum(enabledChecksums); } ulong previousTrackEnd = 0; foreach (Track currentTrack in opticalMediaImage.Tracks) { Application.Instance.Invoke(() => { lblProgress.Text = $"Hashing track {currentTrack.TrackSequence} of {opticalMediaImage.Tracks.Count}"; prgProgress.Value++; }); if (currentTrack.TrackStartSector - previousTrackEnd != 0 && chkChecksumMedia.Checked == true) { for (ulong i = previousTrackEnd + 1; i < currentTrack.TrackStartSector; i++) { ulong sector = i; Application.Instance.Invoke(() => { prgProgress2.Value = (int)(sector / SECTORS_TO_READ); lblProgress2.Text = $"Hashing track-less sector {sector}"; }); byte[] hiddenSector = opticalMediaImage.ReadSector(i); mediaChecksum?.Update(hiddenSector); } } DicConsole.DebugWriteLine("Checksum command", "Track {0} starts at sector {1} and ends at sector {2}", currentTrack.TrackSequence, currentTrack.TrackStartSector, currentTrack.TrackEndSector); if (chkChecksumTracks.Checked == true) { trackChecksum = new Checksum(enabledChecksums); } ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1; ulong doneSectors = 0; while (doneSectors < sectors) { if (cancel) { Application.Instance.Invoke(() => { btnClose.Visible = true; btnStart.Visible = false; btnStop.Visible = false; }); return; } byte[] sector; if (sectors - doneSectors >= SECTORS_TO_READ) { sector = opticalMediaImage.ReadSectors(doneSectors, SECTORS_TO_READ, currentTrack.TrackSequence); ulong doneSectorsToInvoke = doneSectors; Application.Instance.Invoke(() => { prgProgress2.Value = (int)(doneSectorsToInvoke / SECTORS_TO_READ); lblProgress2.Text = $"Hashings sectors {doneSectorsToInvoke} to {doneSectorsToInvoke + SECTORS_TO_READ} of track {currentTrack.TrackSequence}"; }); doneSectors += SECTORS_TO_READ; } else { sector = opticalMediaImage.ReadSectors(doneSectors, (uint)(sectors - doneSectors), currentTrack.TrackSequence); ulong doneSectorsToInvoke = doneSectors; Application.Instance.Invoke(() => { prgProgress2.Value = (int)(doneSectorsToInvoke / SECTORS_TO_READ); lblProgress2.Text = $"Hashings sectors {doneSectorsToInvoke} to {doneSectorsToInvoke + (sectors - doneSectorsToInvoke)} of track {currentTrack.TrackSequence}"; }); doneSectors += sectors - doneSectors; } if (chkChecksumMedia.Checked == true) { mediaChecksum?.Update(sector); } if (chkChecksumTracks.Checked == true) { trackChecksum?.Update(sector); } } if (chkChecksumTracks.Checked == true) { if (trackChecksum != null) { foreach (ChecksumType chk in trackChecksum.End()) { trackHashes.Add(new TreeGridItem { Values = new object[] { currentTrack.TrackSequence, chk.type, chk.Value } }); } } } previousTrackEnd = currentTrack.TrackEndSector; } if (opticalMediaImage.Info.Sectors - previousTrackEnd != 0 && chkChecksumMedia.Checked == true) { for (ulong i = previousTrackEnd + 1; i < opticalMediaImage.Info.Sectors; i++) { ulong sector = i; Application.Instance.Invoke(() => { prgProgress2.Value = (int)(sector / SECTORS_TO_READ); lblProgress2.Text = $"Hashing track-less sector {sector}"; }); byte[] hiddenSector = opticalMediaImage.ReadSector(i); mediaChecksum?.Update(hiddenSector); } } if (chkChecksumMedia.Checked == true) { if (mediaChecksum != null) { foreach (ChecksumType chk in mediaChecksum.End()) { mediaHashes.Add(new TreeGridItem { Values = new object[] { chk.type, chk.Value } }); } } } } catch (Exception ex) { DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message); DicConsole.WriteLine("Unable to get separate tracks, not checksumming them"); } } else { Application.Instance.Invoke(() => { stkProgress1.Visible = false; }); mediaChecksum = new Checksum(enabledChecksums); ulong doneSectors = 0; while (doneSectors < inputFormat.Info.Sectors) { if (cancel) { Application.Instance.Invoke(() => { btnClose.Visible = true; btnStart.Visible = false; btnStop.Visible = false; }); return; } byte[] sector; if (inputFormat.Info.Sectors - doneSectors >= SECTORS_TO_READ) { sector = inputFormat.ReadSectors(doneSectors, SECTORS_TO_READ); ulong doneSectorsToInvoke = doneSectors; Application.Instance.Invoke(() => { prgProgress2.Value = (int)(doneSectorsToInvoke / SECTORS_TO_READ); lblProgress2.Text = $"Hashings sectors {doneSectorsToInvoke} to {doneSectorsToInvoke + SECTORS_TO_READ}"; }); doneSectors += SECTORS_TO_READ; } else { sector = inputFormat.ReadSectors(doneSectors, (uint)(inputFormat.Info.Sectors - doneSectors)); ulong doneSectorsToInvoke = doneSectors; Application.Instance.Invoke(() => { prgProgress2.Value = (int)(doneSectorsToInvoke / SECTORS_TO_READ); lblProgress2.Text = $"Hashings sectors {doneSectorsToInvoke} to {doneSectorsToInvoke + (inputFormat.Info.Sectors - doneSectorsToInvoke)}"; }); doneSectors += inputFormat.Info.Sectors - doneSectors; } mediaChecksum.Update(sector); } foreach (ChecksumType chk in mediaChecksum.End()) { mediaHashes.Add(new TreeGridItem { Values = new object[] { chk.type, chk.Value } }); } } if (chkChecksumTracks.Checked == true) { Application.Instance.Invoke(() => { grpTrackChecksums.Text = "Track checksums:"; stkTrackChecksums.Visible = true; treeTrackChecksums.Columns.Add(new GridColumn { HeaderText = "Track", DataCell = new TextBoxCell(0) }); treeTrackChecksums.Columns.Add(new GridColumn { HeaderText = "Algorithm", DataCell = new TextBoxCell(1) }); treeTrackChecksums.Columns.Add(new GridColumn { HeaderText = "Hash", DataCell = new TextBoxCell(2) }); treeTrackChecksums.AllowMultipleSelection = false; treeTrackChecksums.ShowHeader = true; treeTrackChecksums.DataStore = trackHashes; }); } if (chkChecksumMedia.Checked == true) { Application.Instance.Invoke(() => { grpMediaChecksums.Text = "Media checksums:"; stkMediaChecksums.Visible = true; treeMediaChecksums.Columns.Add(new GridColumn { HeaderText = "Algorithm", DataCell = new TextBoxCell(0) }); treeMediaChecksums.Columns.Add(new GridColumn { HeaderText = "Hash", DataCell = new TextBoxCell(1) }); treeMediaChecksums.AllowMultipleSelection = false; treeMediaChecksums.ShowHeader = true; treeMediaChecksums.DataStore = mediaHashes; }); } Statistics.AddCommand("checksum"); Application.Instance.Invoke(() => { stkOptions.Visible = false; stkResults.Visible = true; stkProgress.Visible = false; btnStart.Visible = false; btnStop.Visible = false; btnClose.Visible = true; }); }