diff --git a/osrepodbmgr.Eto.Desktop/Program.cs b/osrepodbmgr.Eto.Desktop/Program.cs
index 38bafd6..8b160a5 100644
--- a/osrepodbmgr.Eto.Desktop/Program.cs
+++ b/osrepodbmgr.Eto.Desktop/Program.cs
@@ -28,6 +28,7 @@
using System;
using Eto;
using Eto.Forms;
+using osrepodbmgr.Core;
namespace osrepodbmgr.Eto.Desktop
{
@@ -36,7 +37,9 @@ namespace osrepodbmgr.Eto.Desktop
[STAThread]
public static void Main(string[] args)
{
- new Application(Platform.Detect).Run(new MainForm());
+ Settings.LoadSettings();
+ Context.CheckUnar();
+ new Application(Platform.Detect).Run(new frmMain());
}
}
}
diff --git a/osrepodbmgr.Eto.Desktop/packages.config b/osrepodbmgr.Eto.Desktop/packages.config
index 7c00dac..b2b9942 100644
--- a/osrepodbmgr.Eto.Desktop/packages.config
+++ b/osrepodbmgr.Eto.Desktop/packages.config
@@ -1,4 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/osrepodbmgr.Eto.XamMac2/Program.cs b/osrepodbmgr.Eto.XamMac2/Program.cs
index 520d1c1..9e2a704 100644
--- a/osrepodbmgr.Eto.XamMac2/Program.cs
+++ b/osrepodbmgr.Eto.XamMac2/Program.cs
@@ -28,6 +28,7 @@
using System;
using Eto;
using Eto.Forms;
+using osrepodbmgr.Core;
namespace osrepodbmgr.Eto.XamMac2
{
@@ -36,7 +37,9 @@ namespace osrepodbmgr.Eto.XamMac2
[STAThread]
public static void Main(string[] args)
{
- new Application(Platforms.XamMac2).Run(new MainForm());
+ Settings.LoadSettings();
+ Context.CheckUnar();
+ new Application(Platforms.XamMac2).Run(new frmMain());
}
}
}
diff --git a/osrepodbmgr.Eto.XamMac2/packages.config b/osrepodbmgr.Eto.XamMac2/packages.config
index 7c00dac..47fc874 100644
--- a/osrepodbmgr.Eto.XamMac2/packages.config
+++ b/osrepodbmgr.Eto.XamMac2/packages.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/osrepodbmgr.Eto/WrappersForEto.cs b/osrepodbmgr.Eto/WrappersForEto.cs
index b0129ab..99958b7 100644
--- a/osrepodbmgr.Eto/WrappersForEto.cs
+++ b/osrepodbmgr.Eto/WrappersForEto.cs
@@ -1,10 +1,59 @@
using System;
+using osrepodbmgr.Core;
+using Schemas;
+
namespace osrepodbmgr.Eto
{
- public class WrappersForEto
+ class DBEntryForEto
{
- public WrappersForEto()
+ DBEntry _item;
+ public DBEntryForEto(DBEntry item)
{
+ _item = item;
}
+
+ public long id { get { return _item.id; } set { } }
+ public string developer { get { return _item.developer; } set { } }
+ public string product { get { return _item.product; } set { } }
+ public string version { get { return _item.version; } set { } }
+ public string languages { get { return _item.languages; } set { } }
+ public string architecture { get { return _item.architecture; } set { } }
+ public string machine { get { return _item.machine; } set { } }
+ public string format { get { return _item.format; } set { } }
+ public string description { get { return _item.description; } set { } }
+ public bool oem { get { return _item.oem; } set { } }
+ public bool upgrade { get { return _item.upgrade; } set { } }
+ public bool update { get { return _item.update; } set { } }
+ public bool source { get { return _item.source; } set { } }
+ public bool files { get { return _item.files; } set { } }
+ public bool netinstall { get { return _item.netinstall; } set { } }
+ public byte[] xml { get { return _item.xml; } set { } }
+ public byte[] json { get { return _item.json; } set { } }
+ public string mdid { get { return _item.mdid; } set { } }
+
+ public DBEntry original { get { return _item; } set { } }
+ }
+
+ class StringEntry
+ {
+ public string str { get; set; }
+ }
+
+ class BarcodeEntry
+ {
+ public string code { get; set; }
+ public BarcodeTypeType type { get; set; }
+ }
+
+ class DiscEntry
+ {
+ public string path { get; set; }
+ public OpticalDiscType disc { get; set; }
+ }
+
+ class DiskEntry
+ {
+ public string path { get; set; }
+ public BlockMediaType disk { get; set; }
}
}
diff --git a/osrepodbmgr.Eto/dlgAdd.xeto b/osrepodbmgr.Eto/dlgAdd.xeto
index e309770..e626108 100644
--- a/osrepodbmgr.Eto/dlgAdd.xeto
+++ b/osrepodbmgr.Eto/dlgAdd.xeto
@@ -1,6 +1,132 @@
-
-
-
+
+
diff --git a/osrepodbmgr.Eto/dlgAdd.xeto.cs b/osrepodbmgr.Eto/dlgAdd.xeto.cs
index d4c1f63..65a5f4a 100644
--- a/osrepodbmgr.Eto/dlgAdd.xeto.cs
+++ b/osrepodbmgr.Eto/dlgAdd.xeto.cs
@@ -30,14 +30,1145 @@ using System.Collections.Generic;
using Eto.Forms;
using Eto.Drawing;
using Eto.Serialization.Xaml;
+using System.Threading;
+using osrepodbmgr.Core;
+using System.Collections.ObjectModel;
+using Schemas;
+using System.IO;
+using System.Xml.Serialization;
+using Newtonsoft.Json;
+using System.ComponentModel;
namespace osrepodbmgr.Eto
{
- public class dlgAdd : Panel
+ public class dlgAdd : Dialog
{
+ Thread thdFindFiles;
+ Thread thdHashFiles;
+ Thread thdCheckFiles;
+ Thread thdAddFiles;
+ Thread thdPackFiles;
+ Thread thdOpenArchive;
+ Thread thdExtractArchive;
+ Thread thdRemoveTemp;
+ bool stopped;
+ ObservableCollection fileView;
+ ObservableCollection osView;
+
+ class FileEntry
+ {
+ public string path { get; set; }
+ public string hash { get; set; }
+ public bool known { get; set; }
+ }
+
+ #region XAML UI elements
+#pragma warning disable 0649
+ TextBox txtDeveloper;
+ TextBox txtProduct;
+ TextBox txtVersion;
+ TextBox txtLanguages;
+ TextBox txtArchitecture;
+ TextBox txtMachine;
+ TextBox txtFormat;
+ TextBox txtDescription;
+ CheckBox chkOem;
+ CheckBox chkUpdate;
+ CheckBox chkUpgrade;
+ CheckBox chkFiles;
+ CheckBox chkSource;
+ CheckBox chkNetinstall;
+ GridView treeFiles;
+ TabPage tabOSes;
+ GridView treeOSes;
+ Label lblProgress;
+ ProgressBar prgProgress;
+ Label lblProgress2;
+ ProgressBar prgProgress2;
+ Button btnRemoveFile;
+ Button btnMetadata;
+ Button btnStop;
+ Button btnFolder;
+ Button btnArchive;
+ Button btnPack;
+ Button btnClose;
+ Button btnExit;
+#pragma warning restore 0649
+ #endregion XAML UI elements
+
+ public delegate void OnAddedOSDelegate(DBEntry os, bool existsInRepo, string pathInRepo);
+ public event OnAddedOSDelegate OnAddedOS;
+
public dlgAdd()
{
XamlReader.Load(this);
+
+ Context.UnarChangeStatus += UnarChangeStatus;
+ Context.CheckUnar();
+
+ fileView = new ObservableCollection();
+
+ treeFiles.DataStore = fileView;
+
+ treeFiles.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.path) },
+ HeaderText = "Path"
+ });
+ treeFiles.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.hash) },
+ HeaderText = "SHA256"
+ });
+ treeFiles.Columns.Add(new GridColumn
+ {
+ DataCell = new CheckBoxCell { Binding = Binding.Property(r => r.known) },
+ HeaderText = "Known?"
+ });
+
+ treeFiles.AllowMultipleSelection = false;
+
+ treeFiles.CellFormatting += (sender, e) => {
+ if(((FileEntry)e.Item).known)
+ e.BackgroundColor = Colors.Green;
+ else
+ e.BackgroundColor = Colors.Red;
+ };
+
+ osView = new ObservableCollection();
+
+ treeOSes.DataStore = osView;
+
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.developer) },
+ HeaderText = "Developer"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.product) },
+ HeaderText = "Product"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.version) },
+ HeaderText = "Version"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.languages) },
+ HeaderText = "Languages"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.architecture) },
+ HeaderText = "Architecture"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.machine) },
+ HeaderText = "Machine"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.format) },
+ HeaderText = "Format"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.description) },
+ HeaderText = "Description"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new CheckBoxCell { Binding = Binding.Property(r => r.oem) },
+ HeaderText = "OEM?"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new CheckBoxCell { Binding = Binding.Property(r => r.upgrade) },
+ HeaderText = "Upgrade?"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new CheckBoxCell { Binding = Binding.Property(r => r.update) },
+ HeaderText = "Update?"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new CheckBoxCell { Binding = Binding.Property(r => r.source) },
+ HeaderText = "Source?"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new CheckBoxCell { Binding = Binding.Property(r => r.files) },
+ HeaderText = "Files?"
+ });
+ treeOSes.Columns.Add(new GridColumn
+ {
+ DataCell = new CheckBoxCell { Binding = Binding.Property(r => r.netinstall) },
+ HeaderText = "NetInstall?"
+ });
+
+ treeOSes.AllowMultipleSelection = false;
+ }
+
+ void UnarChangeStatus()
+ {
+ Application.Instance.Invoke(delegate
+ {
+ btnArchive.Enabled = Context.unarUsable;
+ });
+ }
+
+ protected void OnDeleteEvent(object sender, CancelEventArgs e)
+ {
+ if(btnStop.Visible)
+ btnStop.PerformClick();
+ if(btnClose.Enabled)
+ btnClose.PerformClick();
+ }
+
+ protected void OnBtnFolderClicked(object sender, EventArgs e)
+ {
+ SelectFolderDialog dlgFolder = new SelectFolderDialog();
+ dlgFolder.Title = "Open folder";
+
+ if(dlgFolder.ShowDialog(this) == DialogResult.Ok)
+ {
+ stopped = false;
+ lblProgress.Text = "Finding files";
+ lblProgress.Visible = true;
+ prgProgress.Visible = true;
+ btnExit.Enabled = false;
+ btnFolder.Visible = false;
+ btnArchive.Visible = false;
+ thdFindFiles = new Thread(Workers.FindFiles);
+ Context.path = dlgFolder.Directory;
+ Workers.Failed += FindFilesFailed;
+ Workers.Finished += FindFilesFinished;
+ btnStop.Visible = true;
+ thdFindFiles.Start();
+ }
+ }
+
+ void FindFilesFailed(string text)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!stopped)
+ MessageBox.Show(text, MessageBoxType.Error);
+ lblProgress.Visible = false;
+ prgProgress.Visible = false;
+ btnExit.Enabled = true;
+ btnFolder.Visible = true;
+ btnArchive.Visible = true;
+ Workers.Failed -= FindFilesFailed;
+ Workers.Finished -= FindFilesFinished;
+ thdFindFiles = null;
+ });
+ }
+
+ void FindFilesFinished()
+ {
+ Application.Instance.Invoke(delegate
+ {
+ Workers.Failed -= FindFilesFailed;
+ Workers.Finished -= FindFilesFinished;
+
+ lblProgress.Visible = true;
+ prgProgress.Visible = true;
+ lblProgress2.Visible = true;
+ prgProgress2.Visible = true;
+
+ thdFindFiles = null;
+ thdHashFiles = new Thread(Workers.HashFiles);
+ Workers.Failed += HashFilesFailed;
+ Workers.Finished += HashFilesFinished;
+ Workers.UpdateProgress += UpdateProgress;
+ Workers.UpdateProgress2 += UpdateProgress2;
+ thdHashFiles.Start();
+ });
+ }
+
+ void HashFilesFailed(string text)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!stopped)
+ MessageBox.Show(text, MessageBoxType.Error);
+ lblProgress.Visible = false;
+ prgProgress.Visible = false;
+ lblProgress2.Visible = false;
+ prgProgress2.Visible = false;
+ Workers.Failed -= HashFilesFailed;
+ Workers.Finished -= HashFilesFinished;
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.UpdateProgress2 -= UpdateProgress2;
+ btnExit.Enabled = true;
+ btnFolder.Visible = true;
+ btnArchive.Visible = true;
+ thdHashFiles = null;
+ });
+ }
+
+ void HashFilesFinished()
+ {
+ Application.Instance.Invoke(delegate
+ {
+ lblProgress.Visible = false;
+ prgProgress.Visible = false;
+ lblProgress.Visible = false;
+ prgProgress.Visible = false;
+ lblProgress2.Visible = false;
+ prgProgress2.Visible = false;
+ Workers.Failed -= HashFilesFailed;
+ Workers.Finished -= HashFilesFinished;
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.UpdateProgress2 -= UpdateProgress2;
+ thdHashFiles = null;
+
+ prgProgress.Visible = true;
+
+ thdCheckFiles = new Thread(Workers.CheckDbForFiles);
+ Workers.Failed += ChkFilesFailed;
+ Workers.Finished += ChkFilesFinished;
+ Workers.UpdateProgress += UpdateProgress;
+ Workers.UpdateProgress2 += UpdateProgress2;
+ Workers.AddFile += AddFile;
+ Workers.AddOS += AddOS;
+ thdCheckFiles.Start();
+ });
+ }
+
+ void ChkFilesFailed(string text)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!stopped)
+ MessageBox.Show(text, MessageBoxType.Error);
+ if(thdCheckFiles != null)
+ thdCheckFiles.Abort();
+ prgProgress.Visible = false;
+ btnStop.Visible = false;
+ btnClose.Visible = false;
+ btnExit.Enabled = true;
+ Workers.Failed -= ChkFilesFailed;
+ Workers.Finished -= ChkFilesFinished;
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.UpdateProgress2 -= UpdateProgress2;
+ Workers.AddFile -= AddFile;
+ Workers.AddOS -= AddOS;
+ thdHashFiles = null;
+ if(fileView != null)
+ fileView.Clear();
+ if(osView != null)
+ {
+ tabOSes.Visible = false;
+ osView.Clear();
+ }
+ });
+ }
+
+ void ChkFilesFinished()
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(thdCheckFiles != null)
+ thdCheckFiles.Abort();
+
+ Workers.Failed -= ChkFilesFailed;
+ Workers.Finished -= ChkFilesFinished;
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.UpdateProgress2 -= UpdateProgress2;
+ Workers.AddFile -= AddFile;
+ Workers.AddOS -= AddOS;
+
+ thdHashFiles = null;
+ prgProgress.Visible = false;
+ btnStop.Visible = false;
+ btnClose.Visible = true;
+ btnExit.Enabled = true;
+ btnPack.Visible = true;
+ btnPack.Enabled = true;
+ btnRemoveFile.Visible = true;
+
+ txtFormat.ReadOnly = false;
+ txtMachine.ReadOnly = false;
+ txtProduct.ReadOnly = false;
+ txtVersion.ReadOnly = false;
+ txtLanguages.ReadOnly = false;
+ txtDeveloper.ReadOnly = false;
+ txtDescription.ReadOnly = false;
+ txtArchitecture.ReadOnly = false;
+ chkOem.Enabled = true;
+ chkFiles.Enabled = true;
+ chkUpdate.Enabled = true;
+ chkUpgrade.Enabled = true;
+ chkNetinstall.Enabled = true;
+ chkSource.Enabled = true;
+
+ btnMetadata.Visible = true;
+ if(Context.metadata != null)
+ {
+ if(Context.metadata.Developer != null)
+ {
+ foreach(string developer in Context.metadata.Developer)
+ {
+ if(!string.IsNullOrWhiteSpace(txtDeveloper.Text))
+ txtDeveloper.Text += ",";
+ txtDeveloper.Text += developer;
+ }
+ }
+
+ if(!string.IsNullOrWhiteSpace(Context.metadata.Name))
+ txtProduct.Text = Context.metadata.Name;
+ if(!string.IsNullOrWhiteSpace(Context.metadata.Version))
+ txtVersion.Text = Context.metadata.Version;
+
+ if(Context.metadata.Languages != null)
+ {
+ foreach(LanguagesTypeLanguage language in Context.metadata.Languages)
+ {
+ if(!string.IsNullOrWhiteSpace(txtLanguages.Text))
+ txtLanguages.Text += ",";
+ txtLanguages.Text += language;
+ }
+ }
+
+ if(Context.metadata.Architectures != null)
+ {
+ foreach(ArchitecturesTypeArchitecture architecture in Context.metadata.Architectures)
+ {
+ if(!string.IsNullOrWhiteSpace(txtArchitecture.Text))
+ txtArchitecture.Text += ",";
+ txtArchitecture.Text += architecture;
+ }
+ }
+
+ if(Context.metadata.Systems != null)
+ {
+ foreach(string machine in Context.metadata.Systems)
+ {
+ if(!string.IsNullOrWhiteSpace(txtMachine.Text))
+ txtMachine.Text += ",";
+ txtMachine.Text += machine;
+ }
+ }
+
+ btnMetadata.BackgroundColor = Colors.Green;
+ }
+ else
+ btnMetadata.BackgroundColor = Colors.Red;
+ });
+ }
+
+ void AddFile(string filename, string hash, bool known)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ Color color = known ? Colors.Green : Colors.Red;
+ fileView.Add(new FileEntry { path = filename, hash = hash, known = known });
+ btnPack.Enabled |= !known;
+ });
+ }
+
+ void AddOS(DBEntry os, bool existsInRepo, string pathInRepo)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ Color color = existsInRepo ? Colors.Green : Colors.Red;
+ tabOSes.Visible = true;
+ osView.Add(new DBEntryForEto(os));
+ });
+ }
+
+ protected void OnBtnExitClicked(object sender, EventArgs e)
+ {
+ if(btnClose.Enabled)
+ OnBtnCloseClicked(sender, e);
+
+ Close();
+ }
+
+ protected void OnBtnCloseClicked(object sender, EventArgs e)
+ {
+ btnFolder.Visible = true;
+ btnArchive.Visible = true;
+ Context.path = "";
+ Context.files = null;
+ Context.hashes = null;
+ btnStop.Visible = false;
+ btnPack.Visible = false;
+ btnClose.Visible = false;
+ btnRemoveFile.Visible = false;
+ if(fileView != null)
+ fileView.Clear();
+ if(osView != null)
+ {
+ tabOSes.Visible = false;
+ osView.Clear();
+ }
+ txtFormat.ReadOnly = true;
+ txtMachine.ReadOnly = true;
+ txtProduct.ReadOnly = true;
+ txtVersion.ReadOnly = true;
+ txtLanguages.ReadOnly = true;
+ txtDeveloper.ReadOnly = true;
+ txtDescription.ReadOnly = true;
+ txtArchitecture.ReadOnly = true;
+ chkOem.Enabled = false;
+ chkFiles.Enabled = false;
+ chkUpdate.Enabled = false;
+ chkUpgrade.Enabled = false;
+ chkNetinstall.Enabled = false;
+ chkSource.Enabled = false;
+ txtFormat.Text = "";
+ txtMachine.Text = "";
+ txtProduct.Text = "";
+ txtVersion.Text = "";
+ txtLanguages.Text = "";
+ txtDeveloper.Text = "";
+ txtDescription.Text = "";
+ txtArchitecture.Text = "";
+ chkOem.Checked = false;
+ chkFiles.Checked = false;
+ chkUpdate.Checked = false;
+ chkUpgrade.Checked = false;
+ chkNetinstall.Checked = false;
+ chkSource.Checked = false;
+
+ if(Context.tmpFolder != null)
+ {
+ btnStop.Visible = false;
+ prgProgress.Visible = true;
+ lblProgress.Visible = true;
+ lblProgress.Text = "Removing temporary files";
+ prgProgress.Indeterminate = true;
+ Workers.Failed += RemoveTempFilesFailed;
+ Workers.Finished += RemoveTempFilesFinished;
+ thdRemoveTemp = new Thread(Workers.RemoveTempFolder);
+ thdRemoveTemp.Start();
+ }
+
+ btnMetadata.Visible = false;
+ Context.metadata = null;
+ }
+
+ public void UpdateProgress(string text, string inner, long current, long maximum)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!string.IsNullOrWhiteSpace(inner))
+ lblProgress.Text = inner;
+ else
+ lblProgress.Text = text;
+ if(maximum > 0)
+ {
+ prgProgress.Indeterminate = false;
+ prgProgress.MinValue = 0;
+ prgProgress.MaxValue = (int)maximum;
+ prgProgress.Value = (int)current;
+ }
+ else
+ prgProgress.Indeterminate = true;
+ });
+ }
+
+ public void UpdateProgress2(string text, string inner, long current, long maximum)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!string.IsNullOrWhiteSpace(inner))
+ lblProgress2.Text = inner;
+ else
+ lblProgress2.Text = text;
+ if(maximum > 0)
+ {
+ prgProgress2.Indeterminate = false;
+ prgProgress2.MinValue = 0;
+ prgProgress2.MaxValue = (int)maximum;
+ prgProgress2.Value = (int)current;
+ }
+ else
+ prgProgress2.Indeterminate = true;
+ });
+ }
+
+ protected void OnBtnStopClicked(object sender, EventArgs e)
+ {
+ stopped = true;
+
+ if(thdFindFiles != null)
+ {
+ thdFindFiles.Abort();
+ thdFindFiles = null;
+ }
+
+ if(thdHashFiles != null)
+ {
+ thdHashFiles.Abort();
+ thdHashFiles = null;
+ }
+
+ if(thdCheckFiles != null)
+ {
+ thdCheckFiles.Abort();
+ thdCheckFiles = null;
+ }
+
+ if(thdAddFiles != null)
+ {
+ thdAddFiles.Abort();
+ thdAddFiles = null;
+ }
+
+ if(thdPackFiles != null)
+ {
+ thdPackFiles.Abort();
+ thdPackFiles = null;
+ }
+
+ if(thdOpenArchive != null)
+ {
+ thdOpenArchive.Abort();
+ thdOpenArchive = null;
+ }
+
+ if(Context.unarProcess != null)
+ {
+ Context.unarProcess.Kill();
+ Context.unarProcess = null;
+ }
+
+ if(Context.tmpFolder != null)
+ {
+ btnStop.Visible = false;
+ lblProgress.Text = "Removing temporary files";
+ prgProgress.Indeterminate = true;
+ Workers.Failed += RemoveTempFilesFailed;
+ Workers.Finished += RemoveTempFilesFinished;
+ thdRemoveTemp = new Thread(Workers.RemoveTempFolder);
+ thdRemoveTemp.Start();
+ }
+ else
+ RestoreUI();
+ }
+
+ public void RestoreUI()
+ {
+ lblProgress.Visible = false;
+ prgProgress.Visible = false;
+ lblProgress2.Visible = false;
+ prgProgress2.Visible = false;
+ btnExit.Enabled = true;
+ btnFolder.Visible = true;
+ btnArchive.Visible = true;
+ lblProgress.Visible = false;
+ prgProgress.Visible = false;
+ btnExit.Enabled = true;
+ btnFolder.Visible = true;
+ btnArchive.Visible = true;
+ Workers.Failed -= FindFilesFailed;
+ Workers.Failed -= HashFilesFailed;
+ Workers.Failed -= ChkFilesFailed;
+ Workers.Failed -= OpenArchiveFailed;
+ Workers.Failed -= AddFilesToDbFailed;
+ Workers.Failed -= PackFilesFailed;
+ Workers.Failed -= ExtractArchiveFailed;
+ Workers.Failed -= RemoveTempFilesFailed;
+ Workers.Finished -= FindFilesFinished;
+ Workers.Finished -= HashFilesFinished;
+ Workers.Finished -= ChkFilesFinished;
+ Workers.Finished -= OpenArchiveFinished;
+ Workers.Finished -= AddFilesToDbFinished;
+ Workers.Finished -= ExtractArchiveFinished;
+ Workers.Finished -= RemoveTempFilesFinished;
+ Workers.FinishedWithText -= PackFilesFinished;
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.UpdateProgress2 -= UpdateProgress2;
+ btnStop.Visible = false;
+ if(fileView != null)
+ fileView.Clear();
+ if(osView != null)
+ {
+ tabOSes.Visible = false;
+ osView.Clear();
+ }
+ }
+
+ public void RemoveTempFilesFailed(string text)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ MessageBox.Show(text, MessageBoxType.Error);
+ Workers.Failed -= RemoveTempFilesFailed;
+ Workers.Finished -= RemoveTempFilesFinished;
+ Context.path = null;
+ Context.tmpFolder = null;
+ RestoreUI();
+ });
+ }
+
+ public void RemoveTempFilesFinished()
+ {
+ Application.Instance.Invoke(delegate
+ {
+ Workers.Failed -= RemoveTempFilesFailed;
+ Workers.Finished -= RemoveTempFilesFinished;
+ Context.path = null;
+ Context.tmpFolder = null;
+ RestoreUI();
+ });
+ }
+
+ void AddToDatabase()
+ {
+ btnRemoveFile.Enabled = false;
+ btnPack.Enabled = false;
+ btnClose.Enabled = false;
+ prgProgress.Visible = true;
+ txtFormat.ReadOnly = true;
+ txtMachine.ReadOnly = true;
+ txtProduct.ReadOnly = true;
+ txtVersion.ReadOnly = true;
+ txtLanguages.ReadOnly = true;
+ txtDeveloper.ReadOnly = true;
+ txtDescription.ReadOnly = true;
+ txtArchitecture.ReadOnly = true;
+ chkOem.Enabled = false;
+ chkFiles.Enabled = false;
+ chkUpdate.Enabled = false;
+ chkUpgrade.Enabled = false;
+ chkNetinstall.Enabled = false;
+ chkSource.Enabled = false;
+
+ Workers.UpdateProgress += UpdateProgress;
+ Workers.Finished += AddFilesToDbFinished;
+ Workers.Failed += AddFilesToDbFailed;
+
+ Context.dbInfo.architecture = txtArchitecture.Text;
+ Context.dbInfo.description = txtDescription.Text;
+ Context.dbInfo.developer = txtDeveloper.Text;
+ Context.dbInfo.format = txtFormat.Text;
+ Context.dbInfo.languages = txtLanguages.Text;
+ Context.dbInfo.machine = txtMachine.Text;
+ Context.dbInfo.product = txtProduct.Text;
+ Context.dbInfo.version = txtVersion.Text;
+ Context.dbInfo.files = chkFiles.Checked.Value;
+ Context.dbInfo.netinstall = chkNetinstall.Checked.Value;
+ Context.dbInfo.oem = chkOem.Checked.Value;
+ Context.dbInfo.source = chkSource.Checked.Value;
+ Context.dbInfo.update = chkUpdate.Checked.Value;
+ Context.dbInfo.upgrade = chkUpgrade.Checked.Value;
+
+ if(Context.metadata != null)
+ {
+ MemoryStream ms = new MemoryStream();
+ XmlSerializer xs = new XmlSerializer(typeof(CICMMetadataType));
+ xs.Serialize(ms, Context.metadata);
+ Context.dbInfo.xml = ms.ToArray();
+ JsonSerializer js = new JsonSerializer();
+ ms = new MemoryStream();
+ StreamWriter sw = new StreamWriter(ms);
+ js.Serialize(sw, Context.metadata, typeof(CICMMetadataType));
+ Context.dbInfo.json = ms.ToArray();
+ }
+ else
+ {
+ Context.dbInfo.xml = null;
+ Context.dbInfo.json = null;
+ }
+
+ thdAddFiles = new Thread(Workers.AddFilesToDb);
+ thdAddFiles.Start();
+ }
+
+ public void AddFilesToDbFinished()
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(thdAddFiles != null)
+ thdAddFiles.Abort();
+
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.Finished -= AddFilesToDbFinished;
+ Workers.Failed -= AddFilesToDbFailed;
+
+ long counter = 0;
+ fileView.Clear();
+ foreach(KeyValuePair kvp in Context.hashes)
+ {
+ UpdateProgress(null, "Updating table", counter, Context.hashes.Count);
+ fileView.Add(new FileEntry { path = kvp.Key, hash = kvp.Value.Sha256, known = true });
+ counter++;
+ }
+
+ // TODO: Update OS table
+
+ if(OnAddedOS != null)
+ OnAddedOS(Context.dbInfo, true, System.IO.Path.Combine(osrepodbmgr.Core.Settings.Current.RepositoryPath,
+ Context.dbInfo.mdid[0].ToString(),
+ Context.dbInfo.mdid[1].ToString(),
+ Context.dbInfo.mdid[2].ToString(),
+ Context.dbInfo.mdid[3].ToString(),
+ Context.dbInfo.mdid[4].ToString(),
+ Context.dbInfo.mdid) + ".zip");
+
+ prgProgress.Visible = false;
+ btnClose.Enabled = true;
+ });
+ }
+
+ public void AddFilesToDbFailed(string text)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!stopped)
+ MessageBox.Show(text, MessageBoxType.Error);
+
+ if(thdAddFiles != null)
+ thdAddFiles.Abort();
+
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.Finished -= AddFilesToDbFinished;
+ Workers.Failed -= AddFilesToDbFailed;
+
+ ChkFilesFinished();
+ });
+ }
+
+ protected void OnBtnPackClicked(object sender, EventArgs e)
+ {
+ btnRemoveFile.Enabled = false;
+ btnPack.Enabled = false;
+ btnClose.Enabled = false;
+ prgProgress.Visible = true;
+ prgProgress2.Visible = true;
+ lblProgress.Visible = true;
+ lblProgress2.Visible = true;
+ txtFormat.ReadOnly = true;
+ txtMachine.ReadOnly = true;
+ txtProduct.ReadOnly = true;
+ txtVersion.ReadOnly = true;
+ txtLanguages.ReadOnly = true;
+ txtDeveloper.ReadOnly = true;
+ txtDescription.ReadOnly = true;
+ txtArchitecture.ReadOnly = true;
+ chkOem.Enabled = false;
+ chkFiles.Enabled = false;
+ chkUpdate.Enabled = false;
+ chkUpgrade.Enabled = false;
+ chkNetinstall.Enabled = false;
+ chkSource.Enabled = false;
+
+ Workers.UpdateProgress += UpdateProgress;
+ Workers.UpdateProgress2 += UpdateProgress2;
+ Workers.FinishedWithText += PackFilesFinished;
+ Workers.Failed += PackFilesFailed;
+
+ Context.dbInfo.architecture = txtArchitecture.Text;
+ Context.dbInfo.description = txtDescription.Text;
+ Context.dbInfo.developer = txtDeveloper.Text;
+ Context.dbInfo.format = txtFormat.Text;
+ Context.dbInfo.languages = txtLanguages.Text;
+ Context.dbInfo.machine = txtMachine.Text;
+ Context.dbInfo.product = txtProduct.Text;
+ Context.dbInfo.version = txtVersion.Text;
+ Context.dbInfo.files = chkFiles.Checked.Value;
+ Context.dbInfo.netinstall = chkNetinstall.Checked.Value;
+ Context.dbInfo.oem = chkOem.Checked.Value;
+ Context.dbInfo.source = chkSource.Checked.Value;
+ Context.dbInfo.update = chkUpdate.Checked.Value;
+ Context.dbInfo.upgrade = chkUpgrade.Checked.Value;
+
+ thdPackFiles = new Thread(Workers.CompressFiles);
+ thdPackFiles.Start();
+ }
+
+ public void PackFilesFinished(string text)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(thdPackFiles != null)
+ thdPackFiles.Abort();
+
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.UpdateProgress2 -= UpdateProgress2;
+ Workers.FinishedWithText -= PackFilesFinished;
+ Workers.Failed -= PackFilesFailed;
+ prgProgress2.Visible = false;
+ lblProgress2.Visible = false;
+
+ AddToDatabase();
+
+ MessageBox.Show(text);
+ });
+ }
+
+ public void PackFilesFailed(string text)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!stopped)
+ MessageBox.Show(text, MessageBoxType.Error);
+
+ if(thdPackFiles != null)
+ thdPackFiles.Abort();
+
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.UpdateProgress2 -= UpdateProgress2;
+ Workers.FinishedWithText -= PackFilesFinished;
+ Workers.Failed -= PackFilesFailed;
+
+ btnRemoveFile.Enabled = true;
+ btnPack.Enabled = true;
+ btnClose.Enabled = true;
+ prgProgress.Visible = false;
+ prgProgress2.Visible = false;
+ lblProgress.Visible = false;
+ lblProgress2.Visible = false;
+ txtFormat.ReadOnly = false;
+ txtMachine.ReadOnly = false;
+ txtProduct.ReadOnly = false;
+ txtVersion.ReadOnly = false;
+ txtLanguages.ReadOnly = false;
+ txtDeveloper.ReadOnly = false;
+ txtDescription.ReadOnly = false;
+ txtArchitecture.ReadOnly = false;
+ chkOem.Enabled = true;
+ chkFiles.Enabled = true;
+ chkUpdate.Enabled = true;
+ chkUpgrade.Enabled = true;
+ chkNetinstall.Enabled = true;
+ chkSource.Enabled = true;
+ });
+ }
+
+ protected void OnBtnArchiveClicked(object sender, EventArgs e)
+ {
+ if(!Context.unarUsable)
+ {
+ MessageBox.Show("Cannot open archives without a working unar installation.", MessageBoxType.Error);
+ return;
+ }
+
+ OpenFileDialog dlgFile = new OpenFileDialog();
+ dlgFile.Title = "Open archive";
+ dlgFile.MultiSelect = false;
+
+ if(dlgFile.ShowDialog(this) == DialogResult.Ok)
+ {
+ stopped = false;
+ lblProgress.Text = "Opening archive";
+ lblProgress.Visible = false;
+ prgProgress.Visible = true;
+ btnExit.Enabled = false;
+ btnFolder.Visible = false;
+ btnArchive.Visible = false;
+ prgProgress.Indeterminate = true;
+
+ thdOpenArchive = new Thread(Workers.OpenArchive);
+ Context.path = dlgFile.FileName;
+ Workers.Failed += OpenArchiveFailed;
+ Workers.Finished += OpenArchiveFinished;
+ btnStop.Visible = true;
+ thdOpenArchive.Start();
+ }
+ }
+
+ public void OpenArchiveFailed(string text)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!stopped)
+ MessageBox.Show(text, MessageBoxType.Error);
+ lblProgress.Visible = false;
+ prgProgress.Visible = false;
+ btnExit.Enabled = true;
+ btnFolder.Visible = true;
+ btnArchive.Visible = true;
+ Workers.Failed -= OpenArchiveFailed;
+ Workers.Finished -= OpenArchiveFinished;
+ thdOpenArchive = null;
+ });
+ }
+
+ public void OpenArchiveFinished()
+ {
+ Application.Instance.Invoke(delegate
+ {
+ stopped = false;
+ lblProgress.Text = "Extracting archive";
+ prgProgress.Visible = true;
+ prgProgress2.Visible = true;
+ btnExit.Enabled = false;
+ btnFolder.Visible = false;
+ btnArchive.Visible = false;
+ Workers.UpdateProgress += UpdateProgress;
+ lblProgress.Visible = true;
+ lblProgress2.Visible = true;
+ Workers.Failed -= OpenArchiveFailed;
+ Workers.Finished -= OpenArchiveFinished;
+ thdOpenArchive = null;
+ Workers.Failed += ExtractArchiveFailed;
+ Workers.Finished += ExtractArchiveFinished;
+ Workers.UpdateProgress2 += UpdateProgress2;
+ thdExtractArchive = new Thread(Workers.ExtractArchive);
+ thdExtractArchive.Start();
+ });
+ }
+
+ public void ExtractArchiveFailed(string text)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!stopped)
+ MessageBox.Show(text, MessageBoxType.Error);
+ lblProgress2.Visible = false;
+ prgProgress2.Visible = false;
+ btnExit.Enabled = true;
+ btnFolder.Visible = true;
+ btnArchive.Visible = true;
+ Workers.Failed -= ExtractArchiveFailed;
+ Workers.Finished -= ExtractArchiveFinished;
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.UpdateProgress2 -= UpdateProgress2;
+ thdExtractArchive = null;
+ if(Context.tmpFolder != null)
+ {
+ btnStop.Visible = false;
+ lblProgress.Text = "Removing temporary files";
+ prgProgress.Indeterminate = true;
+ Workers.Failed += RemoveTempFilesFailed;
+ Workers.Finished += RemoveTempFilesFinished;
+ thdRemoveTemp = new Thread(Workers.RemoveTempFolder);
+ thdRemoveTemp.Start();
+ }
+ });
+ }
+
+ public void ExtractArchiveFinished()
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(thdExtractArchive != null)
+ thdExtractArchive.Abort();
+ stopped = false;
+ lblProgress.Text = "Finding files";
+ lblProgress.Visible = true;
+ lblProgress2.Visible = false;
+ prgProgress.Visible = true;
+ btnExit.Enabled = false;
+ btnFolder.Visible = false;
+ btnArchive.Visible = false;
+ Workers.Failed -= ExtractArchiveFailed;
+ Workers.Finished -= ExtractArchiveFinished;
+ Workers.UpdateProgress -= UpdateProgress;
+ Workers.UpdateProgress2 -= UpdateProgress2;
+ prgProgress.Indeterminate = true;
+
+ thdFindFiles = new Thread(Workers.FindFiles);
+ Workers.Failed += FindFilesFailed;
+ Workers.Finished += FindFilesFinished;
+ btnStop.Visible = true;
+ thdFindFiles.Start();
+ });
+ }
+
+ protected void OnBtnMetadataClicked(object sender, EventArgs e)
+ {
+ dlgMetadata _dlgMetadata = new dlgMetadata();
+ _dlgMetadata.Metadata = Context.metadata;
+ _dlgMetadata.FillFields();
+
+ _dlgMetadata.ShowModal(this);
+
+ if(_dlgMetadata.Modified)
+ {
+ Context.metadata = _dlgMetadata.Metadata;
+
+ if(string.IsNullOrWhiteSpace(txtDeveloper.Text))
+ {
+ foreach(string developer in Context.metadata.Developer)
+ {
+ if(!string.IsNullOrWhiteSpace(txtDeveloper.Text))
+ txtDeveloper.Text += ",";
+ txtDeveloper.Text += developer;
+ }
+ }
+
+ if(string.IsNullOrWhiteSpace(txtProduct.Text))
+ {
+ if(!string.IsNullOrWhiteSpace(Context.metadata.Name))
+ txtProduct.Text = Context.metadata.Name;
+ }
+
+ if(string.IsNullOrWhiteSpace(txtVersion.Text))
+ {
+ if(!string.IsNullOrWhiteSpace(Context.metadata.Version))
+ txtVersion.Text = Context.metadata.Version;
+ }
+
+ if(string.IsNullOrWhiteSpace(txtLanguages.Text))
+ {
+ if(Context.metadata.Languages != null)
+ {
+ foreach(LanguagesTypeLanguage language in Context.metadata.Languages)
+ {
+ if(!string.IsNullOrWhiteSpace(txtLanguages.Text))
+ txtLanguages.Text += ",";
+ txtLanguages.Text += language;
+ }
+ }
+ }
+
+ if(string.IsNullOrWhiteSpace(txtArchitecture.Text))
+ {
+ if(Context.metadata.Architectures != null)
+ {
+ foreach(ArchitecturesTypeArchitecture architecture in Context.metadata.Architectures)
+ {
+ if(!string.IsNullOrWhiteSpace(txtArchitecture.Text))
+ txtArchitecture.Text += ",";
+ txtArchitecture.Text += architecture;
+ }
+ }
+ }
+
+ if(string.IsNullOrWhiteSpace(txtMachine.Text))
+ {
+ if(Context.metadata.Systems != null)
+ {
+ foreach(string machine in Context.metadata.Systems)
+ {
+ if(!string.IsNullOrWhiteSpace(txtMachine.Text))
+ txtMachine.Text += ",";
+ txtMachine.Text += machine;
+ }
+ }
+ }
+
+ btnMetadata.BackgroundColor = Colors.Green;
+ }
+ }
+
+ protected void OnBtnRemoveFileClicked(object sender, EventArgs e)
+ {
+ if(treeFiles.SelectedItem != null)
+ {
+ string name = ((FileEntry)treeFiles.SelectedItem).path;
+ string filesPath;
+
+ if(!string.IsNullOrEmpty(Context.tmpFolder) && Directory.Exists(Context.tmpFolder))
+ filesPath = Context.tmpFolder;
+ else
+ filesPath = Context.path;
+
+ Context.hashes.Remove(name);
+ Context.files.Remove(System.IO.Path.Combine(filesPath, name));
+ fileView.Remove((FileEntry)treeFiles.SelectedItem);
+ }
}
}
-}
+}
\ No newline at end of file
diff --git a/osrepodbmgr.Eto/dlgBlockMedia.xeto b/osrepodbmgr.Eto/dlgBlockMedia.xeto
index e309770..6e35368 100644
--- a/osrepodbmgr.Eto/dlgBlockMedia.xeto
+++ b/osrepodbmgr.Eto/dlgBlockMedia.xeto
@@ -1,6 +1,405 @@
-
-
-
+
+
\ No newline at end of file
diff --git a/osrepodbmgr.Eto/dlgBlockMedia.xeto.cs b/osrepodbmgr.Eto/dlgBlockMedia.xeto.cs
index ea88ad6..0e4384f 100644
--- a/osrepodbmgr.Eto/dlgBlockMedia.xeto.cs
+++ b/osrepodbmgr.Eto/dlgBlockMedia.xeto.cs
@@ -27,17 +27,1643 @@
//
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
using Eto.Forms;
-using Eto.Drawing;
using Eto.Serialization.Xaml;
+using Schemas;
namespace osrepodbmgr.Eto
{
- public class dlgBlockMedia : Panel
+ public class dlgBlockMedia : Dialog
{
+ public BlockMediaType Metadata;
+ public bool Modified;
+
+ #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
+
+ PartitionType partitionIter;
+ FileSystemType filesystemIter;
+ DumpHardwareType dumpHwIter;
+
+ ObservableCollection lstAta;
+ ObservableCollection lstPCIConfiguration;
+ ObservableCollection lstPCIOptionROM;
+ ObservableCollection lstPCMCIACIS;
+ ObservableCollection lstCID;
+ ObservableCollection lstCSD;
+ ObservableCollection lstECSD;
+ ObservableCollection lstInquiry;
+ ObservableCollection lstModeSense;
+ ObservableCollection lstModeSense10;
+ ObservableCollection lstLogSense;
+ ObservableCollection lstEVPDs;
+ ObservableCollection lstUSBDescriptors;
+ ObservableCollection lstMAM;
+ ObservableCollection lstTracks;
+ ObservableCollection lstPartitions;
+ ObservableCollection lstDumpHw;
+ ObservableCollection lstAdditionalInformation;
+
+ class StringEntry
+ {
+ public string str;
+ }
+
+ bool editingPartition;
+ bool editingDumpHw;
+
+ // Non-editable fields
+ ChecksumType[] checksums;
+ BlockSizeType[] variableBlockSize;
+ TapePartitionType[] tapeInformation;
+ ScansType scans;
+
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 == null ? null : v.Name) },
+ HeaderText = "Software"
+ });
+ treeDumpHardware.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.Software).Convert(v => v == null ? null : v.Version) },
+ HeaderText = "Version"
+ });
+ treeDumpHardware.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.Software).Convert(v => v == null ? null : 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
+
+ GridColumn fileColumn = new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.Image) },
+ HeaderText = "File"
+ };
+ GridColumn sizeColumn = new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.Size).Convert(v => v.ToString()) },
+ HeaderText = "Size"
+ };
+
+ #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;
+ }
+
+ 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;
+ 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 != null && 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 = string.Format("0x{0:X4}", Metadata.PCI.VendorID);
+ txtPCIProduct.Text = string.Format("0x{0:X4}", Metadata.PCI.DeviceID);
+ 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 = string.Format("0x{0:X4}", Metadata.PCMCIA.ManufacturerCode);
+ if(Metadata.PCMCIA.CardCodeSpecified)
+ txtCardCode.Text = string.Format("0x{0:X4}", Metadata.PCMCIA.CardCode);
+ 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 != null && 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.SecureDigital.ExtendedCSD != null)
+ {
+ chkECSD.Checked = true;
+ treeECSD.Visible = true;
+ lstECSD.Add(Metadata.SecureDigital.ExtendedCSD);
+ }
+ }
+ if(Metadata.SCSI != null && 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 = string.Format("0x{0:X4}", Metadata.USB.VendorID);
+ txtUSBProduct.Text = string.Format("0x{0:X4}", Metadata.USB.ProductID);
+ 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;
+ 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)
+ {
+ int temp, temp2;
+
+ if(!int.TryParse(txtPartitionStart.Text, out temp))
+ {
+ MessageBox.Show("Partition start must be a number", MessageBoxType.Error);
+ return;
+ }
+
+ if(!int.TryParse(txtPartitionEnd.Text, out 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();
+ partitionIter.Sequence = (int)spPartitionSequence.Value;
+ partitionIter.StartSector = int.Parse(txtPartitionStart.Text);
+ partitionIter.EndSector = int.Parse(txtPartitionEnd.Text);
+ partitionIter.Type = txtPartitionType.Text;
+ partitionIter.Name = txtPartitionName.Text;
+ partitionIter.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();
+ _dlgFilesystem.Metadata = filesystemIter;
+ _dlgFilesystem.FillFields();
+ _dlgFilesystem.ShowModal(this);
+
+ if(_dlgFilesystem.Modified)
+ {
+ ((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;
+
+ btnCancelHardware.Visible = false;
+ btnEditHardware.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();
+ dumpHwIter.Manufacturer = txtHWManufacturer.Text;
+ dumpHwIter.Model = txtHWModel.Text;
+ dumpHwIter.Revision = txtHWRevision.Text;
+ dumpHwIter.Firmware = txtHWFirmware.Text;
+ dumpHwIter.Serial = txtHWSerial.Text;
+ if(!string.IsNullOrWhiteSpace(txtDumpName.Text) || !string.IsNullOrWhiteSpace(txtDumpVersion.Text) || !string.IsNullOrWhiteSpace(txtDumpOS.Text))
+ {
+ dumpHwIter.Software = new SoftwareType();
+ dumpHwIter.Software.Name = txtDumpName.Text;
+ dumpHwIter.Software.Version = txtDumpVersion.Text;
+ dumpHwIter.Software.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 = (int)spExtentStart.Value, End = (int)spExtentEnd.Value });
+ }
+
+ protected void OnBtnCancelClicked(object sender, EventArgs e)
+ {
+ Close();
+ }
+
+ protected void OnBtnSaveClicked(object sender, EventArgs e)
+ {
+ long ltmp;
+
+ #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 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();
+
+ Metadata.Image = new Schemas.ImageType();
+ Metadata.Image.Value = txtImage.Text;
+ Metadata.Image.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;
+
+ if(chkSequence.Checked.Value)
+ {
+ Metadata.Sequence = new SequenceType();
+ Metadata.Sequence.MediaTitle = txtMediaTitle.Text;
+ Metadata.Sequence.MediaSequence = (int)spSequence.Value;
+ Metadata.Sequence.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();
+ Metadata.ATA.Identify = lstAta[0];
+ }
+
+ if(chkPCI.Checked.Value)
+ {
+ Metadata.PCI = new PCIType();
+ Metadata.PCI.VendorID = Convert.ToUInt16(txtPCIVendor.Text, 16);
+ Metadata.PCI.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.SecureDigital.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();
+ Metadata.USB.VendorID = Convert.ToUInt16(txtUSBVendor.Text, 16);
+ Metadata.USB.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();
}
}
-}
+}
\ No newline at end of file
diff --git a/osrepodbmgr.Eto/dlgFilesystem.xeto b/osrepodbmgr.Eto/dlgFilesystem.xeto
index e309770..fac59b8 100644
--- a/osrepodbmgr.Eto/dlgFilesystem.xeto
+++ b/osrepodbmgr.Eto/dlgFilesystem.xeto
@@ -1,6 +1,81 @@
-
-
-
+
+
diff --git a/osrepodbmgr.Eto/dlgFilesystem.xeto.cs b/osrepodbmgr.Eto/dlgFilesystem.xeto.cs
index e788485..a4727a7 100644
--- a/osrepodbmgr.Eto/dlgFilesystem.xeto.cs
+++ b/osrepodbmgr.Eto/dlgFilesystem.xeto.cs
@@ -26,18 +26,229 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
using System;
-using System.Collections.Generic;
using Eto.Forms;
-using Eto.Drawing;
using Eto.Serialization.Xaml;
+using Schemas;
namespace osrepodbmgr.Eto
{
- public class dlgFilesystem : Panel
+ public class dlgFilesystem : Dialog
{
+ public FileSystemType Metadata;
+ public bool Modified;
+
+ #region XAML UI elements
+#pragma warning disable 0649
+ TextBox txtType;
+ TextBox txtFiles;
+ CheckBox chkBootable;
+ CheckBox chkDirty;
+ NumericUpDown spClusterSize;
+ TextBox txtClusters;
+ TextBox txtFreeClusters;
+ CheckBox chkCreationDate;
+ DateTimePicker cldCreationDate;
+ CheckBox chkModificationDate;
+ DateTimePicker cldModificationDate;
+ CheckBox chkEffectiveDate;
+ DateTimePicker cldEffectiveDate;
+ CheckBox chkExpirationDate;
+ DateTimePicker cldExpirationDate;
+ CheckBox chkBackupDate;
+ DateTimePicker cldBackupDate;
+ TextBox txtLabel;
+ TextBox txtSerial;
+ TextBox txtSysId;
+ TextBox txtVolId;
+ TextBox txtPubId;
+ TextBox txtDataId;
+ TextBox txtAppId;
+#pragma warning restore 0649
+ #endregion XAML UI elements
+
public dlgFilesystem()
{
XamlReader.Load(this);
+ Modified = false;
+ }
+ public void FillFields()
+ {
+ if(Metadata == null)
+ return;
+
+ if(Metadata.Type != null)
+ txtType.Text = Metadata.Type;
+ if(Metadata.CreationDateSpecified)
+ {
+ chkCreationDate.Checked = true;
+ cldCreationDate.Enabled = true;
+ cldCreationDate.Value = Metadata.CreationDate;
+ }
+ if(Metadata.ModificationDateSpecified)
+ {
+ chkModificationDate.Checked = true;
+ cldModificationDate.Enabled = true;
+ cldModificationDate.Value = Metadata.ModificationDate;
+ }
+ if(Metadata.BackupDateSpecified)
+ {
+ chkBackupDate.Checked = true;
+ cldBackupDate.Enabled = true;
+ cldBackupDate.Value = Metadata.BackupDate;
+ }
+ spClusterSize.Value = Metadata.ClusterSize;
+ txtClusters.Text = Metadata.Clusters.ToString();
+ if(Metadata.FilesSpecified)
+ txtFiles.Text = Metadata.Files.ToString();
+ chkBootable.Checked = Metadata.Bootable;
+ if(Metadata.VolumeSerial != null)
+ txtSerial.Text = Metadata.VolumeSerial;
+ if(Metadata.VolumeName != null)
+ txtLabel.Text = Metadata.VolumeName;
+ if(Metadata.FreeClustersSpecified)
+ txtFreeClusters.Text = Metadata.FreeClusters.ToString();
+ chkDirty.Checked = Metadata.Dirty;
+ if(Metadata.ExpirationDateSpecified)
+ {
+ chkExpirationDate.Checked = true;
+ cldExpirationDate.Enabled = true;
+ cldExpirationDate.Value = Metadata.ExpirationDate;
+ }
+ if(Metadata.EffectiveDateSpecified)
+ {
+ chkEffectiveDate.Checked = true;
+ cldEffectiveDate.Enabled = true;
+ cldEffectiveDate.Value = Metadata.EffectiveDate;
+ }
+ if(Metadata.SystemIdentifier != null)
+ txtSysId.Text = Metadata.SystemIdentifier;
+ if(Metadata.VolumeSetIdentifier != null)
+ txtVolId.Text = Metadata.VolumeSetIdentifier;
+ if(Metadata.PublisherIdentifier != null)
+ txtPubId.Text = Metadata.PublisherIdentifier;
+ if(Metadata.DataPreparerIdentifier != null)
+ txtDataId.Text = Metadata.DataPreparerIdentifier;
+ if(Metadata.ApplicationIdentifier != null)
+ txtAppId.Text = Metadata.ApplicationIdentifier;
+ }
+
+ protected void OnChkCreationDateToggled(object sender, EventArgs e)
+ {
+ cldCreationDate.Enabled = chkCreationDate.Checked.Value;
+ }
+
+ protected void OnChkModificationDateToggled(object sender, EventArgs e)
+ {
+ cldModificationDate.Enabled = chkModificationDate.Checked.Value;
+ }
+
+ protected void OnChkEffectiveDateToggled(object sender, EventArgs e)
+ {
+ cldEffectiveDate.Enabled = chkEffectiveDate.Checked.Value;
+ }
+
+ protected void OnChkExpirationDateToggled(object sender, EventArgs e)
+ {
+ cldExpirationDate.Enabled = chkExpirationDate.Checked.Value;
+ }
+
+ protected void OnChkBackupDateToggled(object sender, EventArgs e)
+ {
+ cldBackupDate.Enabled = chkBackupDate.Checked.Value;
+ }
+
+ protected void OnBtnCancelClicked(object sender, EventArgs e)
+ {
+ Modified = false;
+ Close();
+ }
+
+ protected void OnBtnSaveClicked(object sender, EventArgs e)
+ {
+ long temp;
+
+ if(string.IsNullOrWhiteSpace(txtType.Text))
+ MessageBox.Show("Filesystem type cannot be empty", MessageBoxType.Error);
+
+ if(spClusterSize.Value < 1)
+ MessageBox.Show("Clusters must be bigger than 0 bytes", MessageBoxType.Error);
+
+ if(!long.TryParse(txtClusters.Text, out temp))
+ MessageBox.Show("Clusters must be a number", MessageBoxType.Error);
+
+ if(temp < 1)
+ MessageBox.Show("Filesystem must have more than 0 clusters", MessageBoxType.Error);
+
+ if(!string.IsNullOrWhiteSpace(txtFiles.Text) && !long.TryParse(txtFiles.Text, out temp))
+ MessageBox.Show("Files must be a number, or empty for unknown", MessageBoxType.Error);
+
+ if(!string.IsNullOrWhiteSpace(txtFiles.Text) && temp < 0)
+ MessageBox.Show("Files must be positive", MessageBoxType.Error);
+
+ if(!string.IsNullOrWhiteSpace(txtFreeClusters.Text) && !long.TryParse(txtFreeClusters.Text, out temp))
+ MessageBox.Show("Free clusters must be a number or empty for unknown", MessageBoxType.Error);
+
+ if(!string.IsNullOrWhiteSpace(txtFreeClusters.Text) && temp < 0)
+ MessageBox.Show("Free clusters must be positive", MessageBoxType.Error);
+
+ Metadata = new FileSystemType();
+ Metadata.Type = txtType.Text;
+ if(chkCreationDate.Checked.Value)
+ {
+ Metadata.CreationDateSpecified = true;
+ Metadata.CreationDate = cldCreationDate.Value.Value;
+ }
+ if(chkModificationDate.Checked.Value)
+ {
+ Metadata.ModificationDateSpecified = true;
+ Metadata.ModificationDate = cldModificationDate.Value.Value;
+ }
+ if(chkBackupDate.Checked.Value)
+ {
+ Metadata.BackupDateSpecified = true;
+ Metadata.BackupDate = cldBackupDate.Value.Value;
+ }
+ Metadata.ClusterSize = (int)spClusterSize.Value;
+ Metadata.Clusters = long.Parse(txtClusters.Text);
+ if(!string.IsNullOrWhiteSpace(txtFiles.Text))
+ {
+ Metadata.FilesSpecified = true;
+ Metadata.Files = long.Parse(txtFiles.Text);
+ }
+ Metadata.Bootable = chkBootable.Checked.Value;
+ if(!string.IsNullOrWhiteSpace(txtSerial.Text))
+ Metadata.VolumeSerial = txtSerial.Text;
+ if(!string.IsNullOrWhiteSpace(txtLabel.Text))
+ Metadata.VolumeName = txtLabel.Text;
+ if(!string.IsNullOrWhiteSpace(txtFreeClusters.Text))
+ {
+ Metadata.FreeClustersSpecified = true;
+ Metadata.FreeClusters = long.Parse(txtFreeClusters.Text);
+ }
+ Metadata.Dirty = chkDirty.Checked.Value;
+ if(chkExpirationDate.Checked.Value)
+ {
+ Metadata.ExpirationDateSpecified = true;
+ Metadata.ExpirationDate = cldExpirationDate.Value.Value;
+ }
+ if(chkEffectiveDate.Checked.Value)
+ {
+ Metadata.EffectiveDateSpecified = true;
+ Metadata.EffectiveDate = cldEffectiveDate.Value.Value;
+ }
+ if(!string.IsNullOrWhiteSpace(txtSysId.Text))
+ Metadata.SystemIdentifier = txtSysId.Text;
+ if(!string.IsNullOrWhiteSpace(txtVolId.Text))
+ Metadata.VolumeSetIdentifier = txtVolId.Text;
+ if(!string.IsNullOrWhiteSpace(txtPubId.Text))
+ Metadata.PublisherIdentifier = txtPubId.Text;
+ if(!string.IsNullOrWhiteSpace(txtDataId.Text))
+ Metadata.DataPreparerIdentifier = txtDataId.Text;
+ if(!string.IsNullOrWhiteSpace(txtAppId.Text))
+ Metadata.ApplicationIdentifier = txtAppId.Text;
+
+ Modified = true;
+ Close();
}
}
-}
+}
\ No newline at end of file
diff --git a/osrepodbmgr.Eto/dlgHelp.xeto b/osrepodbmgr.Eto/dlgHelp.xeto
index e309770..6c66d6c 100644
--- a/osrepodbmgr.Eto/dlgHelp.xeto
+++ b/osrepodbmgr.Eto/dlgHelp.xeto
@@ -1,6 +1,11 @@
-
-
-
+
+
diff --git a/osrepodbmgr.Eto/dlgHelp.xeto.cs b/osrepodbmgr.Eto/dlgHelp.xeto.cs
index 6268f24..16897e7 100644
--- a/osrepodbmgr.Eto/dlgHelp.xeto.cs
+++ b/osrepodbmgr.Eto/dlgHelp.xeto.cs
@@ -33,11 +33,142 @@ using Eto.Serialization.Xaml;
namespace osrepodbmgr.Eto
{
- public class dlgHelp : Panel
+ public class dlgHelp : Dialog
{
+ #region XAML UI elements
+ #pragma warning disable 0649
+ TextArea txtHelp;
+ #pragma warning restore 0649
+ #endregion XAML UI elements
+
public dlgHelp()
{
XamlReader.Load(this);
+
+ txtHelp.Text = "This is the naming scheme and folder organization conventions for the Operating System Repository.\n\n" +
+ "The basic layout is as follows:\n\n" +
+ "/////oem/for /<[format]_update/upgrade/files/source/netinstall/description>.zip\n" +
+ "All fields should contain only 7-bit ASCII.\n\n" +
+ "\n" +
+ "-----------\n" +
+ "This is the main developer of the operating system or associated software. e.g. Microsoft\n\n" +
+ "\n" +
+ "---------\n" +
+ "This is the name of the operating system or associated software. e.g. Windows NT\n\n" +
+ "\n" +
+ "---------\n" +
+ "This is the version of the operating system or associated software. e.g. 6.00.6000.16386\n" +
+ "Service pack and release markers should be appended. e.g. 6.10.7601.16385 (RTM)\n" +
+ "Build can be specified by appending \"build\". e.g. 10.2.7 build 6S80\n" +
+ "And combined. e.g. 10.5 build 9A581 (Server)\n" +
+ "Version with same version number but different build date should have it appended. Date format should be YYYYmm[dd]. e.g. 10 201009\n\n" +
+ "\n" +
+ "----------\n" +
+ "This specifies the language localization and translation:\n" +
+ "xxx: Language variation, e.g. German = deu\n" +
+ "xxx_yy: Country specific language variation. e.g. Swiss German = deu_ch\n" +
+ "multi: The only known variation of the product that contains more than a language\n" +
+ "xxx,xxx,xxx and xxx_yy,xxx_yy,xxx_yy: The variation contains more than a single language\n" +
+ "Where xxx is the ISO-639-2/T language code and yy is the ISO-3166-1 alpha-2 country code.\n" +
+ "https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\n" +
+ "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2\n" +
+ "If the product has ever been only released in one language variation, being it English (like CP/M) or multilanguage " +
+ "(like Mac OS X and Linux), this field should be omitted.\n\n" +
+ "\n" +
+ "--------------\n" +
+ "The processor architecture the product is compiled for.\n" +
+ "Omitted if it has only ever been compiled for a single one, contains all supported ones in same files, " +
+ "or it is source code containing support for several of them.\n" +
+ "Exact one depends on the product (that is, the one that the product uses to identify itself, should be used). Examples:\n" +
+ "* x86, i86, i386, i486, i586, i686, ia32: Intel Architecture 32 aka 8086 aka iAPX86\n" +
+ "* x64, amd64, x86_64: AMD64 aka x86_64 aka EM64T\n" +
+ "* ia64: Intel Architecture 64 aka Itanium\n" +
+ "* sparc: SPARC\n" +
+ "* sun4u, sun4m, sun1, sun2, sun3: Specific Sun architectures that specify not only the processor architecture but the whole system one.\n" +
+ "* 68k, ppc, fat: For products that run under Mac OS indicate they require a Macintosh, a Power Macintosh, or can run on both, respectively.\n" +
+ "* rpi, rpi2, beaglebone, bananapi: Specific whole systems that share a processor architecture but require a completely different variant.\n\n" +
+ "oem\n" +
+ "---\n" +
+ "Present if the variant is OEM. Omitted otherwise.\n\n" +
+ "for \n" +
+ "-------------\n" +
+ "Present if the variant requires a specific computer to run.\n" +
+ "Useful for computer restoration variants.\n" +
+ "e.g. for Power Mac 5200\n" +
+ "e.g. for Tandy 1000\n\n" +
+ "<[format]/update/upgrade/files/source/netinstall/description>.zip\n" +
+ "-----------------------------------------------------------------\n" +
+ "This is the file containing the product itself.\n" +
+ "It should be compressed using ZIP with certain parameters (see below).\n" +
+ "Several of them can be combined separated with underscores.\n" +
+ "Naming as following:\n" +
+ "* [format]: If the variation is encoded in a disk image format that's neither a simple dump of sectors (.iso/.dsk/.xdf) " +
+ "or a BinCue/BinToc (.bin+.cue/.bin+.toc) format should be substituted to a descriptive name for the format. e.g.: [Nero], [CloneCD]\n" +
+ "* update: Should be used when the product requires and updates a previous point release or build to the new one. " +
+ "Product version should be the updated, not the required, one. e.g.: 1.3 updates to 1.3.1 or 2.0 updates to 2.5\n" +
+ "* upgrade: Should be used when the product requires and updates a previous version to the new one. Product version should be the updated, " +
+ "not the required, one. e.g.: 2.0 updates to 3.0 or MS-DOS updates to Windows 95.\n" +
+ "* files: Should be used when the contents of the product disks are dumped as is (copied from the media) or it contains already installed " +
+ "files.\n" +
+ "* source: Should be used when it contains the source code for the product.\n" +
+ "* netinstall: Similar to files except that the files are designed to be put in a network share for remote installation of the product.\n" +
+ "* description: Free form description or product part number if it is known.\n\n" +
+ "Compression\n" +
+ "-----------\n" +
+ "The product should be compressed using ZIP with Deflate algorithm and UTF-8 headers. Zip64 extensions may be used. " +
+ "UNIX extensions MUST be used for products that require them (e.g. it contains softlinks).\n" +
+ "In the doubt, use Info-ZIP with following parameters:\n" +
+ "zip -9ry -dd archive.zip .\n" +
+ "If the product requires Acorn, BeOS or OS/2 extended attributes it should be compressed using the corresponding Info-ZIP version under " +
+ "that operating system so the required extension is used.\n" +
+ "DO NOT recompress archives in an operating system which zip product doesn't support all already present headers.\n" +
+ "DO NOT use TorrentZip. It discards all headers as well as date stamps.\n" +
+ "DO NOT use Mac OS headers. For conserving FinderInfo and Resource Fork see below.\n\n" +
+ "FinderInfo and Resource Fork\n" +
+ "----------------------------\n" +
+ "FinderInfo and Resource Fork should be stored as Mac OS X AppleDouble format: file and ._file\n" +
+ "This format is understand by all Mac OS X versions under any filesystem or a CIFS/SMB network share.\n" +
+ "Also mkisofs recognizes it and is able to create an HFS partition with them correctly set.\n" +
+ "Other formats should be converted to this one.\n\n" +
+ "Metadata\n" +
+ "--------\n" +
+ "Each archive should be accompanied with a JSON metadata file using the CICM Metadata format. " +
+ "Name for metadata sidecar should be same as the archive changing the extension to .json.\n" +
+ "If the archive can be modified (doesn't contain ZIP headers you would lose) the metadata should be put inside the archive as a file " +
+ "named metadata.json.\n\n" +
+ "Recovery\n" +
+ "--------\n" +
+ "Disks fail, bit rot happens, so every archive as well as the metadata file should have a PAR2 recovery set created.\n" +
+ "Example command line (with 5% redundancy):\n" +
+ "par2 c -r5 archive.par2 archive.zip archive.json\n\n" +
+ "Result\n" +
+ "------\n" +
+ "In the end you get something like this:\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.json\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.par2\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol000+01.par2\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol001+02.par2\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol003+04.par2\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol007+08.par2\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol015+16.par2\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol031+32.par2\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol063+37.par2\n" +
+ "Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.zip\n" +
+ "QNX/QNX/20090229/source.json\n" +
+ "QNX/QNX/20090229/source.par2\n" +
+ "QNX/QNX/20090229/source.vol000+01.par2\n" +
+ "QNX/QNX/20090229/source.vol001+02.par2\n" +
+ "QNX/QNX/20090229/source.vol003+04.par2\n" +
+ "QNX/QNX/20090229/source.vol007+08.par2\n" +
+ "QNX/QNX/20090229/source.vol015+16.par2\n" +
+ "QNX/QNX/20090229/source.vol031+32.par2\n" +
+ "QNX/QNX/20090229/source.vol063+37.par2\n" +
+ "QNX/QNX/20090229/source.zip";
+ }
+
+ protected void OnBtnOKClicked(object sender, EventArgs e)
+ {
+ Close();
}
}
}
diff --git a/osrepodbmgr.Eto/dlgMetadata.xeto b/osrepodbmgr.Eto/dlgMetadata.xeto
index e309770..1838d5c 100644
--- a/osrepodbmgr.Eto/dlgMetadata.xeto
+++ b/osrepodbmgr.Eto/dlgMetadata.xeto
@@ -1,6 +1,246 @@
-
-
-
+
+
diff --git a/osrepodbmgr.Eto/dlgMetadata.xeto.cs b/osrepodbmgr.Eto/dlgMetadata.xeto.cs
index 563fca5..9584ea1 100644
--- a/osrepodbmgr.Eto/dlgMetadata.xeto.cs
+++ b/osrepodbmgr.Eto/dlgMetadata.xeto.cs
@@ -27,17 +27,1186 @@
//
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Threading;
using Eto.Forms;
-using Eto.Drawing;
using Eto.Serialization.Xaml;
+using osrepodbmgr.Core;
+using Schemas;
namespace osrepodbmgr.Eto
{
- public class dlgMetadata : Panel
+ public class dlgMetadata : Dialog
{
+ public CICMMetadataType Metadata;
+
+ ObservableCollection lstKeywords;
+ ObservableCollection lstBarcodes;
+ ObservableCollection lstCategories;
+ ObservableCollection lstSubcategories;
+ ObservableCollection lstLanguages;
+ ObservableCollection lstSystems;
+ ObservableCollection lstArchitectures;
+ ObservableCollection lstDiscs;
+ ObservableCollection lstDisks;
+
+ ObservableCollection lstBarcodeTypes;
+ ObservableCollection lstLanguageTypes;
+ ObservableCollection lstArchitecturesTypes;
+ ObservableCollection lstFilesForMedia;
+
+ Thread thdDisc;
+ Thread thdDisk;
+ bool stopped;
+
+ #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 tabSystems;
+ TextBox txtNewSystem;
+ GridView treeSystems;
+ 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
+
+ public bool Modified;
+
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();
+ lstSystems = 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"
+ });
+ treeSystems.Columns.Add(new GridColumn
+ {
+ DataCell = new TextBoxCell { Binding = Binding.Property(r => r.str) },
+ HeaderText = "System"
+ });
+ 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;
+ treeSystems.DataStore = lstSystems;
+ treeArchitectures.DataStore = lstArchitectures;
+ treeDiscs.DataStore = lstDiscs;
+ treeDisks.DataStore = lstDisks;
+
+ treeKeywords.AllowMultipleSelection = false;
+ treeBarcodes.AllowMultipleSelection = false;
+ treeCategories.AllowMultipleSelection = false;
+ treeSubcategories.AllowMultipleSelection = false;
+ treeLanguages.AllowMultipleSelection = false;
+ treeSystems.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();
+ }
+
+ 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.Systems != null)
+ {
+ foreach(string system in Metadata.Systems)
+ lstSystems.Add(new StringEntry { str = system });
+ }
+
+ 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();
+ files.Add(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(Schemas.BorderType border in disc.LeadIn)
+ files.Add(border.Image);
+ }
+ if(disc.LeadInCdText != null)
+ files.Add(disc.LeadInCdText.Image);
+ if(disc.LeadOut != null)
+ {
+ foreach(Schemas.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)
+ {
+ foreach(TrackType track in disc.Track)
+ files.Add(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();
+ files.Add(disk.Image.Value);
+ if(disk.ATA != null && disk.ATA.Identify != null)
+ files.Add(disk.ATA.Identify.Image);
+ if(disk.MAM != null)
+ files.Add(disk.MAM.Image);
+ if(disk.PCI != null && disk.PCI.ExpansionROM != null)
+ files.Add(disk.PCI.ExpansionROM.Image.Value);
+ if(disk.PCMCIA != null && 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)
+ {
+ foreach(EVPDType evpd in disk.SCSI.EVPD)
+ files.Add(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.SecureDigital.ExtendedCSD != null)
+ files.Add(disk.SecureDigital.ExtendedCSD.Image);
+ }
+ if(disk.TapeInformation != null)
+ {
+ foreach(TapePartitionType tapePart in disk.TapeInformation)
+ files.Add(tapePart.Image.Value);
+ }
+ if(disk.Track != null)
+ {
+ foreach(BlockTrackType track in disk.Track)
+ files.Add(track.Image.Value);
+ }
+ if(disk.USB != null && disk.USB.Descriptors != null)
+ files.Add(disk.USB.Descriptors.Image);
+
+ foreach(string file in files)
+ {
+ if(lstFilesForMedia.Contains(file))
+ lstFilesForMedia.Remove(file);
+ }
+ }
+ }
+ }
+
+ 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))
+ {
+ 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))
+ {
+ lstLanguages.Add(new StringEntry { str = cmbLanguages.Text });
+ lstLanguageTypes.Remove(cmbLanguages.Text);
+ }
+ }
+
+ protected void OnBtnRemoveLanguageClicked(object sender, EventArgs e)
+ {
+ if(treeLanguages.SelectedItem != null)
+ {
+ lstLanguageTypes.Add(((StringEntry)treeLanguages.SelectedItem).str);
+ lstLanguages.Remove((StringEntry)treeLanguages.SelectedItem);
+ }
+ }
+
+ protected void OnBtnClearLanguagesClicked(object sender, EventArgs e)
+ {
+ lstLanguages.Clear();
+ FillLanguagesCombo();
+ }
+
+ protected void OnBtnAddSystemClicked(object sender, EventArgs e)
+ {
+ lstSystems.Add(new StringEntry { str = txtNewSystem.Text });
+ txtNewSystem.Text = "";
+ }
+
+ protected void OnBtnClearSystemsClicked(object sender, EventArgs e)
+ {
+ lstSystems.Clear();
+ }
+
+ protected void OnBtnRemoveSystemClicked(object sender, EventArgs e)
+ {
+ if(treeSystems.SelectedItem != null)
+ lstSystems.Remove((StringEntry)treeSystems.SelectedItem);
+ }
+
+ protected void OnBtnAddArchitectureClicked(object sender, EventArgs e)
+ {
+ if(!string.IsNullOrWhiteSpace(cmbArchitectures.Text))
+ {
+ 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)
+ {
+ 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;
+ tabSystems.Visible = false;
+ tabArchitectures.Visible = false;
+ tabDisks.Visible = false;
+ prgAddDisc1.Visible = true;
+ prgAddDisc2.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)
+ {
+ if(thdDisc != null)
+ thdDisc.Abort();
+ stopped = true;
+ OnDiscAddFailed(null);
+ }
+
+ public void UpdateDiscProgress1(string text, string inner, long current, long maximum)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!string.IsNullOrWhiteSpace(inner))
+ lblAddDisc1.Text = inner;
+ else
+ lblAddDisc1.Text = text;
+ if(maximum > 0)
+ {
+ prgAddDisc1.Indeterminate = false;
+ prgAddDisc1.MinValue = 0;
+ prgAddDisc1.MaxValue = (int)maximum;
+ prgAddDisc1.Value = (int)current;
+ }
+ else
+ prgAddDisc1.Indeterminate = true;
+ });
+ }
+
+ public void UpdateDiscProgress2(string text, string inner, long current, long maximum)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!string.IsNullOrWhiteSpace(inner))
+ lblAddDisc2.Text = inner;
+ else
+ lblAddDisc2.Text = text;
+ if(maximum > 0)
+ {
+ 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;
+ tabSystems.Visible = true;
+ tabArchitectures.Visible = true;
+ tabDisks.Visible = true;
+ prgAddDisc1.Visible = false;
+ prgAddDisc2.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();
+ files.Add(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(Schemas.BorderType border in disc.LeadIn)
+ files.Add(border.Image);
+ }
+ if(disc.LeadInCdText != null)
+ files.Add(disc.LeadInCdText.Image);
+ if(disc.LeadOut != null)
+ {
+ foreach(Schemas.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)
+ {
+ foreach(TrackType track in disc.Track)
+ files.Add(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;
+ tabSystems.Visible = true;
+ tabArchitectures.Visible = true;
+ tabDisks.Visible = true;
+ prgAddDisc1.Visible = false;
+ prgAddDisc2.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)
+ {
+ 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;
+ tabSystems.Visible = false;
+ tabArchitectures.Visible = false;
+ tabDiscs.Visible = false;
+ prgAddDisk1.Visible = true;
+ prgAddDisk2.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)
+ {
+ if(thdDisk != null)
+ thdDisk.Abort();
+ stopped = true;
+ OnDiskAddFailed(null);
+ }
+
+ public void UpdateDiskProgress1(string text, string inner, long current, long maximum)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!string.IsNullOrWhiteSpace(inner))
+ lblAddDisk1.Text = inner;
+ else
+ lblAddDisk1.Text = text;
+ if(maximum > 0)
+ {
+ prgAddDisk1.Indeterminate = false;
+ prgAddDisk1.MinValue = 0;
+ prgAddDisk1.MaxValue = (int)maximum;
+ prgAddDisk1.Value = (int)current;
+ }
+ else
+ prgAddDisk1.Indeterminate = true;
+ });
+ }
+
+ public void UpdateDiskProgress2(string text, string inner, long current, long maximum)
+ {
+ Application.Instance.Invoke(delegate
+ {
+ if(!string.IsNullOrWhiteSpace(inner))
+ lblAddDisk2.Text = inner;
+ else
+ lblAddDisk2.Text = text;
+ if(maximum > 0)
+ {
+ 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;
+ tabSystems.Visible = true;
+ tabArchitectures.Visible = true;
+ tabDiscs.Visible = true;
+ prgAddDisk1.Visible = false;
+ prgAddDisk2.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();
+ files.Add(disk.Image.Value);
+ if(disk.ATA != null && disk.ATA.Identify != null)
+ files.Add(disk.ATA.Identify.Image);
+ if(disk.MAM != null)
+ files.Add(disk.MAM.Image);
+ if(disk.PCI != null && disk.PCI.ExpansionROM != null)
+ files.Add(disk.PCI.ExpansionROM.Image.Value);
+ if(disk.PCMCIA != null && 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)
+ {
+ foreach(EVPDType evpd in disk.SCSI.EVPD)
+ files.Add(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.SecureDigital.ExtendedCSD != null)
+ files.Add(disk.SecureDigital.ExtendedCSD.Image);
+ }
+ if(disk.TapeInformation != null)
+ {
+ foreach(TapePartitionType tapePart in disk.TapeInformation)
+ files.Add(tapePart.Image.Value);
+ }
+ if(disk.Track != null)
+ {
+ foreach(BlockTrackType track in disk.Track)
+ files.Add(track.Image.Value);
+ }
+ if(disk.USB != null && 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;
+ tabSystems.Visible = true;
+ tabArchitectures.Visible = true;
+ tabDiscs.Visible = true;
+ prgAddDisk1.Visible = false;
+ prgAddDisk2.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)
+ {
+ 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();
+ barcode.type = entry.type;
+ barcode.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);
+
+ foreach(StringEntry entry in lstSystems)
+ systems.Add(entry.str);
+
+ 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();
+
+ Modified = true;
+ Close();
+ }
+
+ protected void OnBtnEditDiscClicked(object sender, EventArgs e)
+ {
+ if(treeDiscs.SelectedItem == null)
+ return;
+
+ dlgOpticalDisc _dlgOpticalDisc = new dlgOpticalDisc();
+ _dlgOpticalDisc.Title = string.Format("Editing disc metadata for {0}", ((DiscEntry)treeDiscs.SelectedItem).path);
+ _dlgOpticalDisc.Metadata = ((DiscEntry)treeDiscs.SelectedItem).disc;
+ _dlgOpticalDisc.FillFields();
+ _dlgOpticalDisc.ShowModal(this);
+
+ if(_dlgOpticalDisc.Modified)
+ {
+ 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();
+ _dlgBlockMedia.Title = string.Format("Editing disk metadata for {0}", ((DiskEntry)treeDisks.SelectedItem).path);
+ _dlgBlockMedia.Metadata = ((DiskEntry)treeDisks.SelectedItem).disk;
+ _dlgBlockMedia.FillFields();
+ _dlgBlockMedia.ShowModal(this);
+
+ if(_dlgBlockMedia.Modified)
+
+ {
+ lstDisks.Remove((DiskEntry)treeDisks.SelectedItem);
+ lstDisks.Add(new DiskEntry { path = _dlgBlockMedia.Metadata.Image.Value, disk = _dlgBlockMedia.Metadata });
+ }
}
}
-}
+}
\ No newline at end of file
diff --git a/osrepodbmgr.Eto/dlgOpticalDisc.xeto b/osrepodbmgr.Eto/dlgOpticalDisc.xeto
index e309770..995bb21 100644
--- a/osrepodbmgr.Eto/dlgOpticalDisc.xeto
+++ b/osrepodbmgr.Eto/dlgOpticalDisc.xeto
@@ -1,6 +1,537 @@
-
-
-
+
+
\ No newline at end of file
diff --git a/osrepodbmgr.Eto/dlgOpticalDisc.xeto.cs b/osrepodbmgr.Eto/dlgOpticalDisc.xeto.cs
index 66fcb90..6c0cd1d 100644
--- a/osrepodbmgr.Eto/dlgOpticalDisc.xeto.cs
+++ b/osrepodbmgr.Eto/dlgOpticalDisc.xeto.cs
@@ -30,14 +30,1854 @@ using System.Collections.Generic;
using Eto.Forms;
using Eto.Drawing;
using Eto.Serialization.Xaml;
+using Schemas;
+using System.Collections.ObjectModel;
+using System.Linq;
namespace osrepodbmgr.Eto
{
- public class dlgOpticalDisc : Panel
+ public class dlgOpticalDisc : Dialog
{
+ public OpticalDiscType Metadata;
+ public bool Modified;
+
+ #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;
+ GridView treeXboxSS;
+ TextBox txtSSStart;
+ TextBox txtSSEnd;
+ 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
+
+ TrackType trackIter;
+ PartitionType partitionIter;
+ FileSystemType filesystemIter;
+ DumpHardwareType dumpHwIter;
+
+ ObservableCollection lstDumpHw;
+ ObservableCollection lstTOC;
+ ObservableCollection lstCDText;
+ ObservableCollection lstATIP;
+ ObservableCollection lstPMA;
+ ObservableCollection lstPFI;
+ ObservableCollection lstDMI;
+ ObservableCollection lstCMI;
+ ObservableCollection lstBCA;
+ ObservableCollection lstDCB;
+ ObservableCollection lstPRI;
+ ObservableCollection lstMediaID;
+ ObservableCollection lstPFIR;
+ ObservableCollection lstLastRMD;
+ ObservableCollection lstADIP;
+ ObservableCollection lstDDS;
+ ObservableCollection lstSAI;
+ ObservableCollection lstDI;
+ ObservableCollection lstPAC;
+ ObservableCollection lstRingCodes;
+ ObservableCollection lstMasteringSIDs;
+ ObservableCollection lstToolstamps;
+ ObservableCollection lstMouldSIDs;
+ ObservableCollection lstMouldTexts;
+ ObservableCollection lstLayers;
+ ObservableCollection lstLeadIns;
+ ObservableCollection lstLeadOuts;
+ ObservableCollection lstXboxSS;
+ ObservableCollection lstTracks;
+
+ bool editingPartition;
+ bool editingDumpHw;
+
+ // Non-editable fields
+ ChecksumType[] checksums;
+ CaseType mediaCase;
+ ScansType scans;
+
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