diff --git a/.idea/.idea.DiscImageChef/.idea/contentModel.xml b/.idea/.idea.DiscImageChef/.idea/contentModel.xml
index 47ff7cbac..89977601f 100644
--- a/.idea/.idea.DiscImageChef/.idea/contentModel.xml
+++ b/.idea/.idea.DiscImageChef/.idea/contentModel.xml
@@ -1627,6 +1627,8 @@
+
+
diff --git a/DiscImageChef.Gui/Forms/frmImageSidecar.xeto b/DiscImageChef.Gui/Forms/frmImageSidecar.xeto
new file mode 100644
index 000000000..65b2be725
--- /dev/null
+++ b/DiscImageChef.Gui/Forms/frmImageSidecar.xeto
@@ -0,0 +1,72 @@
+
+
\ No newline at end of file
diff --git a/DiscImageChef.Gui/Forms/frmImageSidecar.xeto.cs b/DiscImageChef.Gui/Forms/frmImageSidecar.xeto.cs
new file mode 100644
index 000000000..03d3f0721
--- /dev/null
+++ b/DiscImageChef.Gui/Forms/frmImageSidecar.xeto.cs
@@ -0,0 +1,147 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : frmImageSidecar.xeto.cs
+// Author(s) : Natalia Portillo
+//
+// Component : Image sidecar creation window.
+//
+// --[ Description ] ----------------------------------------------------------
+//
+// Implements creating image metadata sidecar.
+//
+// --[ License ] --------------------------------------------------------------
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General public License for more details.
+//
+// You should have received a copy of the GNU General public License
+// along with this program. If not, see ;http://www.gnu.org/licenses/>.
+//
+// ----------------------------------------------------------------------------
+// Copyright © 2011-2018 Natalia Portillo
+// ****************************************************************************/
+
+using System;
+using System.IO;
+using System.Threading;
+using System.Xml.Serialization;
+using Claunia.Encoding;
+using DiscImageChef.CommonTypes.Interfaces;
+using DiscImageChef.Console;
+using DiscImageChef.Core;
+using Eto.Forms;
+using Eto.Serialization.Xaml;
+using Schemas;
+
+namespace DiscImageChef.Gui.Forms
+{
+ public class frmImageSidecar : Form
+ {
+ Encoding encoding;
+ Guid filterId;
+ string imageSource;
+ IMediaImage inputFormat;
+
+ public frmImageSidecar(IMediaImage inputFormat, string imageSource, Guid filterId, Encoding encoding)
+ {
+ this.inputFormat = inputFormat;
+ this.imageSource = imageSource;
+ this.filterId = filterId;
+ this.encoding = encoding;
+ XamlReader.Load(this);
+
+ txtDestination.Text = Path.Combine(Path.GetDirectoryName(imageSource) ?? "",
+ Path.GetFileNameWithoutExtension(imageSource) + ".cicm.xml");
+ }
+
+ protected void OnBtnStart(object sender, EventArgs e)
+ {
+ new Thread(DoWork).Start();
+ }
+
+ void DoWork()
+ {
+ // Prepare UI
+ Application.Instance.Invoke(() =>
+ {
+ btnClose.Visible = false;
+ btnStart.Visible = false;
+ btnStop.Visible = true;
+ stkProgress.Visible = false;
+ btnStop.Enabled = false;
+ btnDestination.Visible = false;
+ });
+
+ CICMMetadataType sidecar = Sidecar.Create(inputFormat, imageSource, filterId, encoding);
+
+ DicConsole.WriteLine("Writing metadata sidecar");
+
+ FileStream xmlFs = new FileStream(txtDestination.Text, FileMode.Create);
+
+ XmlSerializer xmlSer = new XmlSerializer(typeof(CICMMetadataType));
+ xmlSer.Serialize(xmlFs, sidecar);
+ xmlFs.Close();
+
+ Application.Instance.Invoke(() =>
+ {
+ btnClose.Visible = true;
+ btnStop.Visible = false;
+ stkProgress.Visible = false;
+ });
+
+ Statistics.AddCommand("create-sidecar");
+ }
+
+ protected void OnBtnClose(object sender, EventArgs e)
+ {
+ Close();
+ }
+
+ protected void OnBtnStop(object sender, EventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+
+ void OnBtnDestinationClick(object sender, EventArgs e)
+ {
+ SaveFileDialog dlgDestination = new SaveFileDialog {Title = "Choose destination file"};
+ dlgDestination.Filters.Add(new FileFilter("CICM XML metadata", "*.xml"));
+
+ DialogResult result = dlgDestination.ShowDialog(this);
+
+ if(result != DialogResult.Ok)
+ {
+ txtDestination.Text = "";
+ return;
+ }
+
+ if(string.IsNullOrEmpty(Path.GetExtension(dlgDestination.FileName))) dlgDestination.FileName += ".xml";
+
+ txtDestination.Text = dlgDestination.FileName;
+ }
+
+ #region XAML IDs
+ TextBox txtDestination;
+ Button btnDestination;
+ StackLayout stkProgress;
+ StackLayout stkProgress1;
+ Label lblProgress;
+ ProgressBar prgProgress;
+ StackLayout stkProgress2;
+ Label lblProgress2;
+ ProgressBar prgProgress2;
+ Button btnStart;
+ Button btnClose;
+ Button btnStop;
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef.Gui/Panels/pnlImageInfo.xeto b/DiscImageChef.Gui/Panels/pnlImageInfo.xeto
index 201681164..8784e13c8 100644
--- a/DiscImageChef.Gui/Panels/pnlImageInfo.xeto
+++ b/DiscImageChef.Gui/Panels/pnlImageInfo.xeto
@@ -31,8 +31,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
-->
-
+
@@ -117,6 +117,7 @@
+
diff --git a/DiscImageChef.Gui/Panels/pnlImageInfo.xeto.cs b/DiscImageChef.Gui/Panels/pnlImageInfo.xeto.cs
index 40f59aae4..e13694c81 100644
--- a/DiscImageChef.Gui/Panels/pnlImageInfo.xeto.cs
+++ b/DiscImageChef.Gui/Panels/pnlImageInfo.xeto.cs
@@ -55,9 +55,11 @@ namespace DiscImageChef.Gui.Panels
{
public class pnlImageInfo : Panel
{
+ IFilter filter;
frmImageChecksum frmImageChecksum;
frmImageConvert frmImageConvert;
frmImageEntropy frmImageEntropy;
+ frmImageSidecar frmImageSidecar;
frmImageVerify frmImageVerify;
IMediaImage imageFormat;
string imagePath;
@@ -65,6 +67,7 @@ namespace DiscImageChef.Gui.Panels
public pnlImageInfo(string imagePath, IFilter filter, IMediaImage imageFormat)
{
this.imagePath = imagePath;
+ this.filter = filter;
this.imageFormat = imageFormat;
XamlReader.Load(this);
@@ -842,6 +845,20 @@ namespace DiscImageChef.Gui.Panels
frmImageConvert.Show();
}
+ protected void OnBtnCreateSidecar(object sender, EventArgs e)
+ {
+ if(frmImageSidecar != null)
+ {
+ frmImageSidecar.Show();
+ return;
+ }
+
+ // TODO: Pass thru chosen default encoding
+ frmImageSidecar = new frmImageSidecar(imageFormat, imagePath, filter.Id, null);
+ frmImageSidecar.Closed += (s, ea) => { frmImageSidecar = null; };
+ frmImageSidecar.Show();
+ }
+
#region XAML controls
#pragma warning disable 169
#pragma warning disable 649