Code cleanup and reformatting.

This commit is contained in:
2018-07-31 00:14:45 +01:00
parent 978ea811a0
commit ebde6d67e1
5 changed files with 758 additions and 772 deletions

View File

@@ -28,9 +28,10 @@
// 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 Eto;
using Eto.Forms;
using Eto.Drawing;
namespace CICMMetadataEditor.Desktop
{
@@ -39,7 +40,7 @@ namespace CICMMetadataEditor.Desktop
[STAThread]
static void Main(string[] args)
{
new Application(Eto.Platform.Detect).Run(new dlgMetadata());
new Application(Platform.Detect).Run(new dlgMetadata());
}
}
}

View File

@@ -41,16 +41,13 @@ namespace CICMMetadataEditor
{
public class dlgBlockMedia : Dialog
{
// Non-editable fields
ChecksumType[] checksums;
ChecksumType[] contentChks;
DumpHardwareType dumpHwIter;
bool editingDumpHw;
bool editingPartition;
FileSystemType filesystemIter;
ObservableCollection<StringEntry> lstAdditionalInformation;
ObservableCollection<DumpType> lstAta;
ObservableCollection<DumpType> lstCID;
ObservableCollection<DumpType> lstCSD;
@@ -70,7 +67,6 @@ namespace CICMMetadataEditor
ObservableCollection<DumpType> lstUSBDescriptors;
public BlockMediaType Metadata;
public bool Modified;
PartitionType partitionIter;
ScansType scans;
TapePartitionType[] tapeInformation;
@@ -612,7 +608,8 @@ namespace CICMMetadataEditor
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.";
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.";
@@ -721,14 +718,11 @@ namespace CICMMetadataEditor
if(Metadata.PCMCIA.Compliance != null) txtCompliance.Text = Metadata.PCMCIA.Compliance;
if(Metadata.PCMCIA.ManufacturerCodeSpecified)
txtMfgCode.Text =
$"0x{Metadata.PCMCIA.ManufacturerCode:X4}";
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.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;
@@ -1045,7 +1039,8 @@ namespace CICMMetadataEditor
}
protected void OnBtnEditFilesystemClicked(object sender, EventArgs e)
{/*
{
/*
if(treeFilesystems.SelectedItem == null) return;
filesystemIter = (FileSystemType)treeFilesystems.SelectedItem;
@@ -1061,7 +1056,8 @@ namespace CICMMetadataEditor
}
protected void OnBtnAddFilesystemClicked(object sender, EventArgs e)
{/*
{
/*
dlgFilesystem _dlgFilesystem = new dlgFilesystem();
_dlgFilesystem.ShowModal(this);

View File

@@ -36,9 +36,10 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml;
using Eto.Threading;
using System.Xml.Serialization;
using Eto.Forms;
using Eto.Serialization.Xaml;
using Eto.Threading;
using Schemas;
using BorderType = Schemas.BorderType;
@@ -49,17 +50,16 @@ namespace CICMMetadataEditor
AdvertisementType[] adverts;
AudioMediaType[] audiomedias;
BookType[] books;
string currentFile;
LinearMediaType[] linearmedias;
ObservableCollection<StringEntry> lstArchitectures;
ObservableCollection<string> lstArchitecturesTypes;
ObservableCollection<BarcodeEntry> lstBarcodes;
ObservableCollection<string> lstBarcodeTypes;
ObservableCollection<StringEntry> lstCategories;
ObservableCollection<DiscEntry> lstDiscs;
ObservableCollection<DiskEntry> lstDisks;
ObservableCollection<string> lstFilesForMedia;
ObservableCollection<StringEntry> lstKeywords;
ObservableCollection<StringEntry> lstLanguages;
ObservableCollection<string> lstLanguageTypes;
@@ -77,7 +77,6 @@ namespace CICMMetadataEditor
Thread thdDisc;
Thread thdDisk;
UserManualType[] usermanuals;
string currentFile;
public dlgMetadata()
{
@@ -217,8 +216,7 @@ namespace CICMMetadataEditor
try
{
System.Xml.Serialization.XmlSerializer reader =
new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType));
XmlSerializer reader = new XmlSerializer(typeof(CICMMetadataType));
FileStream fs = new FileStream(dlgOpen.FileName, FileMode.Open, FileAccess.Read);
metadata = (CICMMetadataType)reader.Deserialize(fs);
fs.Dispose();
@@ -239,11 +237,7 @@ namespace CICMMetadataEditor
protected void OnSaveAsClicked(object sender, EventArgs e)
{
SaveFileDialog dlgSave = new SaveFileDialog
{
CheckFileExists = true,
Title = "Choose new metadata file"
};
SaveFileDialog dlgSave = new SaveFileDialog {CheckFileExists = true, Title = "Choose new metadata file"};
dlgSave.Filters.Add(new FileFilter("Metadata files", ".xml"));
DialogResult result = dlgSave.ShowDialog(this);
@@ -254,11 +248,9 @@ namespace CICMMetadataEditor
void Save(string destination)
{
try
{
System.Xml.Serialization.XmlSerializer writer =
new System.Xml.Serialization.XmlSerializer(typeof(CICMMetadataType));
XmlSerializer writer = new XmlSerializer(typeof(CICMMetadataType));
FileStream fs = new FileStream(destination, FileMode.Create, FileAccess.Write);
writer.Serialize(fs, metadata);
fs.Dispose();
@@ -266,8 +258,7 @@ namespace CICMMetadataEditor
}
catch(Exception)
{
if(Debugger.IsAttached)
throw;
if(Debugger.IsAttached) throw;
MessageBox.Show("Could not save metadata.", MessageBoxType.Error);
}
@@ -287,7 +278,6 @@ namespace CICMMetadataEditor
lstDiscs = new ObservableCollection<DiscEntry>();
lstDisks = new ObservableCollection<DiskEntry>();
treeKeywords.DataStore = lstKeywords;
treeBarcodes.DataStore = lstBarcodes;
treeCategories.DataStore = lstCategories;

View File

@@ -41,11 +41,9 @@ namespace CICMMetadataEditor
{
public class dlgOpticalDisc : Dialog
{
// Non-editable fields
ChecksumType[] checksums;
DumpHardwareType dumpHwIter;
bool editingDumpHw;
bool editingPartition;
FileSystemType filesystemIter;
ObservableCollection<DumpType> lstADIP;
@@ -57,7 +55,6 @@ namespace CICMMetadataEditor
ObservableCollection<DumpType> lstDDS;
ObservableCollection<DumpType> lstDI;
ObservableCollection<DumpType> lstDMI;
ObservableCollection<DumpHardwareType> lstDumpHw;
ObservableCollection<DumpType> lstLastRMD;
ObservableCollection<SectorsType> lstLayers;
@@ -82,7 +79,6 @@ namespace CICMMetadataEditor
public bool Modified;
PartitionType partitionIter;
ScansType scans;
TrackType trackIter;
XboxType xbox;
@@ -841,7 +837,8 @@ namespace CICMMetadataEditor
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.";
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.";
@@ -1271,7 +1268,8 @@ namespace CICMMetadataEditor
}
protected void OnBtnEditFilesystemClicked(object sender, EventArgs e)
{/*
{
/*
if(treeFilesystems.SelectedItem == null) return;
filesystemIter = (FileSystemType)treeFilesystems.SelectedItem;
@@ -1287,7 +1285,8 @@ namespace CICMMetadataEditor
}
protected void OnBtnAddFilesystemClicked(object sender, EventArgs e)
{/*
{
/*
dlgFilesystem _dlgFilesystem = new dlgFilesystem();
_dlgFilesystem.ShowModal(this);