diff --git a/dlgBlockMedia.xeto b/dlgBlockMedia.xeto new file mode 100644 index 0000000..a5d2d87 --- /dev/null +++ b/dlgBlockMedia.xeto @@ -0,0 +1,617 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sequenced + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Known dimensions + + + Round? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Has ATA IDENTIFY information? + + + + + + + + Is PCI? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Is PCMCIA? + Has CIS? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Is Secure Digital or MMC? + + + + + + + Has CSD? + + + + Has Extended CSD? + + + + + + + + Is SCSI? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Is USB? + + + + + + + + + + + + + + + + + + + + + + + + + + Has MAM? + + + + + + + + Has tracks? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Known dumping hardware + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dlgBlockMedia.xeto.cs b/dlgBlockMedia.xeto.cs new file mode 100644 index 0000000..cb5b7be --- /dev/null +++ b/dlgBlockMedia.xeto.cs @@ -0,0 +1,1770 @@ +// +// Author: +// Natalia Portillo claunia@claunia.com +// +// Copyright (c) 2017, © Claunia.com +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in +// the documentation and/or other materials provided with the distribution. +// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Eto.Forms; +using Eto.Serialization.Xaml; +using Schemas; + +namespace apprepodbmgr.Eto +{ + public class dlgBlockMedia : Dialog + { + // Non-editable fields + ChecksumType[] checksums; + ChecksumType[] contentChks; + DumpHardwareType dumpHwIter; + bool editingDumpHw; + + bool editingPartition; + FileSystemType filesystemIter; + ObservableCollection lstAdditionalInformation; + + ObservableCollection lstAta; + ObservableCollection lstCID; + ObservableCollection lstCSD; + ObservableCollection lstDumpHw; + ObservableCollection lstECSD; + ObservableCollection lstEVPDs; + ObservableCollection lstInquiry; + ObservableCollection lstLogSense; + ObservableCollection lstMAM; + ObservableCollection lstModeSense; + ObservableCollection lstModeSense10; + ObservableCollection lstPartitions; + ObservableCollection lstPCIConfiguration; + ObservableCollection lstPCIOptionROM; + ObservableCollection lstPCMCIACIS; + ObservableCollection lstTracks; + ObservableCollection lstUSBDescriptors; + public BlockMediaType Metadata; + public bool Modified; + + PartitionType partitionIter; + ScansType scans; + TapePartitionType[] tapeInformation; + BlockSizeType[] variableBlockSize; + + public dlgBlockMedia() + { + XamlReader.Load(this); + + Modified = false; + + #region Set partitions table + lstPartitions = new ObservableCollection(); + + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Sequence).Convert(v => v.ToString()) + }, + HeaderText = "Sequence" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.StartSector).Convert(v => v.ToString()) + }, + HeaderText = "Start" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.EndSector).Convert(v => v.ToString()) + }, + HeaderText = "End" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Type)}, + HeaderText = "Type" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Name)}, + HeaderText = "Name" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Description)}, + HeaderText = "Description" + }); + + treePartitions.DataStore = lstPartitions; + + treePartitions.AllowMultipleSelection = false; + #endregion Set partitions table + + #region Set filesystems table + treeFilesystems.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Type)}, + HeaderText = "Type" + }); + treeFilesystems.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.VolumeName)}, + HeaderText = "Name" + }); + + treeFilesystems.AllowMultipleSelection = false; + #endregion Set filesystems table + + #region Set dump hardware table + lstDumpHw = new ObservableCollection(); + + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = + new TextBoxCell {Binding = Binding.Property(r => r.Manufacturer)}, + HeaderText = "Manufacturer" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Model)}, + HeaderText = "Model" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Revision)}, + HeaderText = "Revision" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Firmware)}, + HeaderText = "Firmware" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Serial)}, + HeaderText = "Serial" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Software).Convert(v => v?.Name) + }, + HeaderText = "Software" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Software).Convert(v => v?.Version) + }, + HeaderText = "Version" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Software) + .Convert(v => v?.OperatingSystem) + }, + HeaderText = "Operating system" + }); + + treeDumpHardware.DataStore = lstDumpHw; + + treeDumpHardware.AllowMultipleSelection = false; + + treeExtents.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Start).Convert(v => v.ToString()) + }, + HeaderText = "Start" + }); + treeExtents.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.End).Convert(v => v.ToString()) + }, + HeaderText = "End" + }); + #endregion Set dump hardware table + + #region Set ATA IDENTIFY table + lstAta = new ObservableCollection(); + treeATA.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeATA.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeATA.DataStore = lstAta; + #endregion Set ATA IDENTIFY table + + #region Set PCI configuration table + lstPCIConfiguration = new ObservableCollection(); + treeConfiguration.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeConfiguration.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeConfiguration.DataStore = lstPCIConfiguration; + #endregion Set PCI configuration table + + #region Set PCMCIA CIS table + lstPCMCIACIS = new ObservableCollection(); + treeCIS.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeCIS.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeCIS.DataStore = lstPCMCIACIS; + #endregion Set PCI option ROM table + + #region Set CID table + lstCID = new ObservableCollection(); + treeCID.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeCID.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeCID.DataStore = lstCID; + #endregion Set CID table + + #region Set CSD table + lstCSD = new ObservableCollection(); + treeCSD.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeCSD.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeCSD.DataStore = lstCSD; + #endregion Set CSD table + + #region Set Extended CSD table + lstECSD = new ObservableCollection(); + treeECSD.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeECSD.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeECSD.DataStore = lstECSD; + #endregion Set Extended CSD table + + #region Set SCSI INQUIRY table + lstInquiry = new ObservableCollection(); + treeInquiry.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeInquiry.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeInquiry.DataStore = lstInquiry; + #endregion Set SCSI INQUIRY table + + #region Set SCSI MODE SENSE table + lstModeSense = new ObservableCollection(); + treeModeSense.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeModeSense.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeModeSense.DataStore = lstModeSense; + #endregion Set SCSI MODE SENSE table + + #region Set SCSI MODE SENSE (10) table + lstModeSense10 = new ObservableCollection(); + treeModeSense10.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeModeSense10.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeModeSense10.DataStore = lstModeSense10; + #endregion Set SCSI MODE SENSE (10) table + + #region Set SCSI LOG SENSE table + lstLogSense = new ObservableCollection(); + treeLogSense.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeLogSense.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeLogSense.DataStore = lstLogSense; + #endregion Set SCSI MODE SENSE (10) table + + #region Set SCSI EVPDs table + lstEVPDs = new ObservableCollection(); + + treeEVPDs.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.page).Convert(v => v.ToString()) + }, + HeaderText = "Page" + }); + treeEVPDs.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeEVPDs.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + + treeEVPDs.DataStore = lstEVPDs; + + treeEVPDs.AllowMultipleSelection = false; + #endregion Set SCSI EVPDs table + + #region Set USB descriptors table + lstUSBDescriptors = new ObservableCollection(); + treeDescriptors.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeDescriptors.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeDescriptors.DataStore = lstUSBDescriptors; + #endregion Set USB descriptors table + + #region Set MAM table + lstMAM = new ObservableCollection(); + treeMAM.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeMAM.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeMAM.DataStore = lstMAM; + #endregion Set MAM table + + #region Set Option ROM table + lstPCIOptionROM = new ObservableCollection(); + + treeOptionROM.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image.Value)}, + HeaderText = "File" + }); + treeOptionROM.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Image.offset).Convert(v => v.ToString()) + }, + HeaderText = "Offset" + }); + treeOptionROM.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + + treeOptionROM.DataStore = lstPCIOptionROM; + + treeOptionROM.AllowMultipleSelection = false; + #endregion Set Option ROM table + + #region Set tracks table + lstTracks = new ObservableCollection(); + + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image.Value)}, + HeaderText = "File" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Image.offset).Convert(v => v.ToString()) + }, + HeaderText = "Offset" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image.format)}, + HeaderText = "Image format" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Head).Convert(v => v.ToString()) + }, + HeaderText = "Head" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Cylinder).Convert(v => v.ToString()) + }, + HeaderText = "Cylinder" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.StartSector).Convert(v => v.ToString()) + }, + HeaderText = "Start" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.EndSector).Convert(v => v.ToString()) + }, + HeaderText = "End" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Sectors).Convert(v => v.ToString()) + }, + HeaderText = "Sectors" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.BytesPerSector).Convert(v => v.ToString()) + }, + HeaderText = "Bytes per sector" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Format)}, + HeaderText = "Track format" + }); + + treeTracks.DataStore = lstTracks; + + treeTracks.AllowMultipleSelection = false; + #endregion Set tracks table + + lstAdditionalInformation = new ObservableCollection(); + treeAdditionalInformation.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.str)}, + HeaderText = "Information" + }); + treeAdditionalInformation.DataStore = lstAdditionalInformation; + treeAdditionalInformation.AllowMultipleSelection = false; + + txtImage.ToolTip = "This is the disk image containing this media."; + txtFormat.ToolTip = "This is the format of the disk image."; + txtOffset.ToolTip = "Byte offset where the media dump starts in the disk image."; + txtSize.ToolTip = "Size of the disk dump."; + txtManufacturer.ToolTip = "Disk manufacturer."; + txtModel.ToolTip = "Disk model."; + txtSerial.ToolTip = "Disk serial number."; + txtFirmware.ToolTip = "Disk firmware revision."; + txtInterface.ToolTip = "Disk interface."; + txtCopyProtection.ToolTip = "Disk copy protection."; + txtMediaType.ToolTip = "Disk type."; + txtMediaSubtype.ToolTip = "Disk subtype."; + chkSequence.ToolTip = "If checked means this disk is one in a sequence of several."; + txtMediaTitle.ToolTip = "Title of disk."; + spSequence.ToolTip = "Number of this disk in the sequence."; + spTotalMedia.ToolTip = "How many disks make the sequence."; + spSide.ToolTip = "On flippy disks, which side of the disk is represented by this dump."; + spLayer.ToolTip = "On PTP layered disks, which layer of the side of the disk is represented by this dump."; + txtBlocks.ToolTip = "How many individual blocks (sectors) are in this dump."; + spPhysicalBlockSize.ToolTip = "Size of the biggest physical block in bytes."; + spLogicalBlockSize.ToolTip = "Size of the biggest logical block in bytes."; + spCylinders.ToolTip = "Cylinders of disk."; + spHeads.ToolTip = "Heads of disk."; + spSectors.ToolTip = "Sectors per track of disk."; + chkDimensions.ToolTip = "If checked, physical dimensions of disk are known."; + chkRound.ToolTip = "If checked, disk is physicaly round."; + spDiameter.ToolTip = "Diameter in milimeters of disk."; + spHeight.ToolTip = "Height in milimeters of disk."; + spWidth.ToolTip = "Width in milimeters of disk."; + spThickness.ToolTip = "Thickness in milimeters of disk."; + chkATA.ToolTip = "If checked, disk dump contains ATA(PI) IDENTIFY information."; + } + + public void FillFields() + { + if(Metadata == null) return; + + txtImage.Text = Metadata.Image.Value; + txtFormat.Text = Metadata.Image.format; + if(Metadata.Image.offsetSpecified) txtOffset.Text = Metadata.Image.offset.ToString(); + txtSize.Text = Metadata.Size.ToString(); + checksums = Metadata.Checksums; + contentChks = Metadata.ContentChecksums; + if(Metadata.Sequence != null) + { + lblMediaTitle.Visible = true; + txtMediaTitle.Visible = true; + lblSequence.Visible = true; + spSequence.Visible = true; + lblTotalMedia.Visible = true; + spTotalMedia.Visible = true; + lblSide.Visible = true; + spSide.Visible = true; + lblLayer.Visible = true; + spLayer.Visible = true; + chkSequence.Checked = true; + txtMediaTitle.Text = Metadata.Sequence.MediaTitle; + spSequence.Value = Metadata.Sequence.MediaSequence; + spTotalMedia.Value = Metadata.Sequence.TotalMedia; + if(Metadata.Sequence.SideSpecified) spSide.Value = Metadata.Sequence.Side; + if(Metadata.Sequence.LayerSpecified) spLayer.Value = Metadata.Sequence.Layer; + } + + if(Metadata.Manufacturer != null) txtManufacturer.Text = Metadata.Manufacturer; + if(Metadata.Model != null) txtModel.Text = Metadata.Model; + if(Metadata.Serial != null) txtSerial.Text = Metadata.Serial; + if(Metadata.Firmware != null) txtFirmware.Text = Metadata.Firmware; + if(Metadata.Interface != null) txtInterface.Text = Metadata.Interface; + spPhysicalBlockSize.Value = Metadata.PhysicalBlockSize; + spLogicalBlockSize.Value = Metadata.LogicalBlockSize; + txtBlocks.Text = Metadata.LogicalBlocks.ToString(); + variableBlockSize = Metadata.VariableBlockSize; + tapeInformation = Metadata.TapeInformation; + scans = Metadata.Scans; + if(Metadata.ATA?.Identify != null) + { + chkATA.Checked = true; + treeATA.Visible = true; + lstAta.Add(Metadata.ATA.Identify); + } + + if(Metadata.PCI != null) + { + chkPCI.Checked = true; + lblPCIVendor.Visible = true; + txtPCIVendor.Visible = true; + lblPCIProduct.Visible = true; + txtPCIProduct.Visible = true; + txtPCIVendor.Text = $"0x{Metadata.PCI.VendorID:X4}"; + txtPCIProduct.Text = $"0x{Metadata.PCI.DeviceID:X4}"; + if(Metadata.PCI.Configuration != null) + { + frmPCIConfiguration.Visible = true; + lstPCIConfiguration.Add(Metadata.PCI.Configuration); + } + + if(Metadata.PCI.ExpansionROM != null) + { + frmOptionROM.Visible = true; + lstPCIOptionROM.Add(Metadata.PCI.ExpansionROM); + } + } + + if(Metadata.PCMCIA != null) + { + chkPCMCIA.Checked = true; + chkCIS.Visible = true; + lblPCMCIAManufacturer.Visible = true; + txtPCMCIAManufacturer.Visible = true; + lblMfgCode.Visible = true; + txtMfgCode.Visible = true; + lblPCMCIAProductName.Visible = true; + txtPCMCIAProductName.Visible = true; + lblCardCode.Visible = true; + txtCardCode.Visible = true; + lblCompliance.Visible = true; + txtCompliance.Visible = true; + + if(Metadata.PCMCIA.CIS != null) + { + treeCIS.Visible = true; + lstPCMCIACIS.Add(Metadata.PCMCIA.CIS); + } + + if(Metadata.PCMCIA.Compliance != null) txtCompliance.Text = Metadata.PCMCIA.Compliance; + if(Metadata.PCMCIA.ManufacturerCodeSpecified) + txtMfgCode.Text = + $"0x{Metadata.PCMCIA.ManufacturerCode:X4}"; + if(Metadata.PCMCIA.CardCodeSpecified) + txtCardCode.Text = $"0x{Metadata.PCMCIA.CardCode:X4}"; + if(Metadata.PCMCIA.Manufacturer != null) + txtPCMCIAManufacturer.Text = Metadata.PCMCIA.Manufacturer; + if(Metadata.PCMCIA.ProductName != null) + txtPCMCIAProductName.Text = Metadata.PCMCIA.ProductName; + if(Metadata.PCMCIA.AdditionalInformation != null) + { + lblAdditionalInformation.Visible = true; + treeAdditionalInformation.Visible = true; + + foreach(string addinfo in Metadata.PCMCIA.AdditionalInformation) + lstAdditionalInformation.Add(new StringEntry {str = addinfo}); + } + } + + if(Metadata.SecureDigital?.CID != null) + { + chkSecureDigital.Checked = true; + chkCSD.Visible = true; + chkECSD.Visible = true; + lblCID.Visible = true; + treeCID.Visible = true; + lstCID.Add(Metadata.SecureDigital.CID); + + if(Metadata.SecureDigital.CSD != null) + { + chkCSD.Checked = true; + treeCSD.Visible = true; + lstCSD.Add(Metadata.SecureDigital.CSD); + } + + if(Metadata.MultiMediaCard.ExtendedCSD != null) + { + chkECSD.Checked = true; + treeECSD.Visible = true; + lstECSD.Add(Metadata.MultiMediaCard.ExtendedCSD); + } + } + + if(Metadata.SCSI?.Inquiry != null) + { + chkSCSI.Checked = true; + frmInquiry.Visible = true; + lstInquiry.Add(Metadata.SCSI.Inquiry); + + if(Metadata.SCSI.ModeSense != null) + { + frmModeSense.Visible = true; + lstModeSense.Add(Metadata.SCSI.ModeSense); + } + + if(Metadata.SCSI.ModeSense10 != null) + { + frmModeSense10.Visible = true; + lstModeSense10.Add(Metadata.SCSI.ModeSense10); + } + + if(Metadata.SCSI.LogSense != null) + { + frmLogSense.Visible = true; + lstLogSense.Add(Metadata.SCSI.LogSense); + } + + if(Metadata.SCSI.EVPD != null) + { + frmEVPDs.Visible = true; + lstEVPDs = new ObservableCollection(Metadata.SCSI.EVPD); + treeEVPDs.DataStore = lstEVPDs; // TODO: Really needed? + } + } + + if(Metadata.USB != null) + { + chkUSB.Checked = true; + lblUSBVendor.Visible = true; + txtUSBVendor.Visible = true; + lblUSBProduct.Visible = true; + txtUSBProduct.Visible = true; + txtUSBVendor.Text = $"0x{Metadata.USB.VendorID:X4}"; + txtUSBProduct.Text = $"0x{Metadata.USB.ProductID:X4}"; + if(Metadata.USB.Descriptors != null) + { + frmDescriptors.Visible = true; + lstUSBDescriptors.Add(Metadata.USB.Descriptors); + } + } + + if(Metadata.MAM != null) + { + chkMAM.Checked = true; + treeMAM.Visible = true; + lstMAM.Add(Metadata.MAM); + } + + if(Metadata.HeadsSpecified) spHeads.Value = Metadata.Heads; + if(Metadata.CylindersSpecified) spCylinders.Value = Metadata.Cylinders; + if(Metadata.SectorsPerTrackSpecified) spSectors.Value = Metadata.SectorsPerTrack; + if(Metadata.Track != null) + { + chkTracks.Checked = true; + treeTracks.Visible = true; + lstTracks = new ObservableCollection(Metadata.Track); + treeTracks.DataStore = lstTracks; // TODO: Really needed? + } + + if(Metadata.CopyProtection != null) txtCopyProtection.Text = Metadata.CopyProtection; + if(Metadata.Dimensions != null) + { + chkDimensions.Checked = true; + if(Metadata.Dimensions.DiameterSpecified) + { + chkRound.Checked = true; + stkDiameter.Visible = true; + stkHeight.Visible = false; + stkWidth.Visible = false; + spDiameter.Value = Metadata.Dimensions.Diameter; + } + else + { + stkDiameter.Visible = false; + stkHeight.Visible = true; + stkWidth.Visible = true; + spHeight.Value = Metadata.Dimensions.Height; + spWidth.Value = Metadata.Dimensions.Width; + } + + stkThickness.Visible = true; + spThickness.Value = Metadata.Dimensions.Thickness; + } + + if(Metadata.FileSystemInformation != null) + { + lstPartitions = new ObservableCollection(Metadata.FileSystemInformation); + treePartitions.DataStore = lstPartitions; // TODO: Really needed? + } + + if(Metadata.DumpHardwareArray != null) + { + chkDumpHardware.Checked = true; + treeDumpHardware.Visible = true; + btnAddHardware.Visible = true; + btnEditHardware.Visible = true; + btnRemoveHardware.Visible = true; + + lstDumpHw = new ObservableCollection(Metadata.DumpHardwareArray); + treeDumpHardware.DataStore = lstDumpHw; // TODO: Really needed? + } + + if(Metadata.DiskType != null) txtMediaType.Text = Metadata.DiskType; + if(Metadata.DiskSubType != null) txtMediaSubtype.Text = Metadata.DiskSubType; + } + + protected void OnChkSequenceToggled(object sender, EventArgs e) + { + lblMediaTitle.Visible = chkSequence.Checked.Value; + txtMediaTitle.Visible = chkSequence.Checked.Value; + lblSequence.Visible = chkSequence.Checked.Value; + spSequence.Visible = chkSequence.Checked.Value; + lblTotalMedia.Visible = chkSequence.Checked.Value; + spTotalMedia.Visible = chkSequence.Checked.Value; + lblSide.Visible = chkSequence.Checked.Value; + spSide.Visible = chkSequence.Checked.Value; + lblLayer.Visible = chkSequence.Checked.Value; + spLayer.Visible = chkSequence.Checked.Value; + } + + protected void OnChkDimensionsToggled(object sender, EventArgs e) + { + chkRound.Visible = chkDimensions.Checked.Value; + stkThickness.Visible = chkDimensions.Checked.Value; + if(chkDimensions.Checked.Value) OnChkRoundToggled(sender, e); + else + { + stkDiameter.Visible = false; + stkHeight.Visible = false; + stkWidth.Visible = false; + } + } + + protected void OnChkRoundToggled(object sender, EventArgs e) + { + stkDiameter.Visible = chkRound.Checked.Value; + stkHeight.Visible = !chkRound.Checked.Value; + stkWidth.Visible = !chkRound.Checked.Value; + } + + protected void OnChkPCMCIAToggled(object sender, EventArgs e) + { + chkCIS.Visible = chkPCMCIA.Checked.Value; + treeCIS.Visible = chkPCMCIA.Checked.Value; + lblPCMCIAManufacturer.Visible = chkPCMCIA.Checked.Value; + txtPCMCIAManufacturer.Visible = chkPCMCIA.Checked.Value; + lblMfgCode.Visible = chkPCMCIA.Checked.Value; + txtMfgCode.Visible = chkPCMCIA.Checked.Value; + lblPCMCIAProductName.Visible = chkPCMCIA.Checked.Value; + txtPCMCIAProductName.Visible = chkPCMCIA.Checked.Value; + lblCardCode.Visible = chkPCMCIA.Checked.Value; + txtCardCode.Visible = chkPCMCIA.Checked.Value; + lblCompliance.Visible = chkPCMCIA.Checked.Value; + txtCompliance.Visible = chkPCMCIA.Checked.Value; + lblAdditionalInformation.Visible = false; + treeAdditionalInformation.Visible = false; + } + + protected void OnBtnCancelPartitionClicked(object sender, EventArgs e) + { + btnCancelPartition.Visible = false; + btnApplyPartition.Visible = false; + btnRemovePartition.Visible = true; + btnEditPartition.Visible = true; + btnAddPartition.Visible = true; + stkPartitionFields1.Visible = false; + stkPartitionFields2.Visible = false; + frmFilesystems.Visible = false; + } + + protected void OnBtnRemovePartitionClicked(object sender, EventArgs e) + { + if(treePartitions.SelectedItem != null) lstPartitions.Remove((PartitionType)treePartitions.SelectedItem); + } + + protected void OnBtnEditPartitionClicked(object sender, EventArgs e) + { + if(treePartitions.SelectedItem == null) return; + + partitionIter = (PartitionType)treePartitions.SelectedItem; + + spPartitionSequence.Value = partitionIter.Sequence; + txtPartitionStart.Text = partitionIter.StartSector.ToString(); + txtPartitionEnd.Text = partitionIter.EndSector.ToString(); + txtPartitionType.Text = partitionIter.Type; + txtPartitionName.Text = partitionIter.Name; + txtPartitionDescription.Text = partitionIter.Description; + treeFilesystems.DataStore = new ObservableCollection(partitionIter.FileSystems); + + btnCancelPartition.Visible = true; + btnApplyPartition.Visible = true; + btnRemovePartition.Visible = false; + btnEditPartition.Visible = false; + btnAddPartition.Visible = false; + stkPartitionFields1.Visible = true; + stkPartitionFields2.Visible = true; + frmFilesystems.Visible = true; + + editingPartition = true; + } + + protected void OnBtnApplyPartitionClicked(object sender, EventArgs e) + { + if(!int.TryParse(txtPartitionStart.Text, out int temp)) + { + MessageBox.Show("Partition start must be a number", MessageBoxType.Error); + return; + } + + if(!int.TryParse(txtPartitionEnd.Text, out int temp2)) + { + MessageBox.Show("Partition end must be a number", MessageBoxType.Error); + return; + } + + if(temp2 <= temp) + { + MessageBox.Show("Partition must end after start, and be bigger than 1 sector", MessageBoxType.Error); + return; + } + + if(editingPartition) lstPartitions.Remove(partitionIter); + + partitionIter = new PartitionType + { + Sequence = (int)spPartitionSequence.Value, + StartSector = int.Parse(txtPartitionStart.Text), + EndSector = int.Parse(txtPartitionEnd.Text), + Type = txtPartitionType.Text, + Name = txtPartitionName.Text, + Description = txtPartitionDescription.Text + }; + if(((ObservableCollection)treeFilesystems.DataStore).Count > 0) + partitionIter.FileSystems = ((ObservableCollection)treeFilesystems.DataStore).ToArray(); + + btnCancelPartition.Visible = false; + btnApplyPartition.Visible = false; + btnRemovePartition.Visible = true; + btnEditPartition.Visible = true; + btnAddPartition.Visible = true; + stkPartitionFields1.Visible = false; + stkPartitionFields2.Visible = false; + frmFilesystems.Visible = false; + } + + protected void OnBtnAddPartitionClicked(object sender, EventArgs e) + { + spPartitionSequence.Value = 0; + txtPartitionStart.Text = ""; + txtPartitionEnd.Text = ""; + txtPartitionType.Text = ""; + txtPartitionName.Text = ""; + txtPartitionDescription.Text = ""; + treeFilesystems.DataStore = new ObservableCollection(); + + btnCancelPartition.Visible = true; + btnApplyPartition.Visible = true; + btnRemovePartition.Visible = false; + btnEditPartition.Visible = false; + btnAddPartition.Visible = false; + stkPartitionFields1.Visible = true; + stkPartitionFields2.Visible = true; + frmFilesystems.Visible = true; + + editingPartition = false; + } + + protected void OnBtnRemoveFilesystemClicked(object sender, EventArgs e) + { + if(treeFilesystems.SelectedItem != null) + ((ObservableCollection)treeFilesystems.DataStore).Remove((FileSystemType)treeFilesystems + .SelectedItem); + } + + protected void OnBtnEditFilesystemClicked(object sender, EventArgs e) + { + if(treeFilesystems.SelectedItem == null) return; + + filesystemIter = (FileSystemType)treeFilesystems.SelectedItem; + + dlgFilesystem _dlgFilesystem = new dlgFilesystem {Metadata = filesystemIter}; + _dlgFilesystem.FillFields(); + _dlgFilesystem.ShowModal(this); + + if(!_dlgFilesystem.Modified) return; + + ((ObservableCollection)treeFilesystems.DataStore).Remove(filesystemIter); + ((ObservableCollection)treeFilesystems.DataStore).Add(_dlgFilesystem.Metadata); + } + + protected void OnBtnAddFilesystemClicked(object sender, EventArgs e) + { + dlgFilesystem _dlgFilesystem = new dlgFilesystem(); + _dlgFilesystem.ShowModal(this); + + if(_dlgFilesystem.Modified) + ((ObservableCollection)treeFilesystems.DataStore).Add(_dlgFilesystem.Metadata); + } + + protected void OnChkDumpHardwareToggled(object sender, EventArgs e) + { + treeDumpHardware.Visible = chkDumpHardware.Checked.Value; + btnAddHardware.Visible = chkDumpHardware.Checked.Value; + btnRemoveHardware.Visible = chkDumpHardware.Checked.Value; + btnEditHardware.Visible = chkDumpHardware.Checked.Value; + + btnCancelHardware.Visible = false; + btnApplyHardware.Visible = false; + frmHardware.Visible = false; + } + + protected void OnBtnCancelHardwareClicked(object sender, EventArgs e) + { + btnAddHardware.Visible = true; + btnRemoveHardware.Visible = true; + btnCancelHardware.Visible = false; + btnEditHardware.Visible = true; + btnApplyHardware.Visible = false; + frmHardware.Visible = false; + } + + protected void OnBtnRemoveHardwareClicked(object sender, EventArgs e) + { + if(treeDumpHardware.SelectedItem != null) lstDumpHw.Remove((DumpHardwareType)treeDumpHardware.SelectedItem); + } + + protected void OnBtnEditHardwareClicked(object sender, EventArgs e) + { + if(treeDumpHardware.SelectedItem == null) return; + + dumpHwIter = (DumpHardwareType)treeDumpHardware.SelectedItem; + + txtHWManufacturer.Text = dumpHwIter.Manufacturer; + txtHWModel.Text = dumpHwIter.Model; + txtHWRevision.Text = dumpHwIter.Revision; + txtHWFirmware.Text = dumpHwIter.Firmware; + txtHWSerial.Text = dumpHwIter.Serial; + if(dumpHwIter.Software != null) + { + txtDumpName.Text = dumpHwIter.Software.Name; + txtDumpVersion.Text = dumpHwIter.Software.Version; + txtDumpOS.Text = dumpHwIter.Software.OperatingSystem; + } + + treeExtents.DataStore = new ObservableCollection(dumpHwIter.Extents); + + btnAddHardware.Visible = false; + btnRemoveHardware.Visible = false; + btnCancelHardware.Visible = true; + btnEditHardware.Visible = false; + btnApplyHardware.Visible = true; + frmHardware.Visible = true; + + editingDumpHw = true; + } + + protected void OnBtnApplyHardwareClicked(object sender, EventArgs e) + { + if(editingDumpHw) lstDumpHw.Remove(dumpHwIter); + + dumpHwIter = new DumpHardwareType + { + Manufacturer = txtHWManufacturer.Text, + Model = txtHWModel.Text, + Revision = txtHWRevision.Text, + Firmware = txtHWFirmware.Text, + Serial = txtHWSerial.Text + }; + if(!string.IsNullOrWhiteSpace(txtDumpName.Text) || !string.IsNullOrWhiteSpace(txtDumpVersion.Text) || + !string.IsNullOrWhiteSpace(txtDumpOS.Text)) + dumpHwIter.Software = new SoftwareType + { + Name = txtDumpName.Text, + Version = txtDumpVersion.Text, + OperatingSystem = txtDumpOS.Text + }; + if(((ObservableCollection)treeExtents.DataStore).Count > 0) + dumpHwIter.Extents = ((ObservableCollection)treeExtents.DataStore).ToArray(); + + lstDumpHw.Add(dumpHwIter); + + btnAddHardware.Visible = true; + btnRemoveHardware.Visible = true; + btnCancelHardware.Visible = false; + btnEditHardware.Visible = true; + btnApplyHardware.Visible = false; + frmHardware.Visible = false; + } + + protected void OnBtnAddHardwareClicked(object sender, EventArgs e) + { + txtHWManufacturer.Text = ""; + txtHWModel.Text = ""; + txtHWRevision.Text = ""; + txtHWFirmware.Text = ""; + txtHWSerial.Text = ""; + txtDumpName.Text = ""; + txtDumpVersion.Text = ""; + txtDumpOS.Text = ""; + treeExtents.DataStore = new ObservableCollection(); + + btnAddHardware.Visible = false; + btnRemoveHardware.Visible = false; + btnCancelHardware.Visible = true; + btnEditHardware.Visible = false; + btnApplyHardware.Visible = true; + frmHardware.Visible = true; + + editingDumpHw = false; + } + + protected void OnBtnRemoveExtentClicked(object sender, EventArgs e) + { + if(treeExtents.SelectedItem != null) + ((ObservableCollection)treeExtents.DataStore).Remove((ExtentType)treeExtents.SelectedItem); + } + + protected void OnBtnAddExtentClicked(object sender, EventArgs e) + { + ((ObservableCollection)treeExtents.DataStore).Add(new ExtentType + { + Start = (ulong)spExtentStart.Value, + End = (ulong)spExtentEnd.Value + }); + } + + protected void OnBtnCancelClicked(object sender, EventArgs e) + { + Close(); + } + + protected void OnBtnSaveClicked(object sender, EventArgs e) + { + #region Sanity checks + if(string.IsNullOrEmpty(txtFormat.Text)) + { + MessageBox.Show("Image format cannot be null", MessageBoxType.Error); + return; + } + + if(chkSequence.Checked.Value) + { + if(spSequence.Value < 1) + { + MessageBox.Show("Media sequence must be bigger than 0", MessageBoxType.Error); + return; + } + + if(spTotalMedia.Value < 1) + { + MessageBox.Show("Total medias must be bigger than 0", MessageBoxType.Error); + return; + } + + if(spSequence.Value > spTotalMedia.Value) + { + MessageBox.Show("Media sequence cannot be bigger than total medias", MessageBoxType.Error); + return; + } + } + + if(string.IsNullOrEmpty(txtBlocks.Text) || !long.TryParse(txtBlocks.Text, out long ltmp)) + { + MessageBox.Show("Blocks must be a number", MessageBoxType.Error); + return; + } + + if(ltmp < 1) + { + MessageBox.Show("Blocks must be bigger than 0", MessageBoxType.Error); + return; + } + + if(spPhysicalBlockSize.Value < 1) + { + MessageBox.Show("Physical Block Size must be bigger than 0", MessageBoxType.Error); + return; + } + + if(spLogicalBlockSize.Value < 1) + { + MessageBox.Show("Logical Block Size must be bigger than 0", MessageBoxType.Error); + return; + } + + if(spPhysicalBlockSize.Value < spLogicalBlockSize.Value) + { + MessageBox.Show("Physical Block Size must be bigger than Logical Block Size", MessageBoxType.Error); + return; + } + + if(chkDimensions.Checked.Value) + { + if(chkRound.Checked.Value) + { + if(spDiameter.Value <= 0) + { + MessageBox.Show("Diameter must be bigger than 0", MessageBoxType.Error); + return; + } + } + else + { + if(spHeight.Value <= 0) + { + MessageBox.Show("Height must be bigger than 0", MessageBoxType.Error); + return; + } + + if(spWidth.Value <= 0) + { + MessageBox.Show("Width must be bigger than 0", MessageBoxType.Error); + return; + } + } + + if(spThickness.Value <= 0) + { + MessageBox.Show("Thickness must be bigger than 0", MessageBoxType.Error); + return; + } + } + + if(chkPCI.Checked.Value) + { + if(string.IsNullOrWhiteSpace(txtPCIVendor.Text)) + { + MessageBox.Show("PCI Vendor ID must be set", MessageBoxType.Error); + return; + } + + if(string.IsNullOrWhiteSpace(txtPCIProduct.Text)) + { + MessageBox.Show("PCI Product ID must be set", MessageBoxType.Error); + return; + } + + try + { + if(Convert.ToInt32(txtPCIVendor.Text, 16) < 0 || Convert.ToInt32(txtPCIVendor.Text, 16) > 0xFFFF) + { + MessageBox.Show("PCI Vendor ID must be between 0x0000 and 0xFFFF", MessageBoxType.Error); + return; + } + } + catch(FormatException) + { + MessageBox.Show("PCI Vendor ID must be a number in hexadecimal format", MessageBoxType.Error); + return; + } + catch(OverflowException) + { + MessageBox.Show("PCI Vendor ID must not be negative", MessageBoxType.Error); + return; + } + + try + { + if(Convert.ToInt32(txtPCIProduct.Text, 16) < 0 || Convert.ToInt32(txtPCIProduct.Text, 16) > 0xFFFF) + { + MessageBox.Show("PCI Product ID must be between 0x0000 and 0xFFFF", MessageBoxType.Error); + return; + } + } + catch(FormatException) + { + MessageBox.Show("PCI Product ID must be a number in hexadecimal format", MessageBoxType.Error); + return; + } + catch(OverflowException) + { + MessageBox.Show("PCI Product ID must not be negative", MessageBoxType.Error); + return; + } + } + + if(chkPCMCIA.Checked.Value) + { + if(string.IsNullOrWhiteSpace(txtPCMCIAManufacturer.Text)) + { + MessageBox.Show("PCMCIA Manufacturer Code must be set", MessageBoxType.Error); + return; + } + + if(string.IsNullOrWhiteSpace(txtCardCode.Text)) + { + MessageBox.Show("PCMCIA Card Code must be set", MessageBoxType.Error); + return; + } + + try + { + if(Convert.ToInt32(txtMfgCode.Text, 16) < 0 || Convert.ToInt32(txtMfgCode.Text, 16) > 0xFFFF) + { + MessageBox.Show("PCMCIA Manufacturer Code must be between 0x0000 and 0xFFFF", + MessageBoxType.Error); + return; + } + } + catch(FormatException) + { + MessageBox.Show("PCMCIA Manufacturer Code must be a number in hexadecimal format", + MessageBoxType.Error); + return; + } + catch(OverflowException) + { + MessageBox.Show("PCMCIA Manufacturer Code must not be negative", MessageBoxType.Error); + return; + } + + try + { + if(Convert.ToInt32(txtCardCode.Text, 16) < 0 || Convert.ToInt32(txtCardCode.Text, 16) > 0xFFFF) + { + MessageBox.Show("PCMCIA Card Code must be between 0x0000 and 0xFFFF", MessageBoxType.Error); + return; + } + } + catch(FormatException) + { + MessageBox.Show("PCMCIA Card Code must be a number in hexadecimal format", MessageBoxType.Error); + return; + } + catch(OverflowException) + { + MessageBox.Show("PCMCIA Card Code must not be negative", MessageBoxType.Error); + return; + } + } + + if(chkUSB.Checked.Value) + { + if(string.IsNullOrWhiteSpace(txtUSBVendor.Text)) + { + MessageBox.Show("USB Vendor ID must be set", MessageBoxType.Error); + return; + } + + if(string.IsNullOrWhiteSpace(txtUSBProduct.Text)) + { + MessageBox.Show("USB Product ID must be set", MessageBoxType.Error); + return; + } + + try + { + if(Convert.ToInt32(txtUSBVendor.Text, 16) < 0 || Convert.ToInt32(txtUSBVendor.Text, 16) > 0xFFFF) + { + MessageBox.Show("USB Vendor ID must be between 0x0000 and 0xFFFF", MessageBoxType.Error); + return; + } + } + catch(FormatException) + { + MessageBox.Show("USB Vendor ID must be a number in hexadecimal format", MessageBoxType.Error); + return; + } + catch(OverflowException) + { + MessageBox.Show("USB Vendor ID must not be negative", MessageBoxType.Error); + return; + } + + try + { + if(Convert.ToInt32(txtUSBProduct.Text, 16) < 0 || Convert.ToInt32(txtUSBProduct.Text, 16) > 0xFFFF) + { + MessageBox.Show("USB Product ID must be between 0x0000 and 0xFFFF", MessageBoxType.Error); + return; + } + } + catch(FormatException) + { + MessageBox.Show("USB Product ID must be a number in hexadecimal format", MessageBoxType.Error); + return; + } + catch(OverflowException) + { + MessageBox.Show("USB Product ID must not be negative", MessageBoxType.Error); + return; + } + } + + if(chkDumpHardware.Checked.Value) + if(lstDumpHw.Count < 1) + { + MessageBox.Show("If dump hardware is known at least an entry must be created"); + return; + } + #endregion Sanity checks + + Metadata = new BlockMediaType {Image = new ImageType {Value = txtImage.Text, format = txtFormat.Text}}; + + if(!string.IsNullOrWhiteSpace(txtOffset.Text) && long.TryParse(txtOffset.Text, out ltmp)) + { + Metadata.Image.offsetSpecified = true; + Metadata.Image.offset = long.Parse(txtOffset.Text); + } + + Metadata.Size = long.Parse(txtSize.Text); + Metadata.Checksums = checksums; + Metadata.ContentChecksums = contentChks; + + if(chkSequence.Checked.Value) + { + Metadata.Sequence = new SequenceType + { + MediaTitle = txtMediaTitle.Text, + MediaSequence = (int)spSequence.Value, + TotalMedia = (int)spTotalMedia.Value + }; + if(spSide.Value > 0) + { + Metadata.Sequence.SideSpecified = true; + Metadata.Sequence.Side = (int)spSide.Value; + } + + if(spLayer.Value > 0) + { + Metadata.Sequence.LayerSpecified = true; + Metadata.Sequence.Layer = (int)spLayer.Value; + } + } + + if(!string.IsNullOrWhiteSpace(txtManufacturer.Text)) Metadata.Manufacturer = txtManufacturer.Text; + if(!string.IsNullOrWhiteSpace(txtModel.Text)) Metadata.Model = txtModel.Text; + if(!string.IsNullOrWhiteSpace(txtSerial.Text)) Metadata.Serial = txtSerial.Text; + if(!string.IsNullOrWhiteSpace(txtFirmware.Text)) Metadata.Firmware = txtFirmware.Text; + if(!string.IsNullOrWhiteSpace(txtInterface.Text)) Metadata.Interface = txtInterface.Text; + + Metadata.PhysicalBlockSize = (int)spPhysicalBlockSize.Value; + Metadata.LogicalBlockSize = (int)spLogicalBlockSize.Value; + Metadata.LogicalBlocks = long.Parse(txtBlocks.Text); + Metadata.VariableBlockSize = variableBlockSize; + Metadata.TapeInformation = tapeInformation; + Metadata.Scans = scans; + + if(chkATA.Checked.Value && lstAta.Count == 1) Metadata.ATA = new ATAType {Identify = lstAta[0]}; + + if(chkPCI.Checked.Value) + { + Metadata.PCI = new PCIType + { + VendorID = Convert.ToUInt16(txtPCIVendor.Text, 16), + DeviceID = Convert.ToUInt16(txtPCIProduct.Text, 16) + }; + + if(lstPCIConfiguration.Count == 1) Metadata.PCI.Configuration = lstPCIConfiguration[0]; + + if(lstPCIOptionROM.Count == 1) Metadata.PCI.ExpansionROM = lstPCIOptionROM[0]; + } + + if(chkPCMCIA.Checked.Value) + { + Metadata.PCMCIA = new PCMCIAType(); + + if(lstPCMCIACIS.Count == 1) Metadata.PCMCIA.CIS = lstPCMCIACIS[0]; + + if(!string.IsNullOrWhiteSpace(txtCompliance.Text)) Metadata.PCMCIA.Compliance = txtCompliance.Text; + if(!string.IsNullOrWhiteSpace(txtPCMCIAManufacturer.Text)) + Metadata.PCMCIA.Manufacturer = txtPCMCIAManufacturer.Text; + if(!string.IsNullOrWhiteSpace(txtPCMCIAProductName.Text)) + Metadata.PCMCIA.ProductName = txtPCMCIAProductName.Text; + if(!string.IsNullOrWhiteSpace(txtMfgCode.Text)) + { + Metadata.PCMCIA.ManufacturerCodeSpecified = true; + Metadata.PCMCIA.ManufacturerCode = Convert.ToUInt16(txtMfgCode.Text, 16); + } + + if(!string.IsNullOrWhiteSpace(txtCardCode.Text)) + { + Metadata.PCMCIA.CardCodeSpecified = true; + Metadata.PCMCIA.CardCode = Convert.ToUInt16(txtCardCode.Text, 16); + } + + if(lstAdditionalInformation.Count > 0) + { + List addinfos = new List(); + foreach(StringEntry entry in lstAdditionalInformation) addinfos.Add(entry.str); + Metadata.PCMCIA.AdditionalInformation = addinfos.ToArray(); + } + } + + if(chkSecureDigital.Checked.Value) + { + Metadata.SecureDigital = new SecureDigitalType(); + + if(lstCID.Count == 1) Metadata.SecureDigital.CID = lstCID[0]; + if(lstCSD.Count == 1) Metadata.SecureDigital.CSD = lstCSD[0]; + if(lstECSD.Count == 1) Metadata.MultiMediaCard.ExtendedCSD = lstECSD[0]; + } + + if(chkSCSI.Checked.Value) + { + Metadata.SCSI = new SCSIType(); + + if(lstInquiry.Count == 1) Metadata.SCSI.Inquiry = lstInquiry[0]; + if(lstModeSense.Count == 1) Metadata.SCSI.ModeSense = lstModeSense[0]; + if(lstModeSense10.Count == 1) Metadata.SCSI.ModeSense10 = lstModeSense10[0]; + if(lstLogSense.Count == 1) Metadata.SCSI.LogSense = lstLogSense[0]; + if(lstEVPDs.Count > 0) Metadata.SCSI.EVPD = lstEVPDs.ToArray(); + } + + if(chkUSB.Checked.Value) + { + Metadata.USB = new USBType + { + VendorID = Convert.ToUInt16(txtUSBVendor.Text, 16), + ProductID = Convert.ToUInt16(txtUSBProduct.Text, 16) + }; + + if(lstUSBDescriptors.Count == 1) Metadata.USB.Descriptors = lstUSBDescriptors[0]; + } + + if(chkMAM.Checked.Value && lstMAM.Count == 1) Metadata.MAM = lstMAM[0]; + + if(spHeads.Value > 0 && spCylinders.Value > 0 && spSectors.Value > 0) + { + Metadata.HeadsSpecified = true; + Metadata.CylindersSpecified = true; + Metadata.SectorsPerTrackSpecified = true; + Metadata.Heads = (long)spHeads.Value; + Metadata.Cylinders = (long)spCylinders.Value; + Metadata.SectorsPerTrack = (long)spSectors.Value; + } + + if(lstTracks.Count > 0) Metadata.Track = lstTracks.ToArray(); + + if(!string.IsNullOrWhiteSpace(txtCopyProtection.Text)) Metadata.CopyProtection = txtCopyProtection.Text; + + if(chkDimensions.Checked.Value) + { + Metadata.Dimensions = new DimensionsType(); + if(chkRound.Checked.Value) + { + Metadata.Dimensions.DiameterSpecified = true; + Metadata.Dimensions.Diameter = spDiameter.Value; + } + else + { + Metadata.Dimensions.HeightSpecified = true; + Metadata.Dimensions.WidthSpecified = true; + Metadata.Dimensions.Height = spHeight.Value; + Metadata.Dimensions.Width = spWidth.Value; + } + + Metadata.Dimensions.Thickness = spThickness.Value; + } + + if(lstPartitions.Count > 0) Metadata.FileSystemInformation = lstPartitions.ToArray(); + + if(chkDumpHardware.Checked.Value && lstDumpHw.Count > 0) Metadata.DumpHardwareArray = lstDumpHw.ToArray(); + + if(!string.IsNullOrWhiteSpace(txtMediaType.Text)) Metadata.DiskType = txtMediaType.Text; + if(!string.IsNullOrWhiteSpace(txtMediaSubtype.Text)) Metadata.DiskSubType = txtMediaSubtype.Text; + + Modified = true; + Close(); + } + + class StringEntry + { + public string str; + } + + #region XAML UI elements + #pragma warning disable 0649 + TextBox txtImage; + TextBox txtFormat; + TextBox txtOffset; + TextBox txtSize; + TextBox txtManufacturer; + TextBox txtModel; + TextBox txtSerial; + TextBox txtFirmware; + TextBox txtInterface; + TextBox txtCopyProtection; + TextBox txtMediaType; + TextBox txtMediaSubtype; + CheckBox chkSequence; + Label lblMediaTitle; + TextBox txtMediaTitle; + Label lblSequence; + NumericUpDown spSequence; + Label lblTotalMedia; + NumericUpDown spTotalMedia; + Label lblSide; + NumericUpDown spSide; + Label lblLayer; + NumericUpDown spLayer; + TextBox txtBlocks; + NumericUpDown spPhysicalBlockSize; + NumericUpDown spLogicalBlockSize; + NumericUpDown spCylinders; + NumericUpDown spHeads; + NumericUpDown spSectors; + CheckBox chkDimensions; + CheckBox chkRound; + StackLayout stkDiameter; + NumericUpDown spDiameter; + StackLayout stkHeight; + NumericUpDown spHeight; + StackLayout stkWidth; + NumericUpDown spWidth; + StackLayout stkThickness; + NumericUpDown spThickness; + CheckBox chkATA; + GridView treeATA; + CheckBox chkPCI; + Label lblPCIVendor; + TextBox txtPCIVendor; + Label lblPCIProduct; + TextBox txtPCIProduct; + GroupBox frmPCIConfiguration; + GridView treeConfiguration; + GroupBox frmOptionROM; + GridView treeOptionROM; + CheckBox chkPCMCIA; + CheckBox chkCIS; + GridView treeCIS; + Label lblPCMCIAManufacturer; + Label lblMfgCode; + Label lblPCMCIAProductName; + Label lblCardCode; + Label lblCompliance; + TextBox txtPCMCIAManufacturer; + TextBox txtMfgCode; + TextBox txtPCMCIAProductName; + TextBox txtCardCode; + TextBox txtCompliance; + GroupBox lblAdditionalInformation; + GridView treeAdditionalInformation; + CheckBox chkSecureDigital; + GridView treeCID; + CheckBox chkCSD; + GridView treeCSD; + CheckBox chkECSD; + GridView treeECSD; + CheckBox chkSCSI; + GroupBox frmInquiry; + GridView treeInquiry; + GroupBox frmModeSense; + GridView treeModeSense; + GroupBox frmModeSense10; + GridView treeModeSense10; + GroupBox frmLogSense; + GridView treeLogSense; + GroupBox frmEVPDs; + GridView treeEVPDs; + CheckBox chkUSB; + TextBox txtUSBVendor; + TextBox txtUSBProduct; + GridView treeDescriptors; + CheckBox chkMAM; + GridView treeMAM; + CheckBox chkTracks; + GridView treeTracks; + GridView treePartitions; + Button btnCancelPartition; + Button btnRemovePartition; + Button btnEditPartition; + Button btnApplyPartition; + Button btnAddPartition; + NumericUpDown spPartitionSequence; + TextBox txtPartitionStart; + TextBox txtPartitionEnd; + TextBox txtPartitionType; + TextBox txtPartitionName; + TextBox txtPartitionDescription; + GroupBox frmFilesystems; + GridView treeFilesystems; + CheckBox chkDumpHardware; + GridView treeDumpHardware; + Button btnCancelHardware; + Button btnRemoveHardware; + Button btnEditHardware; + Button btnApplyHardware; + Button btnAddHardware; + GroupBox frmHardware; + TextBox txtHWManufacturer; + TextBox txtHWModel; + TextBox txtHWRevision; + TextBox txtHWFirmware; + TextBox txtHWSerial; + GridView treeExtents; + NumericUpDown spExtentStart; + NumericUpDown spExtentEnd; + TextBox txtDumpName; + TextBox txtDumpVersion; + TextBox txtDumpOS; + Label lblCID; + Label lblUSBVendor; + Label lblUSBProduct; + GroupBox frmDescriptors; + StackLayout stkPartitionFields1; + StackLayout stkPartitionFields2; + #pragma warning restore 0649 + #endregion XAML UI elements + } +} \ No newline at end of file diff --git a/dlgMetadata.xeto b/dlgMetadata.xeto new file mode 100644 index 0000000..0704faa --- /dev/null +++ b/dlgMetadata.xeto @@ -0,0 +1,317 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Known release type? + + + + + + Unknown or unreleased + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dlgMetadata.xeto.cs b/dlgMetadata.xeto.cs new file mode 100644 index 0000000..4db2ce6 --- /dev/null +++ b/dlgMetadata.xeto.cs @@ -0,0 +1,1148 @@ +// +// Author: +// Natalia Portillo claunia@claunia.com +// +// Copyright (c) 2017, © Claunia.com +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in +// the documentation and/or other materials provided with the distribution. +// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading; +using apprepodbmgr.Core; +using Eto.Forms; +using Eto.Serialization.Xaml; +using Schemas; +using BorderType = Schemas.BorderType; + +namespace apprepodbmgr.Eto +{ + public class dlgMetadata : Dialog + { + AdvertisementType[] adverts; + AudioMediaType[] audiomedias; + BookType[] books; + LinearMediaType[] linearmedias; + ObservableCollection lstArchitectures; + ObservableCollection lstArchitecturesTypes; + ObservableCollection lstBarcodes; + + ObservableCollection lstBarcodeTypes; + ObservableCollection lstCategories; + ObservableCollection lstDiscs; + ObservableCollection lstDisks; + ObservableCollection lstFilesForMedia; + + ObservableCollection lstKeywords; + ObservableCollection lstLanguages; + ObservableCollection lstLanguageTypes; + ObservableCollection lstOses; + ObservableCollection lstSubcategories; + + // TODO: Add the options to edit these fields + MagazineType[] magazines; + public CICMMetadataType Metadata; + + public bool Modified; + PCIType[] pcis; + bool stopped; + + Thread thdDisc; + Thread thdDisk; + UserManualType[] usermanuals; + + public dlgMetadata() + { + XamlReader.Load(this); + + Modified = false; + + cmbReleaseType = new EnumDropDown(); + stkReleaseType.Items.Add(new StackLayoutItem {Control = cmbReleaseType, Expand = true}); + + lstKeywords = new ObservableCollection(); + lstBarcodes = new ObservableCollection(); + lstCategories = new ObservableCollection(); + lstSubcategories = new ObservableCollection(); + lstLanguages = new ObservableCollection(); + lstOses = new ObservableCollection(); + lstArchitectures = new ObservableCollection(); + lstDiscs = new ObservableCollection(); + lstDisks = new ObservableCollection(); + + treeKeywords.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.str)}, + HeaderText = "Keyword" + }); + treeBarcodes.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.code)}, + HeaderText = "Barcode" + }); + treeBarcodes.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.type).Convert(v => v.ToString()) + }, + HeaderText = "Type" + }); + treeCategories.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.str)}, + HeaderText = "Category" + }); + treeSubcategories.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.str)}, + HeaderText = "Subcategory" + }); + treeLanguages.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.str)}, + HeaderText = "Language" + }); + treeOses.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.name)}, + HeaderText = "Name" + }); + treeOses.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.version)}, + HeaderText = "Version" + }); + treeArchitectures.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.str)}, + HeaderText = "Architecture" + }); + treeDiscs.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.path)}, + HeaderText = "File" + }); + treeDisks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.path)}, + HeaderText = "File" + }); + + treeKeywords.DataStore = lstKeywords; + treeBarcodes.DataStore = lstBarcodes; + treeCategories.DataStore = lstCategories; + treeSubcategories.DataStore = lstSubcategories; + treeLanguages.DataStore = lstLanguages; + treeOses.DataStore = lstOses; + treeArchitectures.DataStore = lstArchitectures; + treeDiscs.DataStore = lstDiscs; + treeDisks.DataStore = lstDisks; + + treeKeywords.AllowMultipleSelection = false; + treeBarcodes.AllowMultipleSelection = false; + treeCategories.AllowMultipleSelection = false; + treeSubcategories.AllowMultipleSelection = false; + treeLanguages.AllowMultipleSelection = false; + treeOses.AllowMultipleSelection = false; + treeArchitectures.AllowMultipleSelection = false; + treeDiscs.AllowMultipleSelection = false; + treeDisks.AllowMultipleSelection = false; + + lstBarcodeTypes = new ObservableCollection(); + lstLanguageTypes = new ObservableCollection(); + lstArchitecturesTypes = new ObservableCollection(); + lstFilesForMedia = new ObservableCollection(); + + //cmbBarcodes.ItemTextBinding = Binding.Property(r => r.str); + cmbBarcodes.DataStore = lstBarcodeTypes; + cmbLanguages.DataStore = lstLanguageTypes; + cmbArchitectures.DataStore = lstArchitecturesTypes; + cmbFilesForNewDisc.DataStore = lstFilesForMedia; + cmbFilesForNewDisk.DataStore = lstFilesForMedia; + + FillBarcodeCombo(); + FillLanguagesCombo(); + FillArchitecturesCombo(); + FillFilesCombos(); + + txtDeveloper.ToolTip = "Who developed the application."; + txtPublisher.ToolTip = "Who published the application."; + txtAuthor.ToolTip = "Author of the audiovisual media."; + txtPerformer.ToolTip = "Performer of the audiovisual media."; + txtName.ToolTip = "Application name."; + txtVersion.ToolTip = "Application version."; + txtPartNumber.ToolTip = "Part number of the application distribution."; + txtSerialNumber.ToolTip = + "Serial number of the application distribution. Not to be confused with serial number required to install."; + } + + void FillBarcodeCombo() + { + lstBarcodeTypes.Clear(); + foreach(BarcodeTypeType type in Enum.GetValues(typeof(BarcodeTypeType))) + lstBarcodeTypes.Add(type.ToString()); + } + + void FillLanguagesCombo() + { + lstLanguageTypes.Clear(); + foreach(LanguagesTypeLanguage type in Enum.GetValues(typeof(LanguagesTypeLanguage))) + lstLanguageTypes.Add(type.ToString()); + } + + void FillArchitecturesCombo() + { + lstArchitecturesTypes.Clear(); + foreach(ArchitecturesTypeArchitecture type in Enum.GetValues(typeof(ArchitecturesTypeArchitecture))) + lstArchitecturesTypes.Add(type.ToString()); + } + + void FillFilesCombos() + { + foreach(KeyValuePair files in Context.Hashes) lstFilesForMedia.Add(files.Key); + } + + public void FillFields() + { + if(Metadata == null) return; + + if(Metadata.Developer != null) + foreach(string developer in Metadata.Developer) + { + if(!string.IsNullOrWhiteSpace(txtDeveloper.Text)) txtDeveloper.Text += ","; + txtDeveloper.Text += developer; + } + + if(Metadata.Publisher != null) + foreach(string publisher in Metadata.Publisher) + { + if(!string.IsNullOrWhiteSpace(txtPublisher.Text)) txtPublisher.Text += ","; + txtPublisher.Text += publisher; + } + + if(Metadata.Author != null) + foreach(string author in Metadata.Author) + { + if(!string.IsNullOrWhiteSpace(txtPublisher.Text)) txtPublisher.Text += ","; + txtPublisher.Text += author; + } + + if(Metadata.Performer != null) + foreach(string performer in Metadata.Performer) + { + if(!string.IsNullOrWhiteSpace(txtPublisher.Text)) txtPublisher.Text += ","; + txtPublisher.Text += performer; + } + + txtName.Text = Metadata.Name; + txtVersion.Text = Metadata.Version; + txtPartNumber.Text = Metadata.PartNumber; + txtSerialNumber.Text = Metadata.SerialNumber; + + if(Metadata.ReleaseTypeSpecified) + { + chkKnownReleaseType.Checked = true; + cmbReleaseType.Enabled = true; + cmbReleaseType.SelectedValue = Metadata.ReleaseType; + } + + if(Metadata.ReleaseDateSpecified) + { + chkReleaseDate.Checked = false; + cldReleaseDate.Enabled = true; + cldReleaseDate.Value = Metadata.ReleaseDate; + } + + if(Metadata.Keywords != null) + foreach(string keyword in Metadata.Keywords) + lstKeywords.Add(new StringEntry {str = keyword}); + if(Metadata.Categories != null) + foreach(string category in Metadata.Categories) + lstCategories.Add(new StringEntry {str = category}); + if(Metadata.Subcategories != null) + foreach(string subcategory in Metadata.Subcategories) + lstSubcategories.Add(new StringEntry {str = subcategory}); + + if(Metadata.Languages != null) + foreach(LanguagesTypeLanguage language in Metadata.Languages) + { + lstLanguages.Add(new StringEntry {str = language.ToString()}); + lstLanguageTypes.Remove(language.ToString()); + } + + if(Metadata.RequiredOperatingSystems != null) + foreach(RequiredOperatingSystemType reqos in Metadata.RequiredOperatingSystems) + foreach(string reqver in reqos.Version) + lstOses.Add(new TargetOsEntry {name = reqos.Name, version = reqver}); + + if(Metadata.Architectures != null) + foreach(ArchitecturesTypeArchitecture architecture in Metadata.Architectures) + { + lstArchitectures.Add(new StringEntry {str = architecture.ToString()}); + lstArchitecturesTypes.Remove(architecture.ToString()); + } + + if(Metadata.OpticalDisc != null) + foreach(OpticalDiscType disc in Metadata.OpticalDisc) + { + lstDiscs.Add(new DiscEntry {path = disc.Image.Value, disc = disc}); + List files = new List {disc.Image.Value}; + if(disc.ADIP != null) files.Add(disc.ADIP.Image); + if(disc.ATIP != null) files.Add(disc.ATIP.Image); + if(disc.BCA != null) files.Add(disc.BCA.Image); + if(disc.CMI != null) files.Add(disc.CMI.Image); + if(disc.DCB != null) files.Add(disc.DCB.Image); + if(disc.DDS != null) files.Add(disc.DDS.Image); + if(disc.DMI != null) files.Add(disc.DMI.Image); + if(disc.LastRMD != null) files.Add(disc.LastRMD.Image); + if(disc.LeadIn != null) + foreach(BorderType border in disc.LeadIn) + files.Add(border.Image); + if(disc.LeadInCdText != null) files.Add(disc.LeadInCdText.Image); + if(disc.LeadOut != null) + foreach(BorderType border in disc.LeadOut) + files.Add(border.Image); + if(disc.MediaID != null) files.Add(disc.MediaID.Image); + if(disc.PAC != null) files.Add(disc.PAC.Image); + if(disc.PFI != null) files.Add(disc.PFI.Image); + if(disc.PFIR != null) files.Add(disc.PFIR.Image); + if(disc.PMA != null) files.Add(disc.PMA.Image); + if(disc.PRI != null) files.Add(disc.PRI.Image); + if(disc.SAI != null) files.Add(disc.SAI.Image); + if(disc.TOC != null) files.Add(disc.TOC.Image); + if(disc.Track != null) files.AddRange(disc.Track.Select(track => track.Image.Value)); + + foreach(string file in files) + if(lstFilesForMedia.Contains(file)) + lstFilesForMedia.Remove(file); + } + + if(Metadata.BlockMedia != null) + foreach(BlockMediaType disk in Metadata.BlockMedia) + { + lstDisks.Add(new DiskEntry {path = disk.Image.Value, disk = disk}); + List files = new List {disk.Image.Value}; + if(disk.ATA?.Identify != null) files.Add(disk.ATA.Identify.Image); + if(disk.MAM != null) files.Add(disk.MAM.Image); + if(disk.PCI?.ExpansionROM != null) files.Add(disk.PCI.ExpansionROM.Image.Value); + if(disk.PCMCIA?.CIS != null) files.Add(disk.PCMCIA.CIS.Image); + if(disk.SCSI != null) + { + if(disk.SCSI.Inquiry != null) files.Add(disk.SCSI.Inquiry.Image); + if(disk.SCSI.LogSense != null) files.Add(disk.SCSI.LogSense.Image); + if(disk.SCSI.ModeSense != null) files.Add(disk.SCSI.ModeSense.Image); + if(disk.SCSI.ModeSense10 != null) files.Add(disk.SCSI.ModeSense10.Image); + if(disk.SCSI.EVPD != null) files.AddRange(disk.SCSI.EVPD.Select(evpd => evpd.Image)); + } + + if(disk.SecureDigital != null) + { + if(disk.SecureDigital.CID != null) files.Add(disk.SecureDigital.CID.Image); + if(disk.SecureDigital.CSD != null) files.Add(disk.SecureDigital.CSD.Image); + if(disk.MultiMediaCard.ExtendedCSD != null) files.Add(disk.MultiMediaCard.ExtendedCSD.Image); + } + + if(disk.TapeInformation != null) + files.AddRange(disk.TapeInformation.Select(tapePart => tapePart.Image.Value)); + if(disk.Track != null) files.AddRange(disk.Track.Select(track => track.Image.Value)); + if(disk.USB?.Descriptors != null) files.Add(disk.USB.Descriptors.Image); + + foreach(string file in files) + if(lstFilesForMedia.Contains(file)) + lstFilesForMedia.Remove(file); + } + + magazines = Metadata.Magazine; + books = Metadata.Book; + usermanuals = Metadata.UserManual; + adverts = Metadata.Advertisement; + linearmedias = Metadata.LinearMedia; + pcis = Metadata.PCICard; + audiomedias = Metadata.AudioMedia; + } + + protected void OnChkKnownReleaseTypeToggled(object sender, EventArgs e) + { + cmbReleaseType.Enabled = chkKnownReleaseType.Checked.Value; + } + + protected void OnChkReleaseDateToggled(object sender, EventArgs e) + { + cldReleaseDate.Enabled = !chkReleaseDate.Checked.Value; + } + + protected void OnBtnAddKeywordClicked(object sender, EventArgs e) + { + lstKeywords.Add(new StringEntry {str = txtNewKeyword.Text}); + txtNewKeyword.Text = ""; + } + + protected void OnBtnRemoveKeywordClicked(object sender, EventArgs e) + { + if(treeKeywords.SelectedItem != null) lstKeywords.Remove((StringEntry)treeKeywords.SelectedItem); + } + + protected void OnBtnClearKeywordsClicked(object sender, EventArgs e) + { + lstKeywords.Clear(); + } + + protected void OnBtnAddBarcodeClicked(object sender, EventArgs e) + { + if(string.IsNullOrEmpty(cmbBarcodes.Text)) return; + + lstBarcodes.Add(new BarcodeEntry + { + code = txtNewBarcode.Text, + type = (BarcodeTypeType)Enum.Parse(typeof(BarcodeTypeType), cmbBarcodes.Text) + }); + txtNewBarcode.Text = ""; + } + + protected void OnBtnClearBarcodesClicked(object sender, EventArgs e) + { + lstBarcodes.Clear(); + } + + protected void OnBtnRemoveBarcodeClicked(object sender, EventArgs e) + { + if(treeBarcodes.SelectedItem != null) lstBarcodes.Remove((BarcodeEntry)treeBarcodes.SelectedItem); + } + + protected void OnBtnAddCategoryClicked(object sender, EventArgs e) + { + lstCategories.Add(new StringEntry {str = txtNewCategory.Text}); + txtNewCategory.Text = ""; + } + + protected void OnBtnAddSubcategoryClicked(object sender, EventArgs e) + { + lstSubcategories.Add(new StringEntry {str = txtNewSubcategory.Text}); + txtNewSubcategory.Text = ""; + } + + protected void OnBtnRemoveSubcategoryClicked(object sender, EventArgs e) + { + if(treeSubcategories.SelectedItem != null) + lstSubcategories.Remove((StringEntry)treeSubcategories.SelectedItem); + } + + protected void OnBtnClearSubcategoriesClicked(object sender, EventArgs e) + { + lstSubcategories.Clear(); + } + + protected void OnBtnRemoveCategoryClicked(object sender, EventArgs e) + { + if(treeCategories.SelectedItem != null) lstCategories.Remove((StringEntry)treeCategories.SelectedItem); + } + + protected void OnBtnClearCategoriesClicked(object sender, EventArgs e) + { + lstCategories.Clear(); + } + + protected void OnBtnAddLanguageClicked(object sender, EventArgs e) + { + if(string.IsNullOrWhiteSpace(cmbLanguages.Text)) return; + + lstLanguages.Add(new StringEntry {str = cmbLanguages.Text}); + lstLanguageTypes.Remove(cmbLanguages.Text); + } + + protected void OnBtnRemoveLanguageClicked(object sender, EventArgs e) + { + if(treeLanguages.SelectedItem == null) return; + + lstLanguageTypes.Add(((StringEntry)treeLanguages.SelectedItem).str); + lstLanguages.Remove((StringEntry)treeLanguages.SelectedItem); + } + + protected void OnBtnClearLanguagesClicked(object sender, EventArgs e) + { + lstLanguages.Clear(); + FillLanguagesCombo(); + } + + protected void OnBtnAddNewOsClicked(object sender, EventArgs e) + { + if(string.IsNullOrWhiteSpace(txtNewOsName.Text)) + { + MessageBox.Show("Operating system name cannot be empty.", MessageBoxType.Error); + return; + } + + if(string.IsNullOrWhiteSpace(txtNewOsVersion.Text)) + { + MessageBox.Show("Operating system version cannot be empty.", MessageBoxType.Error); + return; + } + + lstOses.Add(new TargetOsEntry {name = txtNewOsName.Text, version = txtNewOsVersion.Text}); + txtNewOsName.Text = ""; + txtNewOsVersion.Text = ""; + } + + protected void OnBtnClearOsesClicked(object sender, EventArgs e) + { + lstOses.Clear(); + } + + protected void OnBtnRemoveOsClicked(object sender, EventArgs e) + { + if(treeOses.SelectedItem != null) lstOses.Remove((TargetOsEntry)treeOses.SelectedItem); + } + + protected void OnBtnAddArchitectureClicked(object sender, EventArgs e) + { + if(string.IsNullOrWhiteSpace(cmbArchitectures.Text)) return; + + lstArchitectures.Add(new StringEntry {str = cmbArchitectures.Text}); + lstArchitecturesTypes.Remove(cmbArchitectures.Text); + } + + protected void OnBtnClearArchitecturesClicked(object sender, EventArgs e) + { + lstArchitectures.Clear(); + FillArchitecturesCombo(); + } + + protected void OnBtnRemoveArchitectureClicked(object sender, EventArgs e) + { + if(treeArchitectures.SelectedItem == null) return; + + lstArchitecturesTypes.Add(((StringEntry)treeArchitectures.SelectedItem).str); + lstArchitectures.Remove((StringEntry)treeArchitectures.SelectedItem); + } + + protected void OnBtnAddDiscClicked(object sender, EventArgs e) + { + Context.SelectedFile = cmbFilesForNewDisc.Text; + tabGeneral.Visible = false; + tabKeywords.Visible = false; + tabBarcodes.Visible = false; + tabCategories.Visible = false; + tabLanguages.Visible = false; + tabTargetOs.Visible = false; + tabArchitectures.Visible = false; + tabDisks.Visible = false; + prgAddDisc1.Visible = true; + prgAddDisc2.Visible = true; + lblAddDisc1.Visible = true; + lblAddDisc2.Visible = true; + btnCancel.Visible = false; + btnOK.Visible = false; + btnEditDisc.Visible = false; + btnClearDiscs.Visible = false; + Workers.Failed += OnDiscAddFailed; + Workers.Finished += OnDiscAddFinished; + Workers.UpdateProgress += UpdateDiscProgress1; + Workers.UpdateProgress2 += UpdateDiscProgress2; + Context.WorkingDisc = null; + btnStopAddDisc.Visible = true; + btnAddDisc.Visible = false; + btnRemoveDisc.Visible = false; + thdDisc = new Thread(Workers.AddMedia); + thdDisc.Start(); + } + + protected void OnBtnStopAddDiscClicked(object sender, EventArgs e) + { + thdDisc?.Abort(); + stopped = true; + OnDiscAddFailed(null); + } + + void UpdateDiscProgress1(string text, string inner, long current, long maximum) + { + Application.Instance.Invoke(delegate + { + lblAddDisc1.Text = !string.IsNullOrWhiteSpace(inner) ? inner : text; + if(maximum > 0) + { + if(current < int.MinValue || current > int.MaxValue || maximum < int.MinValue || + maximum > int.MaxValue) + { + current /= 100; + maximum /= 100; + } + + prgAddDisc1.Indeterminate = false; + prgAddDisc1.MinValue = 0; + prgAddDisc1.MaxValue = (int)maximum; + prgAddDisc1.Value = (int)current; + } + else prgAddDisc1.Indeterminate = true; + }); + } + + void UpdateDiscProgress2(string text, string inner, long current, long maximum) + { + Application.Instance.Invoke(delegate + { + lblAddDisc2.Text = !string.IsNullOrWhiteSpace(inner) ? inner : text; + if(maximum > 0) + { + if(current < int.MinValue || current > int.MaxValue || maximum < int.MinValue || + maximum > int.MaxValue) + { + current /= 100; + maximum /= 100; + } + + prgAddDisc2.Indeterminate = false; + prgAddDisc2.MinValue = 0; + prgAddDisc2.MaxValue = (int)maximum; + prgAddDisc2.Value = (int)current; + } + else prgAddDisc2.Indeterminate = true; + }); + } + + void OnDiscAddFailed(string text) + { + Application.Instance.Invoke(delegate + { + if(!stopped) MessageBox.Show(text, MessageBoxType.Error); + Context.SelectedFile = ""; + tabGeneral.Visible = true; + tabKeywords.Visible = true; + tabBarcodes.Visible = true; + tabCategories.Visible = true; + tabLanguages.Visible = true; + tabTargetOs.Visible = true; + tabArchitectures.Visible = true; + tabDisks.Visible = true; + prgAddDisc1.Visible = false; + prgAddDisc2.Visible = false; + lblAddDisc1.Visible = false; + lblAddDisc2.Visible = false; + btnCancel.Visible = true; + btnOK.Visible = true; + btnEditDisc.Visible = true; + btnClearDiscs.Visible = true; + Workers.Failed -= OnDiscAddFailed; + Workers.Finished -= OnDiscAddFinished; + Workers.UpdateProgress -= UpdateDiscProgress1; + Workers.UpdateProgress2 -= UpdateDiscProgress2; + Context.WorkingDisc = null; + btnStopAddDisc.Visible = false; + btnAddDisc.Visible = true; + btnRemoveDisc.Visible = true; + thdDisc = null; + }); + } + + void OnDiscAddFinished() + { + Application.Instance.Invoke(delegate + { + if(Context.WorkingDisc == null) return; + + OpticalDiscType disc = Context.WorkingDisc; + + lstDiscs.Add(new DiscEntry {path = Context.SelectedFile, disc = disc}); + List files = new List {disc.Image.Value}; + if(disc.ADIP != null) files.Add(disc.ADIP.Image); + if(disc.ATIP != null) files.Add(disc.ATIP.Image); + if(disc.BCA != null) files.Add(disc.BCA.Image); + if(disc.CMI != null) files.Add(disc.CMI.Image); + if(disc.DCB != null) files.Add(disc.DCB.Image); + if(disc.DDS != null) files.Add(disc.DDS.Image); + if(disc.DMI != null) files.Add(disc.DMI.Image); + if(disc.LastRMD != null) files.Add(disc.LastRMD.Image); + if(disc.LeadIn != null) files.AddRange(disc.LeadIn.Select(border => border.Image)); + if(disc.LeadInCdText != null) files.Add(disc.LeadInCdText.Image); + if(disc.LeadOut != null) files.AddRange(disc.LeadOut.Select(border => border.Image)); + if(disc.MediaID != null) files.Add(disc.MediaID.Image); + if(disc.PAC != null) files.Add(disc.PAC.Image); + if(disc.PFI != null) files.Add(disc.PFI.Image); + if(disc.PFIR != null) files.Add(disc.PFIR.Image); + if(disc.PMA != null) files.Add(disc.PMA.Image); + if(disc.PRI != null) files.Add(disc.PRI.Image); + if(disc.SAI != null) files.Add(disc.SAI.Image); + if(disc.TOC != null) files.Add(disc.TOC.Image); + if(disc.Track != null) files.AddRange(disc.Track.Select(track => track.Image.Value)); + + foreach(string file in files) lstFilesForMedia.Remove(file); + + Context.SelectedFile = ""; + tabGeneral.Visible = true; + tabKeywords.Visible = true; + tabBarcodes.Visible = true; + tabCategories.Visible = true; + tabLanguages.Visible = true; + tabTargetOs.Visible = true; + tabArchitectures.Visible = true; + tabDisks.Visible = true; + prgAddDisc1.Visible = false; + prgAddDisc2.Visible = false; + lblAddDisc1.Visible = false; + lblAddDisc2.Visible = false; + btnCancel.Visible = true; + btnOK.Visible = true; + btnEditDisc.Visible = true; + btnClearDiscs.Visible = true; + Workers.Failed -= OnDiscAddFailed; + Workers.Finished -= OnDiscAddFinished; + Workers.UpdateProgress -= UpdateDiscProgress1; + Workers.UpdateProgress2 -= UpdateDiscProgress2; + Context.WorkingDisc = null; + btnStopAddDisc.Visible = false; + btnAddDisc.Visible = true; + btnRemoveDisc.Visible = true; + thdDisc = null; + }); + } + + protected void OnBtnClearDiscsClicked(object sender, EventArgs e) + { + lstDiscs.Clear(); + // TODO: Don't add files that are in disks + FillFilesCombos(); + } + + protected void OnBtnRemoveDiscClicked(object sender, EventArgs e) + { + if(treeDiscs.SelectedItem == null) return; + + lstFilesForMedia.Add(((DiscEntry)treeDiscs.SelectedItem).path); + lstDiscs.Remove((DiscEntry)treeDiscs.SelectedItem); + } + + protected void OnBtnAddDiskClicked(object sender, EventArgs e) + { + Context.SelectedFile = cmbFilesForNewDisk.Text; + tabGeneral.Visible = false; + tabKeywords.Visible = false; + tabBarcodes.Visible = false; + tabCategories.Visible = false; + tabLanguages.Visible = false; + tabTargetOs.Visible = false; + tabArchitectures.Visible = false; + tabDiscs.Visible = false; + prgAddDisk1.Visible = true; + prgAddDisk2.Visible = true; + lblAddDisk1.Visible = true; + lblAddDisk2.Visible = true; + btnCancel.Visible = false; + btnOK.Visible = false; + btnEditDisk.Visible = false; + btnClearDisks.Visible = false; + Workers.Failed += OnDiskAddFailed; + Workers.Finished += OnDiskAddFinished; + Workers.UpdateProgress += UpdateDiskProgress1; + Workers.UpdateProgress2 += UpdateDiskProgress2; + Context.WorkingDisk = null; + btnStopAddDisk.Visible = true; + btnAddDisk.Visible = false; + btnRemoveDisk.Visible = false; + thdDisk = new Thread(Workers.AddMedia); + thdDisk.Start(); + } + + protected void OnBtnStopAddDiskClicked(object sender, EventArgs e) + { + thdDisk?.Abort(); + stopped = true; + OnDiskAddFailed(null); + } + + void UpdateDiskProgress1(string text, string inner, long current, long maximum) + { + Application.Instance.Invoke(delegate + { + lblAddDisk1.Text = !string.IsNullOrWhiteSpace(inner) ? inner : text; + if(maximum > 0) + { + if(current < int.MinValue || current > int.MaxValue || maximum < int.MinValue || + maximum > int.MaxValue) + { + current /= 100; + maximum /= 100; + } + + prgAddDisk1.Indeterminate = false; + prgAddDisk1.MinValue = 0; + prgAddDisk1.MaxValue = (int)maximum; + prgAddDisk1.Value = (int)current; + } + else prgAddDisk1.Indeterminate = true; + }); + } + + void UpdateDiskProgress2(string text, string inner, long current, long maximum) + { + Application.Instance.Invoke(delegate + { + lblAddDisk2.Text = !string.IsNullOrWhiteSpace(inner) ? inner : text; + if(maximum > 0) + { + if(current < int.MinValue || current > int.MaxValue || maximum < int.MinValue || + maximum > int.MaxValue) + { + current /= 100; + maximum /= 100; + } + + prgAddDisk2.Indeterminate = false; + prgAddDisk2.MinValue = 0; + prgAddDisk2.MaxValue = (int)maximum; + prgAddDisk2.Value = (int)current; + } + else prgAddDisk2.Indeterminate = true; + }); + } + + void OnDiskAddFailed(string text) + { + Application.Instance.Invoke(delegate + { + if(!stopped) MessageBox.Show(text, MessageBoxType.Error); + Context.SelectedFile = ""; + tabGeneral.Visible = true; + tabKeywords.Visible = true; + tabBarcodes.Visible = true; + tabCategories.Visible = true; + tabLanguages.Visible = true; + tabTargetOs.Visible = true; + tabArchitectures.Visible = true; + tabDiscs.Visible = true; + prgAddDisk1.Visible = false; + prgAddDisk2.Visible = false; + lblAddDisk1.Visible = false; + lblAddDisk2.Visible = false; + btnCancel.Visible = true; + btnOK.Visible = true; + btnEditDisk.Visible = true; + btnClearDisks.Visible = true; + Workers.Failed -= OnDiskAddFailed; + Workers.Finished -= OnDiskAddFinished; + Workers.UpdateProgress -= UpdateDiskProgress1; + Workers.UpdateProgress2 -= UpdateDiskProgress2; + Context.WorkingDisk = null; + btnStopAddDisk.Visible = false; + btnAddDisk.Visible = true; + btnRemoveDisk.Visible = true; + thdDisk = null; + }); + } + + void OnDiskAddFinished() + { + Application.Instance.Invoke(delegate + { + if(Context.WorkingDisk == null) return; + + BlockMediaType disk = Context.WorkingDisk; + + lstDisks.Add(new DiskEntry {path = disk.Image.Value, disk = disk}); + List files = new List {disk.Image.Value}; + if(disk.ATA?.Identify != null) files.Add(disk.ATA.Identify.Image); + if(disk.MAM != null) files.Add(disk.MAM.Image); + if(disk.PCI?.ExpansionROM != null) files.Add(disk.PCI.ExpansionROM.Image.Value); + if(disk.PCMCIA?.CIS != null) files.Add(disk.PCMCIA.CIS.Image); + if(disk.SCSI != null) + { + if(disk.SCSI.Inquiry != null) files.Add(disk.SCSI.Inquiry.Image); + if(disk.SCSI.LogSense != null) files.Add(disk.SCSI.LogSense.Image); + if(disk.SCSI.ModeSense != null) files.Add(disk.SCSI.ModeSense.Image); + if(disk.SCSI.ModeSense10 != null) files.Add(disk.SCSI.ModeSense10.Image); + if(disk.SCSI.EVPD != null) files.AddRange(disk.SCSI.EVPD.Select(evpd => evpd.Image)); + } + + if(disk.SecureDigital != null) + { + if(disk.SecureDigital.CID != null) files.Add(disk.SecureDigital.CID.Image); + if(disk.SecureDigital.CSD != null) files.Add(disk.SecureDigital.CSD.Image); + if(disk.MultiMediaCard.ExtendedCSD != null) files.Add(disk.MultiMediaCard.ExtendedCSD.Image); + } + + if(disk.TapeInformation != null) + files.AddRange(disk.TapeInformation.Select(tapePart => tapePart.Image.Value)); + if(disk.Track != null) files.AddRange(disk.Track.Select(track => track.Image.Value)); + if(disk.USB?.Descriptors != null) files.Add(disk.USB.Descriptors.Image); + + foreach(string file in files) lstFilesForMedia.Remove(file); + + Context.SelectedFile = ""; + tabGeneral.Visible = true; + tabKeywords.Visible = true; + tabBarcodes.Visible = true; + tabCategories.Visible = true; + tabLanguages.Visible = true; + tabTargetOs.Visible = true; + tabArchitectures.Visible = true; + tabDiscs.Visible = true; + prgAddDisk1.Visible = false; + prgAddDisk2.Visible = false; + lblAddDisk1.Visible = false; + lblAddDisk2.Visible = false; + btnCancel.Visible = true; + btnOK.Visible = true; + btnEditDisk.Visible = true; + btnClearDisks.Visible = true; + Workers.Failed -= OnDiskAddFailed; + Workers.Finished -= OnDiskAddFinished; + Workers.UpdateProgress -= UpdateDiskProgress1; + Workers.UpdateProgress2 -= UpdateDiskProgress2; + Context.WorkingDisk = null; + btnStopAddDisk.Visible = false; + btnAddDisk.Visible = true; + btnRemoveDisk.Visible = true; + thdDisk = null; + }); + } + + protected void OnBtnClearDisksClicked(object sender, EventArgs e) + { + lstDisks.Clear(); + // TODO: Don't add files that are discs + FillFilesCombos(); + } + + protected void OnBtnRemoveDiskClicked(object sender, EventArgs e) + { + if(treeDisks.SelectedItem == null) return; + + lstFilesForMedia.Add(((DiskEntry)treeDisks.SelectedItem).path); + lstDisks.Remove((DiskEntry)treeDisks.SelectedItem); + } + + protected void OnBtnCancelClicked(object sender, EventArgs e) + { + Modified = false; + Close(); + } + + protected void OnBtnOKClicked(object sender, EventArgs e) + { + Metadata = new CICMMetadataType(); + List architectures = new List(); + List barcodes = new List(); + List disks = new List(); + List categories = new List(); + List keywords = new List(); + List languages = new List(); + List discs = new List(); + List subcategories = new List(); + List systems = new List(); + + if(!string.IsNullOrEmpty(txtAuthor.Text)) Metadata.Author = txtAuthor.Text.Split(','); + if(!string.IsNullOrEmpty(txtDeveloper.Text)) Metadata.Developer = txtDeveloper.Text.Split(','); + if(!string.IsNullOrEmpty(txtName.Text)) Metadata.Name = txtName.Text; + if(!string.IsNullOrEmpty(txtPartNumber.Text)) Metadata.PartNumber = txtPartNumber.Text; + if(!string.IsNullOrEmpty(txtPerformer.Text)) Metadata.Performer = txtPerformer.Text.Split(','); + if(!string.IsNullOrEmpty(txtPublisher.Text)) Metadata.Publisher = txtPublisher.Text.Split(','); + if(!string.IsNullOrEmpty(txtSerialNumber.Text)) Metadata.SerialNumber = txtSerialNumber.Text; + if(!string.IsNullOrEmpty(txtVersion.Text)) Metadata.Version = txtVersion.Text; + if(!chkReleaseDate.Checked.Value) + { + Metadata.ReleaseDate = cldReleaseDate.Value.Value; + Metadata.ReleaseDateSpecified = true; + } + + if(chkKnownReleaseType.Checked.Value) + { + Metadata.ReleaseType = cmbReleaseType.SelectedValue; + Metadata.ReleaseTypeSpecified = true; + } + + foreach(StringEntry entry in lstArchitectures) + architectures.Add((ArchitecturesTypeArchitecture)Enum.Parse(typeof(ArchitecturesTypeArchitecture), + entry.str)); + + foreach(BarcodeEntry entry in lstBarcodes) + { + BarcodeType barcode = new BarcodeType {type = entry.type, Value = entry.code}; + barcodes.Add(barcode); + } + + foreach(DiskEntry entry in lstDisks) disks.Add(entry.disk); + + foreach(StringEntry entry in lstCategories) categories.Add(entry.str); + + foreach(StringEntry entry in lstKeywords) keywords.Add(entry.str); + + foreach(StringEntry entry in lstLanguages) + languages.Add((LanguagesTypeLanguage)Enum.Parse(typeof(LanguagesTypeLanguage), entry.str)); + + foreach(DiscEntry entry in lstDiscs) discs.Add(entry.disc); + + foreach(StringEntry entry in lstSubcategories) subcategories.Add(entry.str); + + if(lstOses.Count > 0) + { + Dictionary> osesDict = new Dictionary>(); + foreach(TargetOsEntry entry in lstOses.OrderBy(t => t.name).ThenBy(t => t.version)) + { + osesDict.TryGetValue(entry.name, out List versList); + + if(versList == null) versList = new List(); + + if(versList.Contains(entry.version)) continue; + + versList.Add(entry.version); + versList.Sort(); + osesDict.Remove(entry.name); + osesDict.Add(entry.name, versList); + } + + Metadata.RequiredOperatingSystems = osesDict + .OrderBy(t => t.Key) + .Select(entry => new RequiredOperatingSystemType + { + Name = entry.Key, + Version = entry.Value.ToArray() + }).ToArray(); + } + + if(architectures.Count > 0) Metadata.Architectures = architectures.ToArray(); + if(barcodes.Count > 0) Metadata.Barcodes = barcodes.ToArray(); + if(disks.Count > 0) Metadata.BlockMedia = disks.ToArray(); + if(categories.Count > 0) Metadata.Categories = categories.ToArray(); + if(keywords.Count > 0) Metadata.Keywords = keywords.ToArray(); + if(languages.Count > 0) Metadata.Languages = languages.ToArray(); + if(discs.Count > 0) Metadata.OpticalDisc = discs.ToArray(); + if(subcategories.Count > 0) Metadata.Subcategories = subcategories.ToArray(); + if(systems.Count > 0) Metadata.Systems = systems.ToArray(); + + Metadata.Magazine = magazines; + Metadata.Book = books; + Metadata.UserManual = usermanuals; + Metadata.Advertisement = adverts; + Metadata.LinearMedia = linearmedias; + Metadata.PCICard = pcis; + Metadata.AudioMedia = audiomedias; + + Modified = true; + Close(); + } + + protected void OnBtnEditDiscClicked(object sender, EventArgs e) + { + if(treeDiscs.SelectedItem == null) return; + + dlgOpticalDisc _dlgOpticalDisc = new dlgOpticalDisc + { + Title = $"Editing disc metadata for {((DiscEntry)treeDiscs.SelectedItem).path}", + Metadata = ((DiscEntry)treeDiscs.SelectedItem).disc + }; + _dlgOpticalDisc.FillFields(); + _dlgOpticalDisc.ShowModal(this); + + if(!_dlgOpticalDisc.Modified) return; + + lstDiscs.Remove((DiscEntry)treeDiscs.SelectedItem); + lstDiscs.Add(new DiscEntry {path = _dlgOpticalDisc.Metadata.Image.Value, disc = _dlgOpticalDisc.Metadata}); + } + + protected void OnBtnEditDiskClicked(object sender, EventArgs e) + { + if(treeDisks.SelectedItem == null) return; + + dlgBlockMedia _dlgBlockMedia = new dlgBlockMedia + { + Title = $"Editing disk metadata for {((DiskEntry)treeDisks.SelectedItem).path}", + Metadata = ((DiskEntry)treeDisks.SelectedItem).disk + }; + _dlgBlockMedia.FillFields(); + _dlgBlockMedia.ShowModal(this); + + if(!_dlgBlockMedia.Modified) return; + + lstDisks.Remove((DiskEntry)treeDisks.SelectedItem); + lstDisks.Add(new DiskEntry {path = _dlgBlockMedia.Metadata.Image.Value, disk = _dlgBlockMedia.Metadata}); + } + + #region XAML UI elements + #pragma warning disable 0649 + TabPage tabGeneral; + TextBox txtDeveloper; + TextBox txtPublisher; + TextBox txtAuthor; + TextBox txtPerformer; + TextBox txtName; + TextBox txtVersion; + StackLayout stkReleaseType; + CheckBox chkKnownReleaseType; + EnumDropDown cmbReleaseType; + DateTimePicker cldReleaseDate; + CheckBox chkReleaseDate; + TextBox txtPartNumber; + TextBox txtSerialNumber; + TabPage tabKeywords; + TextBox txtNewKeyword; + GridView treeKeywords; + TabPage tabBarcodes; + TextBox txtNewBarcode; + ComboBox cmbBarcodes; + GridView treeBarcodes; + TabPage tabCategories; + TextBox txtNewCategory; + GridView treeCategories; + TextBox txtNewSubcategory; + GridView treeSubcategories; + TabPage tabLanguages; + ComboBox cmbLanguages; + GridView treeLanguages; + TabPage tabTargetOs; + TextBox txtNewOsName; + TextBox txtNewOsVersion; + GridView treeOses; + TabPage tabArchitectures; + ComboBox cmbArchitectures; + GridView treeArchitectures; + TabPage tabDiscs; + ComboBox cmbFilesForNewDisc; + Button btnAddDisc; + GridView treeDiscs; + Button btnStopAddDisc; + Button btnEditDisc; + Button btnClearDiscs; + Button btnRemoveDisc; + Label lblAddDisc1; + ProgressBar prgAddDisc1; + Label lblAddDisc2; + ProgressBar prgAddDisc2; + TabPage tabDisks; + ComboBox cmbFilesForNewDisk; + Button btnAddDisk; + GridView treeDisks; + Button btnStopAddDisk; + Button btnEditDisk; + Button btnClearDisks; + Button btnRemoveDisk; + Label lblAddDisk1; + ProgressBar prgAddDisk1; + Label lblAddDisk2; + ProgressBar prgAddDisk2; + Button btnCancel; + Button btnOK; + #pragma warning restore 0649 + #endregion XAML UI elements + } +} \ No newline at end of file diff --git a/dlgOpticalDisc.xeto b/dlgOpticalDisc.xeto new file mode 100644 index 0000000..6cf3db5 --- /dev/null +++ b/dlgOpticalDisc.xeto @@ -0,0 +1,696 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sequenced + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Known dimensions + + + Round? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Has layers? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Known dumping hardware + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dlgOpticalDisc.xeto.cs b/dlgOpticalDisc.xeto.cs new file mode 100644 index 0000000..5289280 --- /dev/null +++ b/dlgOpticalDisc.xeto.cs @@ -0,0 +1,1977 @@ +// +// Author: +// Natalia Portillo claunia@claunia.com +// +// Copyright (c) 2017, © Claunia.com +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in +// the documentation and/or other materials provided with the distribution. +// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// + +using System; +using System.Collections.ObjectModel; +using System.Linq; +using Eto.Forms; +using Eto.Serialization.Xaml; +using Schemas; +using BorderType = Schemas.BorderType; + +namespace apprepodbmgr.Eto +{ + public class dlgOpticalDisc : Dialog + { + // Non-editable fields + ChecksumType[] checksums; + DumpHardwareType dumpHwIter; + bool editingDumpHw; + + bool editingPartition; + FileSystemType filesystemIter; + ObservableCollection lstADIP; + ObservableCollection lstATIP; + ObservableCollection lstBCA; + ObservableCollection lstCDText; + ObservableCollection lstCMI; + ObservableCollection lstDCB; + ObservableCollection lstDDS; + ObservableCollection lstDI; + ObservableCollection lstDMI; + + ObservableCollection lstDumpHw; + ObservableCollection lstLastRMD; + ObservableCollection lstLayers; + ObservableCollection lstLeadIns; + ObservableCollection lstLeadOuts; + ObservableCollection lstMasteringSIDs; + ObservableCollection lstMediaID; + ObservableCollection lstMouldSIDs; + ObservableCollection lstMouldTexts; + ObservableCollection lstPAC; + ObservableCollection lstPFI; + ObservableCollection lstPFIR; + ObservableCollection lstPMA; + ObservableCollection lstPRI; + ObservableCollection lstRingCodes; + ObservableCollection lstSAI; + ObservableCollection lstTOC; + ObservableCollection lstToolstamps; + ObservableCollection lstTracks; + CaseType mediaCase; + public OpticalDiscType Metadata; + public bool Modified; + PartitionType partitionIter; + ScansType scans; + + TrackType trackIter; + XboxType xbox; + + public dlgOpticalDisc() + { + XamlReader.Load(this); + + Modified = false; + + #region Set partitions table + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Sequence).Convert(v => v.ToString()) + }, + HeaderText = "Sequence" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.StartSector).Convert(v => v.ToString()) + }, + HeaderText = "Start" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.EndSector).Convert(v => v.ToString()) + }, + HeaderText = "End" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Type)}, + HeaderText = "Type" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Name)}, + HeaderText = "Name" + }); + treePartitions.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Description)}, + HeaderText = "Description" + }); + + treePartitions.AllowMultipleSelection = false; + #endregion Set partitions table + + #region Set filesystems table + treeFilesystems.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Type)}, + HeaderText = "Type" + }); + treeFilesystems.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.VolumeName)}, + HeaderText = "Name" + }); + + treeFilesystems.AllowMultipleSelection = false; + #endregion Set filesystems table + + #region Set dump hardware table + lstDumpHw = new ObservableCollection(); + + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = + new TextBoxCell {Binding = Binding.Property(r => r.Manufacturer)}, + HeaderText = "Manufacturer" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Model)}, + HeaderText = "Model" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Revision)}, + HeaderText = "Revision" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Firmware)}, + HeaderText = "Firmware" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Serial)}, + HeaderText = "Serial" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Software).Convert(v => v?.Name) + }, + HeaderText = "Software" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Software).Convert(v => v?.Version) + }, + HeaderText = "Version" + }); + treeDumpHardware.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Software) + .Convert(v => v?.OperatingSystem) + }, + HeaderText = "Operating system" + }); + + treeDumpHardware.DataStore = lstDumpHw; + + treeDumpHardware.AllowMultipleSelection = false; + + treeExtents.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Start).Convert(v => v.ToString()) + }, + HeaderText = "Start" + }); + treeExtents.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.End).Convert(v => v.ToString()) + }, + HeaderText = "End" + }); + #endregion Set dump hardware table + + #region Set TOC table + lstTOC = new ObservableCollection(); + treeTOC.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeTOC.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeTOC.DataStore = lstTOC; + #endregion Set TOC table + + #region Set CD-Text table + lstCDText = new ObservableCollection(); + treeCDText.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeCDText.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeCDText.DataStore = lstCDText; + #endregion Set CD-Text table + + #region Set ATIP table + lstATIP = new ObservableCollection(); + treeATIP.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeATIP.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeATIP.DataStore = lstATIP; + #endregion Set ATIP table + + #region Set PMA table + lstPMA = new ObservableCollection(); + treePMA.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treePMA.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treePMA.DataStore = lstPMA; + #endregion Set PMA table + + #region Set PFI table + lstPFI = new ObservableCollection(); + treePFI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treePFI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treePFI.DataStore = lstPFI; + #endregion Set PFI table + + #region Set DMI table + lstDMI = new ObservableCollection(); + treeDMI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeDMI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeDMI.DataStore = lstDMI; + #endregion Set DMI table + + #region Set CMI table + lstCMI = new ObservableCollection(); + treeCMI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeCMI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeCMI.DataStore = lstCMI; + #endregion Set CMI table + + #region Set BCA table + lstBCA = new ObservableCollection(); + treeBCA.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeBCA.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeBCA.DataStore = lstBCA; + #endregion Set BCA table + + #region Set DCB table + lstDCB = new ObservableCollection(); + treeDCB.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeDCB.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeDCB.DataStore = lstDCB; + #endregion Set DCB table + + #region Set PRI table + lstPRI = new ObservableCollection(); + treePRI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treePRI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treePRI.DataStore = lstPRI; + #endregion Set PRI table + + #region Set MediaID table + lstMediaID = new ObservableCollection(); + treeMediaID.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeMediaID.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeMediaID.DataStore = lstMediaID; + #endregion Set MediaID table + + #region Set PFIR table + lstPFIR = new ObservableCollection(); + treePFIR.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treePFIR.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treePFIR.DataStore = lstPFIR; + #endregion Set PFIR table + + #region Set LastRMD table + lstLastRMD = new ObservableCollection(); + treeLastRMD.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeLastRMD.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeLastRMD.DataStore = lstLastRMD; + #endregion Set LastRMD table + + #region Set ADIP table + lstADIP = new ObservableCollection(); + treeADIP.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeADIP.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeADIP.DataStore = lstADIP; + #endregion Set ADIP table + + #region Set DDS table + lstDDS = new ObservableCollection(); + treeDDS.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeDDS.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeDDS.DataStore = lstDDS; + #endregion Set DDS table + + #region Set SAI table + lstSAI = new ObservableCollection(); + treeSAI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeSAI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeSAI.DataStore = lstSAI; + #endregion Set SAI table + + #region Set DI table + lstDI = new ObservableCollection(); + treeDI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeDI.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeDI.DataStore = lstDI; + #endregion Set DI table + + #region Set PAC table + lstPAC = new ObservableCollection(); + treePAC.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treePAC.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treePAC.DataStore = lstPAC; + #endregion Set PAC table + + #region Set ring code table + lstRingCodes = new ObservableCollection(); + treeRingCodes.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.layer).Convert(v => v.ToString()) + }, + HeaderText = "Layer" + }); + treeRingCodes.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Value)}, + HeaderText = "Code" + }); + treeRingCodes.DataStore = lstRingCodes; + #endregion Set ring code table + + #region Set mastering sid table + lstMasteringSIDs = new ObservableCollection(); + treeMasteringSIDs.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.layer).Convert(v => v.ToString()) + }, + HeaderText = "Layer" + }); + treeMasteringSIDs.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Value)}, + HeaderText = "Code" + }); + treeMasteringSIDs.DataStore = lstMasteringSIDs; + #endregion Set mastering sid table + + #region Set toolstamp table + lstToolstamps = new ObservableCollection(); + treeToolstamps.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.layer).Convert(v => v.ToString()) + }, + HeaderText = "Layer" + }); + treeToolstamps.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Value)}, + HeaderText = "Code" + }); + treeToolstamps.DataStore = lstToolstamps; + #endregion Set toolstamp table + + #region Set mould sid table + lstMouldSIDs = new ObservableCollection(); + treeMouldSIDs.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.layer).Convert(v => v.ToString()) + }, + HeaderText = "Layer" + }); + treeMouldSIDs.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Value)}, + HeaderText = "Code" + }); + treeMouldSIDs.DataStore = lstMouldSIDs; + #endregion Set mould sid table + + #region Set mould text table + lstMouldTexts = new ObservableCollection(); + treeMouldTexts.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.layer).Convert(v => v.ToString()) + }, + HeaderText = "Layer" + }); + treeMouldTexts.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Value)}, + HeaderText = "Code" + }); + treeMouldTexts.DataStore = lstMouldTexts; + #endregion Set mould text table + + #region Set layer type combo box + cmbLayerType = new EnumDropDown(); + stkLayers.Items.Add(new StackLayoutItem {Control = cmbLayerType}); + #endregion Set layer type combo box + + #region Set layers table + lstLayers = new ObservableCollection(); + + treeLayers.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.layer).Convert(v => v.ToString()) + }, + HeaderText = "Layer" + }); + treeLayers.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Value).Convert(v => v.ToString()) + }, + HeaderText = "Start" + }); + + treeLayers.DataStore = lstLayers; + + treeLayers.AllowMultipleSelection = false; + #endregion Set layers table + + #region Set Lead-In table + lstLeadIns = new ObservableCollection(); + treeLeadIn.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeLeadIn.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeLeadIn.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.session).Convert(v => v.ToString()) + }, + HeaderText = "Session" + }); + treeLeadIn.DataStore = lstLeadIns; + #endregion Set Lead-In table + + #region Set Lead-Out table + lstLeadOuts = new ObservableCollection(); + treeLeadOut.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image)}, + HeaderText = "File" + }); + treeLeadOut.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeLeadOut.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.session).Convert(v => v.ToString()) + }, + HeaderText = "Session" + }); + treeLeadOut.DataStore = lstLeadOuts; + #endregion Set Lead-Out table + + #region Set tracks table + lstTracks = new ObservableCollection(); + + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Sequence.TrackNumber).Convert(v => v.ToString()) + }, + HeaderText = "Track" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Sequence.Session).Convert(v => v.ToString()) + }, + HeaderText = "Session" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image.Value)}, + HeaderText = "File" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) + }, + HeaderText = "Size" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.Image.format)}, + HeaderText = "Format" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.Image.offset).Convert(v => v.ToString()) + }, + HeaderText = "Offset" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.StartMSF)}, + HeaderText = "MSF Start" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.EndMSF)}, + HeaderText = "MSF End" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.StartSector).Convert(v => v.ToString()) + }, + HeaderText = "LBA Start" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.EndSector).Convert(v => v.ToString()) + }, + HeaderText = "LBA End" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.TrackType1) + .Convert(v => v.ToString()) + }, + HeaderText = "Type" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell + { + Binding = Binding.Property(r => r.BytesPerSector).Convert(v => v.ToString()) + }, + HeaderText = "Bytes per sector" + }); + treeTracks.Columns.Add(new GridColumn + { + DataCell = new TextBoxCell {Binding = Binding.Property(r => r.AccoustID)}, + HeaderText = "Accoust ID" + }); + + treeTracks.DataStore = lstTracks; + + treeTracks.AllowMultipleSelection = false; + #endregion Set tracks table + + spExtentStart.MaxValue = double.MaxValue; + spExtentEnd.MaxValue = double.MaxValue; + + txtImage.ToolTip = "This is the disc image containing this media."; + txtFormat.ToolTip = "This is the format of the disc image."; + txtOffset.ToolTip = "Byte offset where the media dump starts in the disc image."; + txtSize.ToolTip = "Size of the disc dump."; + txtWriteOffset.ToolTip = "Write offset in bytes (can be negative)."; + txtMediaTracks.ToolTip = "How many tracks?"; + txtMediaSessions.ToolTip = "How many sessions?"; + txtCopyProtection.ToolTip = "Disc copy protection."; + txtDiscType.ToolTip = "Disc type."; + txtDiscSubtype.ToolTip = "Disc subtype."; + chkSequence.ToolTip = "If checked means this disc is one in a sequence of several."; + txtDiscTitle.ToolTip = "Title of disc."; + spSequence.ToolTip = "Number of this disc in the sequence."; + spTotalMedia.ToolTip = "How many diskc make the sequence."; + spSide.ToolTip = "On double sided discs, which side of the disc is represented by this dump."; + spLayer.ToolTip = "On PTP layered discs, which layer of the side of the disc is represented by this dump."; + chkDimensions.ToolTip = "If checked, physical dimensions of disk are known."; + chkRound.ToolTip = "If checked, disk is physicaly round."; + spDiameter.ToolTip = "Diameter in milimeters of disk."; + spHeight.ToolTip = "Height in milimeters of disk."; + spWidth.ToolTip = "Width in milimeters of disk."; + spThickness.ToolTip = "Thickness in milimeters of disk."; + } + + public void FillFields() + { + if(Metadata == null) return; + + txtImage.Text = Metadata.Image.Value; + txtFormat.Text = Metadata.Image.format; + if(Metadata.Image.offsetSpecified) txtOffset.Text = Metadata.Image.offset.ToString(); + txtSize.Text = Metadata.Size.ToString(); + if(Metadata.Sequence != null) + { + lblDiscTitle.Visible = true; + lblDiscTitle.Visible = true; + lblSequence.Visible = true; + spSequence.Visible = true; + lblTotalMedia.Visible = true; + spTotalMedia.Visible = true; + lblSide.Visible = true; + spSide.Visible = true; + lblLayer.Visible = true; + spLayer.Visible = true; + chkSequence.Checked = true; + txtDiscTitle.Text = Metadata.Sequence.MediaTitle; + spSequence.Value = Metadata.Sequence.MediaSequence; + spTotalMedia.Value = Metadata.Sequence.TotalMedia; + if(Metadata.Sequence.SideSpecified) spSide.Value = Metadata.Sequence.Side; + if(Metadata.Sequence.LayerSpecified) spLayer.Value = Metadata.Sequence.Layer; + } + + if(Metadata.Layers != null) + { + chkLayers.Checked = true; + frmLayers.Visible = true; + + cmbLayerType.SelectedValue = Metadata.Layers.type; + lstLayers = new ObservableCollection(Metadata.Layers.Sectors); + treeLayers.DataStore = lstLayers; + } + + checksums = Metadata.Checksums; + xbox = Metadata.Xbox; + + if(Metadata.RingCode != null) + { + lstRingCodes = new ObservableCollection(Metadata.RingCode); + treeRingCodes.DataStore = lstRingCodes; + } + + if(Metadata.MasteringSID != null) + { + lstMasteringSIDs = new ObservableCollection(Metadata.MasteringSID); + treeMasteringSIDs.DataStore = lstMasteringSIDs; + } + + if(Metadata.Toolstamp != null) + { + lstToolstamps = new ObservableCollection(Metadata.Toolstamp); + treeToolstamps.DataStore = lstToolstamps; + } + + if(Metadata.MouldSID != null) + { + lstMouldSIDs = new ObservableCollection(Metadata.MouldSID); + treeMouldSIDs.DataStore = lstMouldSIDs; + } + + if(Metadata.MouldText != null) + { + lstMouldTexts = new ObservableCollection(Metadata.MouldText); + treeMouldTexts.DataStore = lstMouldTexts; + } + + if(Metadata.DiscType != null) txtDiscType.Text = Metadata.DiscType; + if(Metadata.DiscSubType != null) txtDiscSubtype.Text = Metadata.DiscSubType; + if(Metadata.OffsetSpecified) txtWriteOffset.Text = Metadata.Offset.ToString(); + txtMediaTracks.Text = Metadata.Tracks[0].ToString(); + txtMediaSessions.Text = Metadata.Sessions.ToString(); + if(Metadata.CopyProtection != null) txtCopyProtection.Text = Metadata.CopyProtection; + + if(Metadata.Dimensions != null) + { + chkDimensions.Checked = true; + if(Metadata.Dimensions.DiameterSpecified) + { + chkRound.Checked = true; + stkDiameter.Visible = true; + spDiameter.Value = Metadata.Dimensions.Diameter; + } + else + { + stkHeight.Visible = true; + spHeight.Value = Metadata.Dimensions.Height; + stkWidth.Visible = true; + spWidth.Value = Metadata.Dimensions.Width; + } + + stkThickness.Visible = true; + spThickness.Value = Metadata.Dimensions.Thickness; + } + + mediaCase = Metadata.Case; + scans = Metadata.Scans; + + if(Metadata.PFI != null) + { + frmPFI.Visible = true; + lstPFI.Add(Metadata.PFI); + } + + if(Metadata.DMI != null) + { + frmDMI.Visible = true; + lstDMI.Add(Metadata.DMI); + } + + if(Metadata.CMI != null) + { + frmCMI.Visible = true; + lstCMI.Add(Metadata.CMI); + } + + if(Metadata.BCA != null) + { + frmBCA.Visible = true; + lstBCA.Add(Metadata.BCA); + } + + if(Metadata.ATIP != null) + { + frmATIP.Visible = true; + lstATIP.Add(Metadata.ATIP); + } + + if(Metadata.ADIP != null) + { + frmADIP.Visible = true; + lstADIP.Add(Metadata.ADIP); + } + + if(Metadata.PMA != null) + { + frmPMA.Visible = true; + lstPMA.Add(Metadata.PMA); + } + + if(Metadata.DDS != null) + { + frmDDS.Visible = true; + lstDDS.Add(Metadata.DDS); + } + + if(Metadata.SAI != null) + { + frmSAI.Visible = true; + lstSAI.Add(Metadata.SAI); + } + + if(Metadata.LastRMD != null) + { + frmLastRMD.Visible = true; + lstLastRMD.Add(Metadata.LastRMD); + } + + if(Metadata.PRI != null) + { + frmPRI.Visible = true; + lstPRI.Add(Metadata.PRI); + } + + if(Metadata.MediaID != null) + { + frmMediaID.Visible = true; + lstMediaID.Add(Metadata.MediaID); + } + + if(Metadata.PFIR != null) + { + frmPFIR.Visible = true; + lstPFIR.Add(Metadata.PFIR); + } + + if(Metadata.DCB != null) + { + frmDCB.Visible = true; + lstDCB.Add(Metadata.DCB); + } + + if(Metadata.DI != null) + { + frmDI.Visible = true; + lstDI.Add(Metadata.DI); + } + + if(Metadata.PAC != null) + { + frmPAC.Visible = true; + lstPAC.Add(Metadata.PAC); + } + + if(Metadata.TOC != null) + { + frmTOC.Visible = true; + lstTOC.Add(Metadata.TOC); + } + + if(Metadata.LeadInCdText != null) + { + frmCDText.Visible = true; + lstCDText.Add(Metadata.LeadInCdText); + } + + if(Metadata.LeadIn != null) + { + frmLeadIns.Visible = true; + lstLeadIns = new ObservableCollection(Metadata.LeadIn); + treeLeadIn.DataStore = lstLeadIns; + } + + if(Metadata.LeadOut != null) + { + frmLeadOuts.Visible = true; + lstLeadOuts = new ObservableCollection(Metadata.LeadOut); + treeLeadOut.DataStore = lstLeadOuts; + } + + if(Metadata.PS3Encryption != null) + { + txtPS3Key.Text = Metadata.PS3Encryption.Key; + txtPS3Serial.Text = Metadata.PS3Encryption.Serial; + } + + lstTracks = new ObservableCollection(Metadata.Track); + treeTracks.DataStore = lstTracks; + + if(Metadata.DumpHardwareArray != null) + { + chkDumpHardware.Checked = true; + treeDumpHardware.Visible = true; + btnAddHardware.Visible = true; + btnEditHardware.Visible = true; + btnRemoveHardware.Visible = true; + + lstDumpHw = new ObservableCollection(Metadata.DumpHardwareArray); + treeDumpHardware.DataStore = lstDumpHw; + } + } + + protected void OnChkSequenceToggled(object sender, EventArgs e) + { + lblDiscTitle.Visible = chkSequence.Checked.Value; + txtDiscTitle.Visible = chkSequence.Checked.Value; + lblSequence.Visible = chkSequence.Checked.Value; + spSequence.Visible = chkSequence.Checked.Value; + lblTotalMedia.Visible = chkSequence.Checked.Value; + spTotalMedia.Visible = chkSequence.Checked.Value; + lblSide.Visible = chkSequence.Checked.Value; + spSide.Visible = chkSequence.Checked.Value; + lblLayer.Visible = chkSequence.Checked.Value; + spLayer.Visible = chkSequence.Checked.Value; + } + + protected void OnChkDimensionsToggled(object sender, EventArgs e) + { + chkRound.Visible = chkDimensions.Checked.Value; + stkThickness.Visible = chkDimensions.Checked.Value; + if(chkDimensions.Checked.Value) OnChkRoundToggled(sender, e); + else + { + stkDiameter.Visible = false; + stkHeight.Visible = false; + stkWidth.Visible = false; + } + } + + void OnChkRoundToggled(object sender, EventArgs e) + { + stkDiameter.Visible = chkRound.Checked.Value; + stkHeight.Visible = !chkRound.Checked.Value; + stkWidth.Visible = !chkRound.Checked.Value; + } + + protected void OnChkLayersToggled(object sender, EventArgs e) + { + frmLayers.Visible = chkLayers.Checked.Value; + } + + static void ErrorMessageBox(string text) + { + MessageBox.Show(text, MessageBoxType.Error); + } + + protected void OnBtnAddLayerClicked(object sender, EventArgs e) + { + if(string.IsNullOrWhiteSpace(txtLayerSize.Text)) ErrorMessageBox("Layer size must not be empty"); + + if(!long.TryParse(txtLayerSize.Text, out long ltmp)) ErrorMessageBox("Layer size must be a number"); + + if(ltmp < 0) ErrorMessageBox("Layer size must be a positive"); + + if(ltmp == 0) ErrorMessageBox("Layer size must be bigger than 0"); + + lstLayers.Add(new SectorsType + { + layer = (int)spNewLayer.Value, + layerSpecified = true, + Value = long.Parse(txtLayerSize.Text) + }); + } + + protected void OnBtnRemoveLayerClicked(object sender, EventArgs e) + { + if(treeLayers.SelectedItem != null) lstLayers.Remove((SectorsType)treeLayers.SelectedItem); + } + + protected void OnBtnRemovePartitionClicked(object sender, EventArgs e) + { + if(treePartitions.SelectedItem != null) + ((ObservableCollection)treePartitions.DataStore).Remove((PartitionType)treePartitions + .SelectedItem); + } + + protected void OnBtnEditPartitionClicked(object sender, EventArgs e) + { + if(treePartitions.SelectedItem == null) return; + + partitionIter = (PartitionType)treePartitions.SelectedItem; + + spPartitionSequence.Value = partitionIter.Sequence; + txtPartitionStart.Text = partitionIter.StartSector.ToString(); + txtPartitionEnd.Text = partitionIter.EndSector.ToString(); + txtPartitionType.Text = partitionIter.Type; + txtPartitionName.Text = partitionIter.Name; + txtPartitionDescription.Text = partitionIter.Description; + treeFilesystems.DataStore = partitionIter.FileSystems != null + ? new ObservableCollection(partitionIter.FileSystems) + : new ObservableCollection(); + btnCancelPartition.Visible = true; + btnApplyPartition.Visible = true; + btnRemovePartition.Visible = false; + btnEditPartition.Visible = false; + btnAddPartition.Visible = false; + stkPartitionFields1.Visible = true; + stkPartitionFields2.Visible = true; + frmFilesystems.Visible = true; + + editingPartition = true; + } + + protected void OnBtnApplyPartitionClicked(object sender, EventArgs e) + { + if(!int.TryParse(txtPartitionStart.Text, out int temp)) + { + ErrorMessageBox("Partition start must be a number"); + return; + } + + if(!int.TryParse(txtPartitionEnd.Text, out int temp2)) + { + ErrorMessageBox("Partition end must be a number"); + return; + } + + if(temp2 <= temp) + { + ErrorMessageBox("Partition must end after start, and be bigger than 1 sector"); + return; + } + + if(editingPartition) ((ObservableCollection)treePartitions.DataStore).Remove(partitionIter); + partitionIter = new PartitionType + { + Sequence = (int)spPartitionSequence.Value, + StartSector = int.Parse(txtPartitionStart.Text), + EndSector = int.Parse(txtPartitionEnd.Text), + Type = txtPartitionType.Text, + Name = txtPartitionName.Text, + Description = txtPartitionDescription.Text + }; + if(((ObservableCollection)treeFilesystems.DataStore).Count > 0) + partitionIter.FileSystems = ((ObservableCollection)treeFilesystems.DataStore).ToArray(); + + ((ObservableCollection)treePartitions.DataStore).Add(partitionIter); + btnCancelPartition.Visible = false; + btnApplyPartition.Visible = false; + btnRemovePartition.Visible = true; + btnEditPartition.Visible = true; + btnAddPartition.Visible = true; + stkPartitionFields1.Visible = false; + stkPartitionFields2.Visible = false; + frmFilesystems.Visible = false; + } + + protected void OnBtnAddPartitionClicked(object sender, EventArgs e) + { + spPartitionSequence.Value = 0; + txtPartitionStart.Text = ""; + txtPartitionEnd.Text = ""; + txtPartitionType.Text = ""; + txtPartitionName.Text = ""; + txtPartitionDescription.Text = ""; + treeFilesystems.DataStore = new ObservableCollection(); + + btnCancelPartition.Visible = true; + btnApplyPartition.Visible = true; + btnRemovePartition.Visible = false; + btnEditPartition.Visible = false; + btnAddPartition.Visible = false; + stkPartitionFields1.Visible = true; + stkPartitionFields2.Visible = true; + frmFilesystems.Visible = true; + + editingPartition = false; + } + + protected void OnBtnRemoveFilesystemClicked(object sender, EventArgs e) + { + if(treeFilesystems.SelectedItem != null) + ((ObservableCollection)treeFilesystems.DataStore).Remove((FileSystemType)treeFilesystems + .SelectedItem); + } + + protected void OnBtnEditFilesystemClicked(object sender, EventArgs e) + { + if(treeFilesystems.SelectedItem == null) return; + + filesystemIter = (FileSystemType)treeFilesystems.SelectedItem; + + dlgFilesystem _dlgFilesystem = new dlgFilesystem {Metadata = filesystemIter}; + _dlgFilesystem.FillFields(); + _dlgFilesystem.ShowModal(this); + + if(!_dlgFilesystem.Modified) return; + + ((ObservableCollection)treeFilesystems.DataStore).Remove(filesystemIter); + ((ObservableCollection)treeFilesystems.DataStore).Add(_dlgFilesystem.Metadata); + } + + protected void OnBtnAddFilesystemClicked(object sender, EventArgs e) + { + dlgFilesystem _dlgFilesystem = new dlgFilesystem(); + _dlgFilesystem.ShowModal(this); + + if(_dlgFilesystem.Modified) + ((ObservableCollection)treeFilesystems.DataStore).Add(_dlgFilesystem.Metadata); + } + + protected void OnBtnCancelTrackClicked(object sender, EventArgs e) + { + btnEditTrack.Visible = true; + btnApplyTrack.Visible = false; + btnCancelTrack.Visible = false; + + frmPartitions.Visible = false; + stkTrackFields1.Visible = false; + stkTrackFields2.Visible = false; + stkTrackFields3.Visible = false; + } + + protected void OnBtnApplyTrackClicked(object sender, EventArgs e) + { + string file = trackIter.Image.Value; + long filesize = trackIter.Size; + string fileformat = trackIter.Image.format; + long fileoffset = trackIter.Image.offset; + ChecksumType[] checksums = trackIter.Checksums; + SubChannelType subchannel = trackIter.SubChannel; + TrackTypeTrackType trackType = + (TrackTypeTrackType)Enum.Parse(typeof(TrackTypeTrackType), cmbTrackType.Text); + + lstTracks.Remove(trackIter); + + trackIter = new TrackType + { + AccoustID = txtAcoustID.Text, + BytesPerSector = int.Parse(txtBytesPerSector.Text), + Checksums = checksums, + EndMSF = txtMSFEnd.Text, + EndSector = long.Parse(txtTrackEnd.Text), + Image = + new ImageType {format = fileformat, offset = fileoffset, offsetSpecified = true, Value = file}, + Sequence = + new TrackSequenceType + { + Session = int.Parse(txtSessionSequence.Text), + TrackNumber = int.Parse(txtTrackSequence.Text) + }, + Size = filesize, + StartMSF = txtMSFStart.Text, + StartSector = long.Parse(txtTrackStart.Text), + SubChannel = subchannel, + TrackType1 = trackType + }; + if(((ObservableCollection)treePartitions.DataStore).Count > 0) + trackIter.FileSystemInformation = + ((ObservableCollection)treePartitions.DataStore).ToArray(); + lstTracks.Add(trackIter); + + btnEditTrack.Visible = true; + btnApplyTrack.Visible = false; + btnCancelTrack.Visible = false; + frmPartitions.Visible = false; + stkTrackFields1.Visible = false; + stkTrackFields2.Visible = false; + stkTrackFields3.Visible = false; + } + + protected void OnBtnEditTrackClicked(object sender, EventArgs e) + { + if(treeTracks.SelectedItem == null) return; + + trackIter = (TrackType)treeTracks.SelectedItem; + + txtTrackSequence.Text = trackIter.Sequence.TrackNumber.ToString(); + txtSessionSequence.Text = trackIter.Sequence.Session.ToString(); + txtMSFStart.Text = trackIter.StartMSF; + txtMSFEnd.Text = trackIter.EndMSF; + txtTrackStart.Text = trackIter.StartSector.ToString(); + txtTrackEnd.Text = trackIter.EndSector.ToString(); + cmbTrackType.Text = trackIter.TrackType1.ToString(); + txtBytesPerSector.Text = trackIter.BytesPerSector.ToString(); + txtAcoustID.Text = trackIter.AccoustID; + treePartitions.DataStore = new ObservableCollection(trackIter.FileSystemInformation); + + btnEditTrack.Visible = false; + btnApplyTrack.Visible = true; + btnCancelTrack.Visible = true; + frmPartitions.Visible = true; + stkTrackFields1.Visible = true; + stkTrackFields2.Visible = true; + stkTrackFields3.Visible = true; + } + + protected void OnChkDumpHardwareToggled(object sender, EventArgs e) + { + treeDumpHardware.Visible = chkDumpHardware.Checked.Value; + btnAddHardware.Visible = chkDumpHardware.Checked.Value; + btnRemoveHardware.Visible = chkDumpHardware.Checked.Value; + btnEditHardware.Visible = chkDumpHardware.Checked.Value; + + btnCancelHardware.Visible = false; + btnApplyHardware.Visible = false; + frmHardware.Visible = false; + } + + protected void OnBtnCancelHardwareClicked(object sender, EventArgs e) + { + btnAddHardware.Visible = true; + btnRemoveHardware.Visible = true; + btnCancelHardware.Visible = false; + btnEditHardware.Visible = true; + btnApplyHardware.Visible = false; + frmHardware.Visible = false; + } + + protected void OnBtnRemoveHardwareClicked(object sender, EventArgs e) + { + if(treeDumpHardware.SelectedItem != null) lstDumpHw.Remove((DumpHardwareType)treeDumpHardware.SelectedItem); + } + + protected void OnBtnApplyHardwareClicked(object sender, EventArgs e) + { + if(editingDumpHw) lstDumpHw.Remove(dumpHwIter); + + dumpHwIter = new DumpHardwareType + { + Manufacturer = txtHWManufacturer.Text, + Model = txtHWModel.Text, + Revision = txtHWRevision.Text, + Firmware = txtHWFirmware.Text, + Serial = txtHWSerial.Text + }; + if(!string.IsNullOrWhiteSpace(txtDumpName.Text) || !string.IsNullOrWhiteSpace(txtDumpVersion.Text) || + !string.IsNullOrWhiteSpace(txtDumpOS.Text)) + dumpHwIter.Software = new SoftwareType + { + Name = txtDumpName.Text, + Version = txtDumpVersion.Text, + OperatingSystem = txtDumpOS.Text + }; + if(((ObservableCollection)treeExtents.DataStore).Count > 0) + dumpHwIter.Extents = ((ObservableCollection)treeExtents.DataStore).ToArray(); + + lstDumpHw.Add(dumpHwIter); + + btnAddHardware.Visible = true; + btnRemoveHardware.Visible = true; + btnCancelHardware.Visible = false; + btnEditHardware.Visible = true; + btnApplyHardware.Visible = false; + frmHardware.Visible = false; + } + + protected void OnBtnAddHardwareClicked(object sender, EventArgs e) + { + txtHWManufacturer.Text = ""; + txtHWModel.Text = ""; + txtHWRevision.Text = ""; + txtHWFirmware.Text = ""; + txtHWSerial.Text = ""; + txtDumpName.Text = ""; + txtDumpVersion.Text = ""; + txtDumpOS.Text = ""; + treeExtents.DataStore = new ObservableCollection(); + + btnAddHardware.Visible = false; + btnRemoveHardware.Visible = false; + btnCancelHardware.Visible = true; + btnEditHardware.Visible = false; + btnApplyHardware.Visible = true; + frmHardware.Visible = true; + + editingDumpHw = false; + } + + protected void OnBtnRemoveExtentClicked(object sender, EventArgs e) + { + if(treeExtents.SelectedItem != null) + ((ObservableCollection)treeExtents.DataStore).Remove((ExtentType)treeExtents.SelectedItem); + } + + protected void OnBtnEditHardwareClicked(object sender, EventArgs e) + { + if(treeDumpHardware.SelectedItem == null) return; + + dumpHwIter = (DumpHardwareType)treeDumpHardware.SelectedItem; + + txtHWManufacturer.Text = dumpHwIter.Manufacturer; + txtHWModel.Text = dumpHwIter.Model; + txtHWRevision.Text = dumpHwIter.Revision; + txtHWFirmware.Text = dumpHwIter.Firmware; + txtHWSerial.Text = dumpHwIter.Serial; + if(dumpHwIter.Software != null) + { + txtDumpName.Text = dumpHwIter.Software.Name; + txtDumpVersion.Text = dumpHwIter.Software.Version; + txtDumpOS.Text = dumpHwIter.Software.OperatingSystem; + } + + treeExtents.DataStore = new ObservableCollection(dumpHwIter.Extents); + + btnAddHardware.Visible = false; + btnRemoveHardware.Visible = false; + btnCancelHardware.Visible = true; + btnEditHardware.Visible = false; + btnApplyHardware.Visible = true; + frmHardware.Visible = true; + + editingDumpHw = true; + } + + protected void OnBtnAddExtentClicked(object sender, EventArgs e) + { + ((ObservableCollection)treeExtents.DataStore).Add(new ExtentType + { + Start = (ulong)spExtentStart.Value, + End = (ulong)spExtentEnd.Value + }); + } + + protected void OnBtnAddRingCodeClicked(object sender, EventArgs e) + { + lstRingCodes.Add(new LayeredTextType + { + layer = (int)spRingCodeLayer.Value, + layerSpecified = true, + Value = txtRingCode.Text + }); + } + + protected void OnBtnRemoveRingCodeClicked(object sender, EventArgs e) + { + if(treeRingCodes.SelectedItem != null) lstRingCodes.Remove((LayeredTextType)treeRingCodes.SelectedItem); + } + + protected void OnBtnAddMasteringSIDClicked(object sender, EventArgs e) + { + lstMasteringSIDs.Add(new LayeredTextType + { + layer = (int)spMasteringSIDLayer.Value, + layerSpecified = true, + Value = txtMasteringSID.Text + }); + } + + protected void OnBtnRemoveMasteringSIDClicked(object sender, EventArgs e) + { + if(treeMasteringSIDs.SelectedItem != null) + lstMasteringSIDs.Remove((LayeredTextType)treeMasteringSIDs.SelectedItem); + } + + protected void OnBtnAddToolstampClicked(object sender, EventArgs e) + { + lstToolstamps.Add(new LayeredTextType + { + layer = (int)spToolstampLayer.Value, + layerSpecified = true, + Value = txtToolstamp.Text + }); + } + + protected void OnBtnRemoveToolstampClicked(object sender, EventArgs e) + { + if(treeToolstamps.SelectedItem != null) lstToolstamps.Remove((LayeredTextType)treeToolstamps.SelectedItem); + } + + protected void OnBtnAddMouldSIDClicked(object sender, EventArgs e) + { + lstMouldSIDs.Add(new LayeredTextType + { + layer = (int)spMouldSIDLayer.Value, + layerSpecified = true, + Value = txtMouldSID.Text + }); + } + + protected void OnBtnRemoveMouldSIDClicked(object sender, EventArgs e) + { + if(treeMouldSIDs.SelectedItem != null) lstMouldSIDs.Remove((LayeredTextType)treeMouldSIDs.SelectedItem); + } + + protected void OnBtnAddMouldTextClicked(object sender, EventArgs e) + { + lstMouldTexts.Add(new LayeredTextType + { + layer = (int)spMouldTextLayer.Value, + layerSpecified = true, + Value = txtMouldText.Text + }); + } + + protected void OnBtnRemoveMouldTextClicked(object sender, EventArgs e) + { + if(treeMouldTexts.SelectedItem != null) lstMouldTexts.Remove((LayeredTextType)treeMouldTexts.SelectedItem); + } + + protected void OnBtnSaveClicked(object sender, EventArgs e) + { + #region Sanity checks + if(string.IsNullOrEmpty(txtFormat.Text)) + { + ErrorMessageBox("Image format cannot be null"); + return; + } + + if(chkSequence.Checked.Value) + { + if(spSequence.Value < 1) + { + ErrorMessageBox("Media sequence must be bigger than 0"); + return; + } + + if(spTotalMedia.Value < 1) + { + ErrorMessageBox("Total medias must be bigger than 0"); + return; + } + + if(spSequence.Value > spTotalMedia.Value) + { + ErrorMessageBox("Media sequence cannot be bigger than total medias"); + return; + } + } + + if(!string.IsNullOrEmpty(txtWriteOffset.Text) && !long.TryParse(txtWriteOffset.Text, out long ltmp)) + { + ErrorMessageBox("Write offset must be a number"); + return; + } + + if(string.IsNullOrEmpty(txtMediaTracks.Text) || !long.TryParse(txtMediaTracks.Text, out ltmp)) + { + ErrorMessageBox("Tracks must be a number"); + return; + } + + if(ltmp < 1) + { + ErrorMessageBox("Tracks must be bigger than 0"); + return; + } + + if(string.IsNullOrEmpty(txtMediaSessions.Text) || !long.TryParse(txtMediaSessions.Text, out ltmp)) + { + ErrorMessageBox("Sessions must be a number"); + return; + } + + if(ltmp < 1) + { + ErrorMessageBox("Sessions must be bigger than 0"); + return; + } + + if(chkDimensions.Checked.Value) + { + if(chkRound.Checked.Value) + { + if(spDiameter.Value <= 0) + { + ErrorMessageBox("Diameter must be bigger than 0"); + return; + } + } + else + { + if(spHeight.Value <= 0) + { + ErrorMessageBox("Height must be bigger than 0"); + return; + } + + if(spWidth.Value <= 0) + { + ErrorMessageBox("Width must be bigger than 0"); + return; + } + } + + if(spThickness.Value <= 0) + { + ErrorMessageBox("Thickness must be bigger than 0"); + return; + } + } + + if(chkDumpHardware.Checked.Value) + if(lstDumpHw.Count < 1) + { + ErrorMessageBox("If dump hardware is known at least an entry must be created"); + return; + } + #endregion Sanity checks + + Metadata = new OpticalDiscType {Image = new ImageType {Value = txtImage.Text, format = txtFormat.Text}}; + + if(!string.IsNullOrWhiteSpace(txtOffset.Text) && long.TryParse(txtOffset.Text, out ltmp)) + { + Metadata.Image.offsetSpecified = true; + Metadata.Image.offset = long.Parse(txtOffset.Text); + } + + Metadata.Size = long.Parse(txtSize.Text); + + if(chkSequence.Checked.Value) + { + Metadata.Sequence = new SequenceType + { + MediaTitle = txtDiscTitle.Text, + MediaSequence = (int)spSequence.Value, + TotalMedia = (int)spTotalMedia.Value + }; + if(spSide.Value > 0) + { + Metadata.Sequence.SideSpecified = true; + Metadata.Sequence.Side = (int)spSide.Value; + } + + if(spLayer.Value > 0) + { + Metadata.Sequence.LayerSpecified = true; + Metadata.Sequence.Layer = (int)spLayer.Value; + } + } + + if(lstLayers.Count > 0) + Metadata.Layers = new LayersType + { + type = cmbLayerType.SelectedValue, + typeSpecified = true, + Sectors = lstLayers.ToArray() + }; + + Metadata.Checksums = checksums; + Metadata.Xbox = xbox; + + if(lstRingCodes.Count > 0) Metadata.RingCode = lstRingCodes.ToArray(); + + if(lstMasteringSIDs.Count > 0) Metadata.MasteringSID = lstMasteringSIDs.ToArray(); + + if(lstToolstamps.Count > 0) Metadata.Toolstamp = lstToolstamps.ToArray(); + + if(lstMouldSIDs.Count > 0) Metadata.MouldSID = lstMouldSIDs.ToArray(); + + if(lstMouldTexts.Count > 0) Metadata.MouldText = lstMouldTexts.ToArray(); + + if(!string.IsNullOrWhiteSpace(txtDiscType.Text)) Metadata.DiscType = txtDiscType.Text; + if(!string.IsNullOrWhiteSpace(txtDiscSubtype.Text)) Metadata.DiscSubType = txtDiscSubtype.Text; + if(!string.IsNullOrWhiteSpace(txtWriteOffset.Text)) + { + Metadata.Offset = int.Parse(txtWriteOffset.Text); + Metadata.OffsetSpecified = true; + } + + Metadata.Tracks = !string.IsNullOrWhiteSpace(txtMediaTracks.Text) + ? new[] {int.Parse(txtMediaTracks.Text)} + : new[] {1}; + + Metadata.Sessions = + !string.IsNullOrWhiteSpace(txtMediaSessions.Text) ? int.Parse(txtMediaSessions.Text) : 1; + + if(!string.IsNullOrWhiteSpace(txtCopyProtection.Text)) Metadata.CopyProtection = txtCopyProtection.Text; + + if(chkDimensions.Checked.Value) + { + Metadata.Dimensions = new DimensionsType(); + if(chkRound.Checked.Value) + { + Metadata.Dimensions.DiameterSpecified = true; + Metadata.Dimensions.Diameter = spDiameter.Value; + } + else + { + Metadata.Dimensions.HeightSpecified = true; + Metadata.Dimensions.WidthSpecified = true; + Metadata.Dimensions.Height = spHeight.Value; + Metadata.Dimensions.Width = spWidth.Value; + } + + Metadata.Dimensions.Thickness = spThickness.Value; + } + + Metadata.Case = mediaCase; + Metadata.Scans = scans; + + if(lstPFI.Count == 1) Metadata.PFI = lstPFI[0]; + if(lstDMI.Count == 1) Metadata.DMI = lstDMI[0]; + if(lstCMI.Count == 1) Metadata.CMI = lstCMI[0]; + if(lstBCA.Count == 1) Metadata.BCA = lstBCA[0]; + if(lstATIP.Count == 1) Metadata.ATIP = lstATIP[0]; + if(lstADIP.Count == 1) Metadata.ADIP = lstADIP[0]; + if(lstPMA.Count == 1) Metadata.PMA = lstPMA[0]; + if(lstDDS.Count == 1) Metadata.DDS = lstDDS[0]; + if(lstSAI.Count == 1) Metadata.SAI = lstSAI[0]; + if(lstLastRMD.Count == 1) Metadata.LastRMD = lstLastRMD[0]; + if(lstPRI.Count == 1) Metadata.PRI = lstPRI[0]; + if(lstMediaID.Count == 1) Metadata.MediaID = lstMediaID[0]; + if(lstPFIR.Count == 1) Metadata.PFIR = lstPFIR[0]; + if(lstDCB.Count == 1) Metadata.DCB = lstDCB[0]; + if(lstDI.Count == 1) Metadata.DI = lstDI[0]; + if(lstPAC.Count == 1) Metadata.PAC = lstPAC[0]; + if(lstTOC.Count == 1) Metadata.TOC = lstTOC[0]; + if(lstCDText.Count == 1) Metadata.LeadInCdText = lstCDText[0]; + + if(lstLeadIns.Count == 1) Metadata.LeadIn = lstLeadIns.ToArray(); + if(lstLeadOuts.Count == 1) Metadata.LeadOut = lstLeadOuts.ToArray(); + + if(!string.IsNullOrWhiteSpace(txtPS3Key.Text) && !string.IsNullOrWhiteSpace(txtPS3Serial.Text)) + Metadata.PS3Encryption = new PS3EncryptionType {Key = txtPS3Key.Text, Serial = txtPS3Serial.Text}; + + Metadata.Track = lstTracks.ToArray(); + + if(chkDumpHardware.Checked.Value && lstDumpHw.Count >= 1) Metadata.DumpHardwareArray = lstDumpHw.ToArray(); + + Modified = true; + Close(); + } + + protected void OnBtnCancelClicked(object sender, EventArgs e) + { + Close(); + } + + protected void OnBtnCancelPartitionClicked(object sender, EventArgs e) + { + btnCancelPartition.Visible = false; + btnApplyPartition.Visible = false; + btnRemovePartition.Visible = true; + btnEditPartition.Visible = true; + btnAddPartition.Visible = true; + stkPartitionFields1.Visible = false; + stkPartitionFields2.Visible = false; + frmFilesystems.Visible = false; + } + + #region XAML UI elements + #pragma warning disable 0649 + TextBox txtImage; + TextBox txtFormat; + TextBox txtOffset; + TextBox txtSize; + TextBox txtWriteOffset; + TextBox txtMediaTracks; + TextBox txtMediaSessions; + TextBox txtCopyProtection; + TextBox txtDiscType; + TextBox txtDiscSubtype; + CheckBox chkSequence; + Label lblDiscTitle; + TextBox txtDiscTitle; + Label lblSequence; + NumericUpDown spSequence; + Label lblTotalMedia; + NumericUpDown spTotalMedia; + Label lblSide; + NumericUpDown spSide; + Label lblLayer; + NumericUpDown spLayer; + CheckBox chkDimensions; + CheckBox chkRound; + StackLayout stkDiameter; + NumericUpDown spDiameter; + StackLayout stkHeight; + NumericUpDown spHeight; + StackLayout stkWidth; + NumericUpDown spWidth; + StackLayout stkThickness; + NumericUpDown spThickness; + CheckBox chkLayers; + StackLayout stkLayers; + EnumDropDown cmbLayerType; + GridView treeLayers; + NumericUpDown spNewLayer; + TextBox txtLayerSize; + GridView treeRingCodes; + NumericUpDown spRingCodeLayer; + TextBox txtRingCode; + GridView treeMasteringSIDs; + NumericUpDown spMasteringSIDLayer; + TextBox txtMasteringSID; + GridView treeToolstamps; + NumericUpDown spToolstampLayer; + TextBox txtToolstamp; + GridView treeMouldSIDs; + NumericUpDown spMouldSIDLayer; + TextBox txtMouldSID; + GridView treeMouldTexts; + NumericUpDown spMouldTextLayer; + TextBox txtMouldText; + GroupBox frmTOC; + GridView treeTOC; + GroupBox frmCDText; + GridView treeCDText; + GroupBox frmATIP; + GridView treeATIP; + GroupBox frmPMA; + GridView treePMA; + GroupBox frmLeadIns; + GridView treeLeadIn; + GroupBox frmLeadOuts; + GridView treeLeadOut; + GroupBox frmPFI; + GridView treePFI; + GroupBox frmDMI; + GridView treeDMI; + GroupBox frmCMI; + GridView treeCMI; + GroupBox frmBCA; + GridView treeBCA; + GroupBox frmDCB; + GridView treeDCB; + GroupBox frmPRI; + GridView treePRI; + GroupBox frmMediaID; + GridView treeMediaID; + GroupBox frmPFIR; + GridView treePFIR; + GroupBox frmLastRMD; + GridView treeLastRMD; + GroupBox frmADIP; + GridView treeADIP; + GroupBox frmDDS; + GridView treeDDS; + GroupBox frmSAI; + GridView treeSAI; + GroupBox frmDI; + GridView treeDI; + GroupBox frmPAC; + GridView treePAC; + TextBox txtPS3Key; + TextBox txtPS3Serial; + GridView treeTracks; + TextBox txtTrackStart; + TextBox txtTrackEnd; + TextBox txtMSFStart; + TextBox txtMSFEnd; + TextBox txtTrackSequence; + TextBox txtSessionSequence; + ComboBox cmbTrackType; + TextBox txtBytesPerSector; + TextBox txtAcoustID; + GridView treePartitions; + Button btnCancelPartition; + Button btnRemovePartition; + Button btnEditPartition; + Button btnApplyPartition; + Button btnAddPartition; + NumericUpDown spPartitionSequence; + TextBox txtPartitionStart; + TextBox txtPartitionEnd; + TextBox txtPartitionType; + StackLayout stkPartitionFields1; + StackLayout stkPartitionFields2; + TextBox txtPartitionName; + TextBox txtPartitionDescription; + GroupBox frmFilesystems; + GridView treeFilesystems; + Button btnCancelTrack; + Button btnApplyTrack; + Button btnEditTrack; + CheckBox chkDumpHardware; + GridView treeDumpHardware; + Button btnCancelHardware; + Button btnRemoveHardware; + Button btnEditHardware; + Button btnApplyHardware; + Button btnAddHardware; + GroupBox frmHardware; + TextBox txtHWManufacturer; + TextBox txtHWModel; + TextBox txtHWRevision; + TextBox txtHWFirmware; + TextBox txtHWSerial; + GridView treeExtents; + NumericUpDown spExtentStart; + NumericUpDown spExtentEnd; + TextBox txtDumpName; + TextBox txtDumpVersion; + TextBox txtDumpOS; + GroupBox frmLayers; + GroupBox frmPartitions; + StackLayout stkTrackFields1; + StackLayout stkTrackFields2; + StackLayout stkTrackFields3; + #pragma warning restore 0649 + #endregion XAML UI elements + } +} \ No newline at end of file