diff --git a/.idea/.idea.DiscImageChef/.idea/contentModel.xml b/.idea/.idea.DiscImageChef/.idea/contentModel.xml
index c9d916706..9317b7a0e 100644
--- a/.idea/.idea.DiscImageChef/.idea/contentModel.xml
+++ b/.idea/.idea.DiscImageChef/.idea/contentModel.xml
@@ -26,7 +26,6 @@
-
@@ -241,7 +240,6 @@
-
@@ -509,6 +507,7 @@
+
@@ -1811,8 +1810,6 @@
-
-
diff --git a/DiscImageChef.CommonTypes b/DiscImageChef.CommonTypes
index 02e6c1917..1bd15feee 160000
--- a/DiscImageChef.CommonTypes
+++ b/DiscImageChef.CommonTypes
@@ -1 +1 @@
-Subproject commit 02e6c1917628515273c5d8f7cd5a2b54cc7e67d3
+Subproject commit 1bd15feee6672c8abde790609018b819c0478c8b
diff --git a/DiscImageChef.Console b/DiscImageChef.Console
index cf809e896..700793ae1 160000
--- a/DiscImageChef.Console
+++ b/DiscImageChef.Console
@@ -1 +1 @@
-Subproject commit cf809e896fb98b76899200c9ab0fdc9402a9e56a
+Subproject commit 700793ae191f55b5872b7b7d7341aba60c82256b
diff --git a/DiscImageChef.Core/Benchmark.cs b/DiscImageChef.Core/Benchmark.cs
deleted file mode 100644
index 31600a01a..000000000
--- a/DiscImageChef.Core/Benchmark.cs
+++ /dev/null
@@ -1,583 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : Benchmark.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Core algorithms.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Benchmarks DiscImageChef hashing and checksumming speeds.
-//
-// --[ 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 .
-//
-// ----------------------------------------------------------------------------
-// Copyright © 2011-2020 Natalia Portillo
-// ****************************************************************************/
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using DiscImageChef.Checksums;
-using DiscImageChef.CommonTypes.Interfaces;
-
-namespace DiscImageChef.Core
-{
- public struct BenchmarkResults
- {
- public double FillTime;
- public double FillSpeed;
- public double ReadTime;
- public double ReadSpeed;
- public double EntropyTime;
- public double EntropySpeed;
- public Dictionary Entries;
- public long MinMemory;
- public long MaxMemory;
- public double SeparateTime;
- public double SeparateSpeed;
- public double TotalTime;
- public double TotalSpeed;
- }
-
- public struct BenchmarkEntry
- {
- public double TimeSpan;
- public double Speed;
- }
-
- ///
- /// Benchmarks the speed at which we can do checksums
- ///
- public static class Benchmark
- {
- public static event InitProgressHandler InitProgressEvent;
- public static event UpdateProgressHandler UpdateProgressEvent;
- public static event EndProgressHandler EndProgressEvent;
-
- static void InitProgress()
- {
- InitProgressEvent?.Invoke();
- }
-
- static void UpdateProgress(string text, int current, int maximum)
- {
- UpdateProgressEvent?.Invoke(string.Format(text, current, maximum), current, maximum);
- }
-
- static void EndProgress()
- {
- EndProgressEvent?.Invoke();
- }
-
- public static BenchmarkResults Do(int bufferSize, int blockSize)
- {
- BenchmarkResults results = new BenchmarkResults
- {
- Entries = new Dictionary(),
- MinMemory = long.MaxValue,
- MaxMemory = 0,
- SeparateTime = 0
- };
- MemoryStream ms = new MemoryStream(bufferSize);
- Random rnd = new Random();
- DateTime start;
- DateTime end;
-
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Writing block {0} of {1} with random data.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- rnd.NextBytes(tmp);
- ms.Write(tmp, 0, blockSize);
- }
-
- EndProgress();
- end = DateTime.Now;
-
- results.FillTime = (end - start).TotalSeconds;
- results.FillSpeed = bufferSize / 1048576.0 / (end - start).TotalSeconds;
-
- ms.Seek(0, SeekOrigin.Begin);
- long mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Reading block {0} of {1}.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- }
-
- EndProgress();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.ReadTime = (end - start).TotalSeconds;
- results.ReadSpeed = bufferSize / 1048576.0 / (end - start).TotalSeconds;
-
- #region Adler32
- IChecksum ctx = new Adler32Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with Adler32.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("Adler32",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion Adler32
-
- #region Fletcher16
- ctx = new Fletcher16Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with Fletcher-16.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("Fletcher16",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion Fletcher16
-
- #region Fletcher32
- ctx = new Fletcher32Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with Fletcher-32.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("Fletcher32",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion Fletcher32
-
- #region CRC16
- ctx = new Crc16Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with CRC16.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("CRC16",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion CRC16
-
- #region CRC32
- ctx = new Crc32Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with CRC32.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("CRC32",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion CRC32
-
- #region CRC64
- ctx = new Crc64Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with CRC64.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("CRC64",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion CRC64
-
- #region MD5
- ctx = new Md5Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with MD5.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("MD5",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion MD5
-
- #region SHA1
- ctx = new Sha1Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with SHA1.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("SHA1",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion SHA1
-
- #region SHA256
- ctx = new Sha256Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with SHA256.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("SHA256",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion SHA256
-
- #region SHA384
- ctx = new Sha384Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with SHA384.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("SHA384",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion SHA384
-
- #region SHA512
- ctx = new Sha512Context();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with SHA512.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("SHA512",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion SHA512
-
- #region SpamSum
- ctx = new SpamSumContext();
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with SpamSum.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- ctx.Update(tmp);
- }
-
- EndProgress();
- ctx.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.Entries.Add("SpamSum",
- new BenchmarkEntry
- {
- TimeSpan = (end - start).TotalSeconds,
- Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
- });
- results.SeparateTime += (end - start).TotalSeconds;
- #endregion SpamSum
-
- #region Entropy
- ulong[] entTable = new ulong[256];
- ms.Seek(0, SeekOrigin.Begin);
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
- start = DateTime.Now;
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Entropying block {0} of {1}.", i + 1, bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
- foreach(byte b in tmp) entTable[b]++;
- }
-
- EndProgress();
-
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.EntropyTime = (end - start).TotalSeconds;
- results.EntropySpeed = bufferSize / 1048576.0 / (end - start).TotalSeconds;
- #endregion Entropy
-
- /*
- #region Multitasking
- start = DateTime.Now;
- Checksum allChecksums = new Checksum();
- InitProgress();
- for(int i = 0; i < bufferSize / blockSize; i++)
- {
- UpdateProgress("Checksumming block {0} of {1} with all algorithms at the same time.", i + 1,
- bufferSize / blockSize);
- byte[] tmp = new byte[blockSize];
- ms.Read(tmp, 0, blockSize);
-
- allChecksums.Update(tmp);
- }
-
- EndProgress();
-
- allChecksums.End();
- end = DateTime.Now;
- mem = GC.GetTotalMemory(false);
- if(mem > results.MaxMemory) results.MaxMemory = mem;
- if(mem < results.MinMemory) results.MinMemory = mem;
-
- results.TotalTime = (end - start).TotalSeconds;
- results.TotalSpeed = bufferSize / 1048576.0 / results.TotalTime;
- #endregion
- */
- results.SeparateSpeed = bufferSize / 1048576.0 / results.SeparateTime;
-
- return results;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.Core/DiscImageChef.Core.csproj b/DiscImageChef.Core/DiscImageChef.Core.csproj
index 0dbe2c42c..13e8ea032 100644
--- a/DiscImageChef.Core/DiscImageChef.Core.csproj
+++ b/DiscImageChef.Core/DiscImageChef.Core.csproj
@@ -93,7 +93,6 @@
-
diff --git a/DiscImageChef.Core/Statistics.cs b/DiscImageChef.Core/Statistics.cs
index 85034b995..3d7b6c2f4 100644
--- a/DiscImageChef.Core/Statistics.cs
+++ b/DiscImageChef.Core/Statistics.cs
@@ -86,18 +86,6 @@ namespace DiscImageChef.Core
ctx.Commands.Update(command);
}
- if(allStats.Commands.Benchmark > 0)
- {
- Command command =
- ctx.Commands.FirstOrDefault(c => c.Name == "benchmark" && c.Synchronized) ?? new Command
- {
- Name = "benchmark", Synchronized = true
- };
-
- command.Count += (ulong)allStats.Commands.Benchmark;
- ctx.Commands.Update(command);
- }
-
if(allStats.Commands.Checksum > 0)
{
Command command =
diff --git a/DiscImageChef.Decoders b/DiscImageChef.Decoders
index 8eea6af40..785638f5f 160000
--- a/DiscImageChef.Decoders
+++ b/DiscImageChef.Decoders
@@ -1 +1 @@
-Subproject commit 8eea6af409f259f6b7f4773ddc75ef06dee20b0f
+Subproject commit 785638f5f6b9d31886ca7f3f75acf406cab84398
diff --git a/DiscImageChef.Dto b/DiscImageChef.Dto
index 2f65814ec..89d1a5faf 160000
--- a/DiscImageChef.Dto
+++ b/DiscImageChef.Dto
@@ -1 +1 @@
-Subproject commit 2f65814ecc4b24fef4f7e7eda549b223a58fc3b0
+Subproject commit 89d1a5fafc305be5e64657b85aa5848065adf5b6
diff --git a/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto b/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto
deleted file mode 100644
index 6aff3e081..000000000
--- a/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
\ No newline at end of file
diff --git a/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto.cs b/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto.cs
deleted file mode 100644
index aed21d590..000000000
--- a/DiscImageChef.Gui/Dialogs/dlgBenchmark.xeto.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : dlgBenchmark.xeto.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Benchmark dialog.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Implements the benchmark dialog.
-//
-// --[ 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 .
-//
-// ----------------------------------------------------------------------------
-// Copyright © 2011-2020 Natalia Portillo
-// ****************************************************************************/
-
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using DiscImageChef.Core;
-using Eto.Drawing;
-using Eto.Forms;
-using Eto.Serialization.Xaml;
-
-namespace DiscImageChef.Gui.Dialogs
-{
- public class dlgBenchmark : Dialog
- {
- Dictionary checksumTimes;
- int counter;
- BenchmarkResults results;
- int step;
-
- public dlgBenchmark()
- {
- XamlReader.Load(this);
- }
-
- protected void OnBtnStart(object sender, EventArgs e)
- {
- checksumTimes = new Dictionary();
- Benchmark.UpdateProgressEvent += UpdateProgress;
- stkProgress.Visible = true;
- lblProgress.Text = "";
- btnClose.Enabled = false;
- btnStart.Enabled = false;
- nmuBufferSize.Enabled = false;
- nmuBlockSize.Enabled = false;
-
- Thread thread = new Thread(() =>
- {
- counter = step = (int)(nmuBufferSize.Value * 1024 * 1024 / nmuBlockSize.Value) % 3333;
- // TODO: Able to cancel!
- results = Benchmark.Do((int)(nmuBufferSize.Value * 1024 * 1024), (int)nmuBlockSize.Value);
-
- Application.Instance.Invoke(Finish);
- });
-
- thread.Start();
- }
-
- void Finish()
- {
- Benchmark.UpdateProgressEvent += UpdateProgress;
- StackLayout stkCalculationResults = new StackLayout();
-
- stkCalculationResults.Items.Add(new Label
- {
- Text =
- $"Took {results.FillTime} seconds to fill buffer, {results.FillSpeed:F3} MiB/sec."
- });
- stkCalculationResults.Items.Add(new Label
- {
- Text =
- $"Took {results.ReadTime} seconds to read buffer, {results.ReadSpeed:F3} MiB/sec."
- });
- stkCalculationResults.Items.Add(new Label
- {
- Text =
- $"Took {results.EntropyTime} seconds to entropy buffer, {results.EntropySpeed:F3} MiB/sec."
- });
-
- foreach(KeyValuePair entry in results.Entries)
- {
- checksumTimes.Add(entry.Key, entry.Value.TimeSpan);
- stkCalculationResults.Items.Add(new Label
- {
- Text =
- $"Took {entry.Value.TimeSpan} seconds to {entry.Key} buffer, {entry.Value.Speed:F3} MiB/sec."
- });
- ;
- }
-
- stkCalculationResults.Items.Add(new Label
- {
- Text =
- $"Took {results.TotalTime} seconds to do all algorithms at the same time, {results.TotalSpeed:F3} MiB/sec."
- });
- stkCalculationResults.Items.Add(new Label
- {
- Text =
- $"Took {results.SeparateTime} seconds to do all algorithms sequentially, {results.SeparateSpeed:F3} MiB/sec."
- });
- stkCalculationResults.Items.Add(new Label {Text = $"Max memory used is {results.MaxMemory} bytes"});
- stkCalculationResults.Items.Add(new Label {Text = $"Min memory used is {results.MinMemory} bytes"});
-
- Statistics.AddCommand("benchmark");
-
- stkCalculationResults.Items.Add(new StackLayoutItem(stkButtons, HorizontalAlignment.Right, true));
- stkCalculationResults.Visible = true;
- btnStart.Visible = false;
- btnClose.Enabled = true;
- Content = stkCalculationResults;
- ClientSize = new Size(-1, -1);
- }
-
- void UpdateProgress(string text, long current, long maximum)
- {
- if(counter < step)
- {
- counter++;
- return;
- }
-
- counter = 0;
-
- Application.Instance.Invoke(() =>
- {
- lblProgress.Text = text;
-
- if(maximum == 0)
- {
- prgProgress.Indeterminate = true;
- return;
- }
-
- if(prgProgress.Indeterminate) prgProgress.Indeterminate = false;
-
- if(maximum > int.MaxValue || current > int.MaxValue)
- {
- prgProgress.MaxValue = (int)(maximum / int.MaxValue);
- prgProgress.Value = (int)(current / int.MaxValue);
- }
- else
- {
- prgProgress.MaxValue = (int)maximum;
- prgProgress.Value = (int)current;
- }
- });
- }
-
- protected void OnBtnClose(object sender, EventArgs e)
- {
- Close();
- }
-
- #region XAML controls
- NumericStepper nmuBufferSize;
- NumericStepper nmuBlockSize;
- StackLayout stkProgress;
- Label lblProgress;
- ProgressBar prgProgress;
- Button btnStart;
- Button btnClose;
- StackLayout stkPreCalculation;
- StackLayout stkButtons;
- #endregion
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef.Gui/Dialogs/dlgSettings.xeto b/DiscImageChef.Gui/Dialogs/dlgSettings.xeto
index 9cef16725..8cb794baa 100644
--- a/DiscImageChef.Gui/Dialogs/dlgSettings.xeto
+++ b/DiscImageChef.Gui/Dialogs/dlgSettings.xeto
@@ -64,7 +64,6 @@
-
diff --git a/DiscImageChef.Gui/Dialogs/dlgSettings.xeto.cs b/DiscImageChef.Gui/Dialogs/dlgSettings.xeto.cs
index 67257a499..81be9454b 100644
--- a/DiscImageChef.Gui/Dialogs/dlgSettings.xeto.cs
+++ b/DiscImageChef.Gui/Dialogs/dlgSettings.xeto.cs
@@ -47,10 +47,12 @@ namespace DiscImageChef.Gui.Dialogs
"In compliance with the European Union General Data Protection Regulation 2016/679 (GDPR),\n" +
"we must give you the following information about DiscImageChef and ask if you want to opt-in\n" +
"in some information sharing.";
+
lblGdpr2.Text =
"Disclaimer: Because DiscImageChef is an open source software this information, and therefore,\n" +
"compliance with GDPR only holds true if you obtained a certificated copy from its original\n" +
"authors. In case of doubt, close DiscImageChef now and ask in our IRC support channel.";
+
lblGdpr3.Text =
"For any information sharing your IP address may be stored in our server, in a way that is not\n" +
"possible for any person, manual, or automated process, to link with your identity, unless\n" +
@@ -70,14 +72,16 @@ namespace DiscImageChef.Gui.Dialogs
chkSaveReportsGlobally.Text =
"Do you want to save device reports in shared folder of your computer? (Y/N): ";
+
chkSaveReportsGlobally.Checked = Settings.Settings.Current.SaveReportsGlobally;
lblShareReports.Text =
"Sharing a report with us will send it to our server, that's in the european union territory, where it\n" +
"will be manually analized by an european union citizen to remove any trace of personal identification\n" +
- "from it. Once that is done, it will be shared in our stats website, https://www.discimagechef.app\n" +
+ "from it. Once that is done, it will be shared in our stats website, https://www.discimagechef.app\n" +
"These report will be used to improve DiscImageChef support, and in some cases, to provide emulation of the\n" +
"devices to other open-source projects. In any case, no information linking the report to you will be stored.";
+
chkShareReports.Text = "Do you want to share your device reports with us? (Y/N): ";
chkShareReports.Checked = Settings.Settings.Current.ShareReports;
#endregion Device reports
@@ -88,6 +92,7 @@ namespace DiscImageChef.Gui.Dialogs
"command is executed, a filesystem, partition, or device is used, the operating system version, and other.\n" +
"In no case, any information besides pure statistical usage numbers is stored, and they're just joint to the\n" +
"pool with no way of using them to identify you.";
+
chkSaveStats.Text = "Do you want to save stats about your DiscImageChef usage? (Y/N): ";
if(Settings.Settings.Current.Stats != null)
@@ -98,9 +103,6 @@ namespace DiscImageChef.Gui.Dialogs
chkShareStats.Text = "Do you want to share your stats anonymously? (Y/N): ";
chkShareStats.Checked = Settings.Settings.Current.Stats.ShareStats;
- chkBenchmarkStats.Text = "Do you want to gather statistics about benchmarks? (Y/N): ";
- chkBenchmarkStats.Checked = Settings.Settings.Current.Stats.BenchmarkStats;
-
chkCommandStats.Text = "Do you want to gather statistics about command usage? (Y/N): ";
chkCommandStats.Checked = Settings.Settings.Current.Stats.CommandStats;
@@ -115,6 +117,7 @@ namespace DiscImageChef.Gui.Dialogs
chkMediaImageStats.Text =
"Do you want to gather statistics about found media image formats? (Y/N): ";
+
chkMediaImageStats.Checked = Settings.Settings.Current.Stats.MediaImageStats;
chkMediaScanStats.Text = "Do you want to gather statistics about scanned media? (Y/N): ";
@@ -122,6 +125,7 @@ namespace DiscImageChef.Gui.Dialogs
chkPartitionStats.Text =
"Do you want to gather statistics about found partitioning schemes? (Y/N): ";
+
chkPartitionStats.Checked = Settings.Settings.Current.Stats.PartitionStats;
chkMediaStats.Text = "Do you want to gather statistics about media types? (Y/N): ";
@@ -138,10 +142,7 @@ namespace DiscImageChef.Gui.Dialogs
#endregion Statistics
}
- protected void OnBtnCancel(object sender, EventArgs e)
- {
- Close();
- }
+ protected void OnBtnCancel(object sender, EventArgs e) => Close();
protected void OnBtnSave(object sender, EventArgs e)
{
@@ -152,18 +153,17 @@ namespace DiscImageChef.Gui.Dialogs
Settings.Settings.Current.Stats = new StatsSettings
{
ShareStats = chkShareStats.Checked == true,
- BenchmarkStats = chkBenchmarkStats.Checked == true,
CommandStats = chkCommandStats.Checked == true,
DeviceStats = chkDeviceStats.Checked == true,
FilesystemStats = chkFilesystemStats.Checked == true,
FilterStats = chkFilterStats.Checked == true,
MediaImageStats = chkMediaImageStats.Checked == true,
MediaScanStats = chkMediaScanStats.Checked == true,
- PartitionStats = chkPartitionStats.Checked == true,
- MediaStats = chkMediaStats.Checked == true,
+ PartitionStats = chkPartitionStats.Checked == true, MediaStats = chkMediaStats.Checked == true,
VerifyStats = chkVerifyStats.Checked == true
};
- else Settings.Settings.Current.Stats = null;
+ else
+ Settings.Settings.Current.Stats = null;
Settings.Settings.Current.GdprCompliance = DicSettings.GdprLevel;
Settings.Settings.SaveSettings();
@@ -178,7 +178,6 @@ namespace DiscImageChef.Gui.Dialogs
CheckBox chkShareReports;
CheckBox chkSaveStats;
CheckBox chkShareStats;
- CheckBox chkBenchmarkStats;
CheckBox chkCommandStats;
CheckBox chkDeviceStats;
CheckBox chkFilesystemStats;
diff --git a/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto b/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto
index cd40adc8b..d275aec32 100644
--- a/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto
+++ b/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto
@@ -38,7 +38,6 @@
-
diff --git a/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto.cs b/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto.cs
index fb5eb372b..127990ed2 100644
--- a/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto.cs
+++ b/DiscImageChef.Gui/Dialogs/dlgStatistics.xeto.cs
@@ -45,34 +45,26 @@ namespace DiscImageChef.Gui.Dialogs
{
XamlReader.Load(this);
- DicContext ctx = DicContext.Create(Settings.Settings.LocalDbPath);
+ var ctx = DicContext.Create(Settings.Settings.LocalDbPath);
if(ctx.Commands.Any())
{
if(ctx.Commands.Any(c => c.Name == "analyze"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "analyze" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "analyze" && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "analyze" && !c.Synchronized);
lblAnalyze.Visible = true;
lblAnalyze.Text = $"You have called the Analyze command {count} times";
}
- if(ctx.Commands.Any(c => c.Name == "benchmark"))
- {
- ulong count = ctx.Commands.Where(c => c.Name == "benchmark" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
- count += (ulong)ctx.Commands.LongCount(c => c.Name == "benchmark" && !c.Synchronized);
-
- lblBenchmark.Visible = true;
- lblBenchmark.Text = $"You have called the Benchmark command {count} times";
- }
-
if(ctx.Commands.Any(c => c.Name == "checksum"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "checksum" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "checksum" && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "checksum" && !c.Synchronized);
lblChecksum.Visible = true;
@@ -81,8 +73,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "compare"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "compare" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "compare" && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "compare" && !c.Synchronized);
lblCompare.Visible = true;
@@ -91,8 +84,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "convert-image"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "convert-image" && c.Synchronized)
- .Select(c => c.Count).FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "convert-image" && c.Synchronized).
+ Select(c => c.Count).FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "convert-image" && !c.Synchronized);
lblConvertImage.Visible = true;
@@ -101,8 +95,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "create-sidecar"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "create-sidecar" && c.Synchronized)
- .Select(c => c.Count).FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "create-sidecar" && c.Synchronized).
+ Select(c => c.Count).FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "create-sidecar" && !c.Synchronized);
lblCreateSidecar.Visible = true;
@@ -111,8 +106,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "decode"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "decode" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "decode" && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "decode" && !c.Synchronized);
lblDecode.Visible = true;
@@ -121,8 +117,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "device-info"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "device-info" && c.Synchronized)
- .Select(c => c.Count).FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "device-info" && c.Synchronized).
+ Select(c => c.Count).FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-info" && !c.Synchronized);
lblDeviceInfo.Visible = true;
@@ -131,8 +128,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "device-report"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "device-report" && c.Synchronized)
- .Select(c => c.Count).FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "device-report" && c.Synchronized).
+ Select(c => c.Count).FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-report" && !c.Synchronized);
lblDeviceReport.Visible = true;
@@ -141,8 +139,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "dump-media"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "dump-media" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "dump-media" && c.Synchronized).
+ Select(c => c.Count).FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "dump-media" && !c.Synchronized);
lblDumpMedia.Visible = true;
@@ -151,8 +150,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "entropy"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "entropy" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "entropy" && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "entropy" && !c.Synchronized);
lblEntropy.Visible = true;
@@ -161,8 +161,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "formats"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "formats" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "formats" && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "formats" && !c.Synchronized);
lblFormats.Visible = true;
@@ -171,8 +172,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "image-info"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "image-info" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "image-info" && c.Synchronized).
+ Select(c => c.Count).FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "image-info" && !c.Synchronized);
lblImageInfo.Visible = true;
@@ -181,8 +183,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "media-info"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "media-info" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "media-info" && c.Synchronized).
+ Select(c => c.Count).FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-info" && !c.Synchronized);
lblMediaInfo.Visible = true;
@@ -191,8 +194,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "media-scan"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "media-scan" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "media-scan" && c.Synchronized).
+ Select(c => c.Count).FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-scan" && !c.Synchronized);
lblMediaScan.Visible = true;
@@ -201,8 +205,9 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "printhex"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "printhex" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "printhex" && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "printhex" && !c.Synchronized);
lblPrintHex.Visible = true;
@@ -211,30 +216,38 @@ namespace DiscImageChef.Gui.Dialogs
if(ctx.Commands.Any(c => c.Name == "verify"))
{
- ulong count = ctx.Commands.Where(c => c.Name == "verify" && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Commands.Where(c => c.Name == "verify" && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Commands.LongCount(c => c.Name == "verify" && !c.Synchronized);
lblVerify.Visible = true;
lblVerify.Text = $"You have called the Verify command {count} times";
}
- tabCommands.Visible = lblAnalyze.Visible || lblBenchmark.Visible || lblChecksum.Visible ||
- lblCompare.Visible || lblConvertImage.Visible || lblCreateSidecar.Visible ||
- lblDecode.Visible || lblDeviceInfo.Visible || lblDeviceReport.Visible ||
- lblDumpMedia.Visible || lblEntropy.Visible || lblFormats.Visible ||
- lblImageInfo.Visible || lblMediaInfo.Visible || lblMediaScan.Visible ||
- lblPrintHex.Visible || lblVerify.Visible;
+ tabCommands.Visible = lblAnalyze.Visible || lblChecksum.Visible || lblCompare.Visible ||
+ lblConvertImage.Visible || lblCreateSidecar.Visible || lblDecode.Visible ||
+ lblDeviceInfo.Visible || lblDeviceReport.Visible || lblDumpMedia.Visible ||
+ lblEntropy.Visible || lblFormats.Visible || lblImageInfo.Visible ||
+ lblMediaInfo.Visible || lblMediaScan.Visible || lblPrintHex.Visible ||
+ lblVerify.Visible;
}
if(ctx.Filters.Any())
{
tabFilters.Visible = true;
- TreeGridItemCollection filterList = new TreeGridItemCollection();
+ var filterList = new TreeGridItemCollection();
- treeFilters.Columns.Add(new GridColumn {HeaderText = "Filter", DataCell = new TextBoxCell(0)});
- treeFilters.Columns.Add(new GridColumn {HeaderText = "Times found", DataCell = new TextBoxCell(1)});
+ treeFilters.Columns.Add(new GridColumn
+ {
+ HeaderText = "Filter", DataCell = new TextBoxCell(0)
+ });
+
+ treeFilters.Columns.Add(new GridColumn
+ {
+ HeaderText = "Times found", DataCell = new TextBoxCell(1)
+ });
treeFilters.AllowMultipleSelection = false;
treeFilters.ShowHeader = true;
@@ -242,11 +255,18 @@ namespace DiscImageChef.Gui.Dialogs
foreach(string nvs in ctx.Filters.Select(n => n.Name).Distinct())
{
- ulong count = ctx.Filters.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Filters.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Filters.LongCount(c => c.Name == nvs && !c.Synchronized);
- filterList.Add(new TreeGridItem {Values = new object[] {nvs, count}});
+ filterList.Add(new TreeGridItem
+ {
+ Values = new object[]
+ {
+ nvs, count
+ }
+ });
}
}
@@ -254,10 +274,17 @@ namespace DiscImageChef.Gui.Dialogs
{
tabFormats.Visible = true;
- TreeGridItemCollection formatList = new TreeGridItemCollection();
+ var formatList = new TreeGridItemCollection();
- treeFormats.Columns.Add(new GridColumn {HeaderText = "Format", DataCell = new TextBoxCell(0)});
- treeFormats.Columns.Add(new GridColumn {HeaderText = "Times found", DataCell = new TextBoxCell(1)});
+ treeFormats.Columns.Add(new GridColumn
+ {
+ HeaderText = "Format", DataCell = new TextBoxCell(0)
+ });
+
+ treeFormats.Columns.Add(new GridColumn
+ {
+ HeaderText = "Times found", DataCell = new TextBoxCell(1)
+ });
treeFormats.AllowMultipleSelection = false;
treeFormats.ShowHeader = true;
@@ -265,11 +292,18 @@ namespace DiscImageChef.Gui.Dialogs
foreach(string nvs in ctx.MediaFormats.Select(n => n.Name).Distinct())
{
- ulong count = ctx.MediaFormats.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.MediaFormats.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.MediaFormats.LongCount(c => c.Name == nvs && !c.Synchronized);
- formatList.Add(new TreeGridItem {Values = new object[] {nvs, count}});
+ formatList.Add(new TreeGridItem
+ {
+ Values = new object[]
+ {
+ nvs, count
+ }
+ });
}
}
@@ -277,10 +311,17 @@ namespace DiscImageChef.Gui.Dialogs
{
tabPartitions.Visible = true;
- TreeGridItemCollection partitionList = new TreeGridItemCollection();
+ var partitionList = new TreeGridItemCollection();
- treePartitions.Columns.Add(new GridColumn {HeaderText = "Filter", DataCell = new TextBoxCell(0)});
- treePartitions.Columns.Add(new GridColumn {HeaderText = "Times found", DataCell = new TextBoxCell(1)});
+ treePartitions.Columns.Add(new GridColumn
+ {
+ HeaderText = "Filter", DataCell = new TextBoxCell(0)
+ });
+
+ treePartitions.Columns.Add(new GridColumn
+ {
+ HeaderText = "Times found", DataCell = new TextBoxCell(1)
+ });
treePartitions.AllowMultipleSelection = false;
treePartitions.ShowHeader = true;
@@ -288,11 +329,18 @@ namespace DiscImageChef.Gui.Dialogs
foreach(string nvs in ctx.Partitions.Select(n => n.Name).Distinct())
{
- ulong count = ctx.Partitions.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Partitions.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Partitions.LongCount(c => c.Name == nvs && !c.Synchronized);
- partitionList.Add(new TreeGridItem {Values = new object[] {nvs, count}});
+ partitionList.Add(new TreeGridItem
+ {
+ Values = new object[]
+ {
+ nvs, count
+ }
+ });
}
}
@@ -300,10 +348,17 @@ namespace DiscImageChef.Gui.Dialogs
{
tabFilesystems.Visible = true;
- TreeGridItemCollection filesystemList = new TreeGridItemCollection();
+ var filesystemList = new TreeGridItemCollection();
- treeFilesystems.Columns.Add(new GridColumn {HeaderText = "Filesystem", DataCell = new TextBoxCell(0)});
- treeFilesystems.Columns.Add(new GridColumn {HeaderText = "Times found", DataCell = new TextBoxCell(1)});
+ treeFilesystems.Columns.Add(new GridColumn
+ {
+ HeaderText = "Filesystem", DataCell = new TextBoxCell(0)
+ });
+
+ treeFilesystems.Columns.Add(new GridColumn
+ {
+ HeaderText = "Times found", DataCell = new TextBoxCell(1)
+ });
treeFilesystems.AllowMultipleSelection = false;
treeFilesystems.ShowHeader = true;
@@ -311,11 +366,18 @@ namespace DiscImageChef.Gui.Dialogs
foreach(string nvs in ctx.Filesystems.Select(n => n.Name).Distinct())
{
- ulong count = ctx.Filesystems.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Filesystems.Where(c => c.Name == nvs && c.Synchronized).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Filesystems.LongCount(c => c.Name == nvs && !c.Synchronized);
- filesystemList.Add(new TreeGridItem {Values = new object[] {nvs, count}});
+ filesystemList.Add(new TreeGridItem
+ {
+ Values = new object[]
+ {
+ nvs, count
+ }
+ });
}
}
@@ -323,35 +385,64 @@ namespace DiscImageChef.Gui.Dialogs
{
tabDevices.Visible = true;
- TreeGridItemCollection deviceList = new TreeGridItemCollection();
+ var deviceList = new TreeGridItemCollection();
- treeDevices.Columns.Add(new GridColumn {HeaderText = "Device", DataCell = new TextBoxCell(0)});
- treeDevices.Columns.Add(new GridColumn {HeaderText = "Manufacturer", DataCell = new TextBoxCell(1)});
- treeDevices.Columns.Add(new GridColumn {HeaderText = "Revision", DataCell = new TextBoxCell(2)});
- treeDevices.Columns.Add(new GridColumn {HeaderText = "Bus", DataCell = new TextBoxCell(3)});
+ treeDevices.Columns.Add(new GridColumn
+ {
+ HeaderText = "Device", DataCell = new TextBoxCell(0)
+ });
+
+ treeDevices.Columns.Add(new GridColumn
+ {
+ HeaderText = "Manufacturer", DataCell = new TextBoxCell(1)
+ });
+
+ treeDevices.Columns.Add(new GridColumn
+ {
+ HeaderText = "Revision", DataCell = new TextBoxCell(2)
+ });
+
+ treeDevices.Columns.Add(new GridColumn
+ {
+ HeaderText = "Bus", DataCell = new TextBoxCell(3)
+ });
treeDevices.AllowMultipleSelection = false;
treeDevices.ShowHeader = true;
treeDevices.DataStore = deviceList;
- foreach(DeviceStat ds in ctx.SeenDevices.OrderBy(n => n.Manufacturer).ThenBy(n => n.Manufacturer)
- .ThenBy(n => n.Revision)
- .ThenBy(n => n.Bus))
+ foreach(DeviceStat ds in ctx.SeenDevices.OrderBy(n => n.Manufacturer).ThenBy(n => n.Manufacturer).
+ ThenBy(n => n.Revision).ThenBy(n => n.Bus))
deviceList.Add(new TreeGridItem
{
- Values = new object[] {ds.Model, ds.Manufacturer, ds.Revision, ds.Bus}
+ Values = new object[]
+ {
+ ds.Model, ds.Manufacturer, ds.Revision, ds.Bus
+ }
});
}
- if(!ctx.Medias.Any()) return;
+ if(!ctx.Medias.Any())
+ return;
tabMedias.Visible = true;
- TreeGridItemCollection mediaList = new TreeGridItemCollection();
+ var mediaList = new TreeGridItemCollection();
- treeMedias.Columns.Add(new GridColumn {HeaderText = "Media", DataCell = new TextBoxCell(0)});
- treeMedias.Columns.Add(new GridColumn {HeaderText = "Times found", DataCell = new TextBoxCell(1)});
- treeMedias.Columns.Add(new GridColumn {HeaderText = "Type", DataCell = new TextBoxCell(2)});
+ treeMedias.Columns.Add(new GridColumn
+ {
+ HeaderText = "Media", DataCell = new TextBoxCell(0)
+ });
+
+ treeMedias.Columns.Add(new GridColumn
+ {
+ HeaderText = "Times found", DataCell = new TextBoxCell(1)
+ });
+
+ treeMedias.Columns.Add(new GridColumn
+ {
+ HeaderText = "Type", DataCell = new TextBoxCell(2)
+ });
treeMedias.AllowMultipleSelection = false;
treeMedias.ShowHeader = true;
@@ -359,31 +450,43 @@ namespace DiscImageChef.Gui.Dialogs
foreach(string media in ctx.Medias.OrderBy(ms => ms.Type).Select(ms => ms.Type).Distinct())
{
- ulong count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && c.Real).Select(c => c.Count)
- .FirstOrDefault();
+ ulong count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && c.Real).Select(c => c.Count).
+ FirstOrDefault();
+
count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && c.Real);
- if(count > 0) mediaList.Add(new TreeGridItem {Values = new object[] {media, count, "real"}});
+ if(count > 0)
+ mediaList.Add(new TreeGridItem
+ {
+ Values = new object[]
+ {
+ media, count, "real"
+ }
+ });
+
+ count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && !c.Real).Select(c => c.Count).
+ FirstOrDefault();
- count = ctx.Medias.Where(c => c.Type == media && c.Synchronized && !c.Real).Select(c => c.Count)
- .FirstOrDefault();
count += (ulong)ctx.Medias.LongCount(c => c.Type == media && !c.Synchronized && !c.Real);
- if(count == 0) continue;
+ if(count == 0)
+ continue;
- mediaList.Add(new TreeGridItem {Values = new object[] {media, count, "image"}});
+ mediaList.Add(new TreeGridItem
+ {
+ Values = new object[]
+ {
+ media, count, "image"
+ }
+ });
}
}
- protected void OnBtnClose(object sender, EventArgs e)
- {
- Close();
- }
+ protected void OnBtnClose(object sender, EventArgs e) => Close();
#region XAML controls
TabPage tabCommands;
Label lblAnalyze;
- Label lblBenchmark;
Label lblChecksum;
Label lblCompare;
Label lblConvertImage;
diff --git a/DiscImageChef.Gui/Forms/frmMain.xeto b/DiscImageChef.Gui/Forms/frmMain.xeto
index b6052366c..0e4beb2b3 100644
--- a/DiscImageChef.Gui/Forms/frmMain.xeto
+++ b/DiscImageChef.Gui/Forms/frmMain.xeto
@@ -53,7 +53,6 @@
-
diff --git a/DiscImageChef.Gui/Forms/frmMain.xeto.cs b/DiscImageChef.Gui/Forms/frmMain.xeto.cs
index 2f0129d70..b2a63f30b 100644
--- a/DiscImageChef.Gui/Forms/frmMain.xeto.cs
+++ b/DiscImageChef.Gui/Forms/frmMain.xeto.cs
@@ -58,10 +58,8 @@ namespace DiscImageChef.Gui.Forms
{
public class frmMain : Form
{
- bool closing;
readonly Bitmap devicesIcon;
readonly Bitmap ejectIcon;
- GridView grdFiles;
readonly Bitmap hardDiskIcon;
readonly Bitmap imagesIcon;
readonly Label lblError;
@@ -72,10 +70,12 @@ namespace DiscImageChef.Gui.Forms
readonly Bitmap removableIcon;
readonly Bitmap sdIcon;
readonly Bitmap tapeIcon;
- TreeGridView treeImages;
readonly TreeGridItemCollection treeImagesItems;
readonly ContextMenu treeImagesMenu;
readonly Bitmap usbIcon;
+ bool closing;
+ GridView grdFiles;
+ TreeGridView treeImages;
public frmMain(bool debug, bool verbose)
{
@@ -693,8 +693,6 @@ namespace DiscImageChef.Gui.Forms
protected void OnMenuEncodings(object sender, EventArgs e) => new dlgEncodings().ShowModal(this);
- protected void OnMenuBenchmark(object sender, EventArgs e) => new dlgBenchmark().ShowModal(this);
-
protected void OnMenuStatistics(object sender, EventArgs e)
{
var ctx = DicContext.Create(Settings.Settings.LocalDbPath);
diff --git a/DiscImageChef.Helpers b/DiscImageChef.Helpers
index d0b9780be..0fb1781ca 160000
--- a/DiscImageChef.Helpers
+++ b/DiscImageChef.Helpers
@@ -1 +1 @@
-Subproject commit d0b9780be96275184f1f3e5e1acf52817f2befb6
+Subproject commit 0fb1781ca217228819338e94f82989633fd40aba
diff --git a/DiscImageChef.Settings/Settings.cs b/DiscImageChef.Settings/Settings.cs
index 2e544b778..772305f52 100644
--- a/DiscImageChef.Settings/Settings.cs
+++ b/DiscImageChef.Settings/Settings.cs
@@ -40,99 +40,61 @@ using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
namespace DiscImageChef.Settings
{
- ///
- /// Settings
- ///
+ /// Settings
public class DicSettings
{
///
- /// Level for GDPR compliance checking. Every time a new feature may share user information this level should go up,
- /// and the user asked to opt-in.
+ /// Level for GDPR compliance checking. Every time a new feature may share user information this level should go
+ /// up, and the user asked to opt-in.
///
public const ulong GdprLevel = 1;
- ///
- /// Set of GDPR compliance, if lower than , ask user for compliance.
- ///
+ /// Set of GDPR compliance, if lower than , ask user for compliance.
public ulong GdprCompliance;
- ///
- /// If set to true, reports will be saved locally
- ///
+ /// If set to true, reports will be saved locally
public bool SaveReportsGlobally;
- ///
- /// If set to true, reports will be sent to DiscImageChef.Server
- ///
+ /// If set to true, reports will be sent to DiscImageChef.Server
public bool ShareReports;
- ///
- /// Statistics
- ///
+ /// Statistics
public StatsSettings Stats;
}
// TODO: Use this
- ///
- /// User settings, for media dumps, completely unused
- ///
+ /// User settings, for media dumps, completely unused
public class UserSettings
{
public string Email;
public string Name;
}
- ///
- /// Statistics settings
- ///
+ /// Statistics settings
public class StatsSettings
{
- ///
- /// If set to true, benchmark statistics will be stored
- ///
- public bool BenchmarkStats;
- ///
- /// If set to true, command usage statistics will be stored
- ///
+ /// If set to true, benchmark statistics will be stored
+ public bool BenchmarkStats = false;
+ /// If set to true, command usage statistics will be stored
public bool CommandStats;
- ///
- /// If set to true, device statistics will be stored
- ///
+ /// If set to true, device statistics will be stored
public bool DeviceStats;
- ///
- /// If set to true, filesystem statistics will be stored
- ///
+ /// If set to true, filesystem statistics will be stored
public bool FilesystemStats;
- ///
- /// If set to true, filters statistics will be stored
- ///
+ /// If set to true, filters statistics will be stored
public bool FilterStats;
- ///
- /// If set to true, dump media images statistics will be stored
- ///
+ /// If set to true, dump media images statistics will be stored
public bool MediaImageStats;
- ///
- /// If set to true, media scan statistics will be stored
- ///
+ /// If set to true, media scan statistics will be stored
public bool MediaScanStats;
- ///
- /// If set to true, media types statistics will be stored
- ///
+ /// If set to true, media types statistics will be stored
public bool MediaStats;
- ///
- /// If set to true, partition schemes statistics will be stored
- ///
+ /// If set to true, partition schemes statistics will be stored
public bool PartitionStats;
- ///
- /// If set to true, statistics will be sent to DiscImageChef.Server
- ///
+ /// If set to true, statistics will be sent to DiscImageChef.Server
public bool ShareStats;
- ///
- /// If set to true, dump media verification statistics will be stored
- ///
+ /// If set to true, dump media verification statistics will be stored
public bool VerifyStats;
}
- ///
- /// Manages statistics
- ///
+ /// Manages statistics
public static class Settings
{
const string XDG_DATA_HOME = "XDG_DATA_HOME";
@@ -140,27 +102,19 @@ namespace DiscImageChef.Settings
const string OLD_DATA_HOME = ".claunia.com";
const string XDG_DATA_HOME_RESOLVED = ".local/share";
const string XDG_CONFIG_HOME_RESOLVED = ".config";
- ///
- /// Current statistcs
- ///
+ /// Current statistcs
public static DicSettings Current;
- ///
- /// Global path to save reports
- ///
+ /// Global path to save reports
static string ReportsPath { get; set; }
- ///
- /// Global path to save statistics
- ///
+ /// Global path to save statistics
public static string StatsPath { get; private set; }
public static string LocalDbPath { get; private set; }
public static string MasterDbPath { get; private set; }
- ///
- /// Loads settings
- ///
+ /// Loads settings
public static void LoadSettings()
{
Current = new DicSettings();
@@ -180,21 +134,31 @@ namespace DiscImageChef.Settings
string appSupportPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library",
"Application Support", "Claunia.com");
- if(!Directory.Exists(appSupportPath)) Directory.CreateDirectory(appSupportPath);
+
+ if(!Directory.Exists(appSupportPath))
+ Directory.CreateDirectory(appSupportPath);
string dicPath = Path.Combine(appSupportPath, "DiscImageChef");
- if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
+
+ if(!Directory.Exists(dicPath))
+ Directory.CreateDirectory(dicPath);
LocalDbPath = Path.Combine(dicPath, LocalDbPath);
MasterDbPath = Path.Combine(dicPath, MasterDbPath);
ReportsPath = Path.Combine(dicPath, "Reports");
- if(!Directory.Exists(ReportsPath)) Directory.CreateDirectory(ReportsPath);
+
+ if(!Directory.Exists(ReportsPath))
+ Directory.CreateDirectory(ReportsPath);
StatsPath = Path.Combine(dicPath, "Statistics");
- if(!Directory.Exists(StatsPath)) Directory.CreateDirectory(StatsPath);
+
+ if(!Directory.Exists(StatsPath))
+ Directory.CreateDirectory(StatsPath);
}
+
break;
+
// In case of Windows statistics and reports will be saved in %APPDATA%\Claunia.com\DiscImageChef
case PlatformID.Win32NT:
case PlatformID.Win32S:
@@ -205,21 +169,31 @@ namespace DiscImageChef.Settings
string appSupportPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"Claunia.com");
- if(!Directory.Exists(appSupportPath)) Directory.CreateDirectory(appSupportPath);
+
+ if(!Directory.Exists(appSupportPath))
+ Directory.CreateDirectory(appSupportPath);
string dicPath = Path.Combine(appSupportPath, "DiscImageChef");
- if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
+
+ if(!Directory.Exists(dicPath))
+ Directory.CreateDirectory(dicPath);
LocalDbPath = Path.Combine(dicPath, LocalDbPath);
MasterDbPath = Path.Combine(dicPath, MasterDbPath);
ReportsPath = Path.Combine(dicPath, "Reports");
- if(!Directory.Exists(ReportsPath)) Directory.CreateDirectory(ReportsPath);
+
+ if(!Directory.Exists(ReportsPath))
+ Directory.CreateDirectory(ReportsPath);
StatsPath = Path.Combine(dicPath, "Statistics");
- if(!Directory.Exists(StatsPath)) Directory.CreateDirectory(StatsPath);
+
+ if(!Directory.Exists(StatsPath))
+ Directory.CreateDirectory(StatsPath);
}
+
break;
+
// Otherwise, statistics and reports will be saved in ~/.claunia.com/DiscImageChef
default:
{
@@ -227,30 +201,40 @@ namespace DiscImageChef.Settings
Path.Combine(homePath,
Environment.GetEnvironmentVariable(XDG_DATA_HOME) ?? XDG_DATA_HOME_RESOLVED);
- string oldDicPath = Path.Combine(homePath, ".claunia.com", "DiscImageChef");
+ string oldDicPath = Path.Combine(homePath, ".claunia.com", "DiscImageChef");
string dicPath = Path.Combine(xdgDataPath, "DiscImageChef");
- if(Directory.Exists(oldDicPath) && !Directory.Exists(dicPath))
+ if(Directory.Exists(oldDicPath) &&
+ !Directory.Exists(dicPath))
{
Directory.Move(oldDicPath, dicPath);
Directory.Delete(Path.Combine(homePath, ".claunia.com"));
}
- if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
+ if(!Directory.Exists(dicPath))
+ Directory.CreateDirectory(dicPath);
LocalDbPath = Path.Combine(dicPath, LocalDbPath);
MasterDbPath = Path.Combine(dicPath, MasterDbPath);
ReportsPath = Path.Combine(dicPath, "Reports");
- if(!Directory.Exists(ReportsPath)) Directory.CreateDirectory(ReportsPath);
+
+ if(!Directory.Exists(ReportsPath))
+ Directory.CreateDirectory(ReportsPath);
StatsPath = Path.Combine(dicPath, "Statistics");
- if(!Directory.Exists(StatsPath)) Directory.CreateDirectory(StatsPath);
+
+ if(!Directory.Exists(StatsPath))
+ Directory.CreateDirectory(StatsPath);
}
+
break;
}
}
- catch { ReportsPath = null; }
+ catch
+ {
+ ReportsPath = null;
+ }
FileStream prefsFs = null;
StreamReader prefsSr = null;
@@ -266,6 +250,7 @@ namespace DiscImageChef.Settings
string preferencesPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library",
"Preferences");
+
string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.discimagechef.plist");
if(!File.Exists(preferencesFilePath))
@@ -276,7 +261,8 @@ namespace DiscImageChef.Settings
prefsFs = new FileStream(preferencesFilePath, FileMode.Open, FileAccess.Read);
- NSDictionary parsedPreferences = (NSDictionary)BinaryPropertyListParser.Parse(prefsFs);
+ var parsedPreferences = (NSDictionary)BinaryPropertyListParser.Parse(prefsFs);
+
if(parsedPreferences != null)
{
Current.SaveReportsGlobally =
@@ -288,47 +274,38 @@ namespace DiscImageChef.Settings
if(parsedPreferences.TryGetValue("Stats", out obj))
{
- NSDictionary stats = (NSDictionary)obj;
+ var stats = (NSDictionary)obj;
if(stats != null)
Current.Stats = new StatsSettings
{
- ShareStats =
- stats.TryGetValue("ShareStats", out NSObject obj2) &&
- ((NSNumber)obj2).ToBool(),
- BenchmarkStats =
- stats.TryGetValue("BenchmarkStats", out obj2) &&
- ((NSNumber)obj2).ToBool(),
- CommandStats =
- stats.TryGetValue("CommandStats", out obj2) &&
- ((NSNumber)obj2).ToBool(),
- DeviceStats =
- stats.TryGetValue("DeviceStats", out obj2) && ((NSNumber)obj2).ToBool(),
+ ShareStats = stats.TryGetValue("ShareStats", out NSObject obj2) &&
+ ((NSNumber)obj2).ToBool(),
+ CommandStats = stats.TryGetValue("CommandStats", out obj2) &&
+ ((NSNumber)obj2).ToBool(),
+ DeviceStats = stats.TryGetValue("DeviceStats", out obj2) &&
+ ((NSNumber)obj2).ToBool(),
FilesystemStats =
- stats.TryGetValue("FilesystemStats", out obj2) &&
- ((NSNumber)obj2).ToBool(),
- FilterStats =
- stats.TryGetValue("FilterStats", out obj2) && ((NSNumber)obj2).ToBool(),
+ stats.TryGetValue("FilesystemStats", out obj2) && ((NSNumber)obj2).ToBool(),
+ FilterStats = stats.TryGetValue("FilterStats", out obj2) &&
+ ((NSNumber)obj2).ToBool(),
MediaImageStats =
- stats.TryGetValue("MediaImageStats", out obj2) &&
- ((NSNumber)obj2).ToBool(),
+ stats.TryGetValue("MediaImageStats", out obj2) && ((NSNumber)obj2).ToBool(),
MediaScanStats =
- stats.TryGetValue("MediaScanStats", out obj2) &&
- ((NSNumber)obj2).ToBool(),
+ stats.TryGetValue("MediaScanStats", out obj2) && ((NSNumber)obj2).ToBool(),
PartitionStats =
- stats.TryGetValue("PartitionStats", out obj2) &&
- ((NSNumber)obj2).ToBool(),
- MediaStats =
- stats.TryGetValue("MediaStats", out obj2) && ((NSNumber)obj2).ToBool(),
- VerifyStats =
- stats.TryGetValue("VerifyStats", out obj2) && ((NSNumber)obj2).ToBool()
+ stats.TryGetValue("PartitionStats", out obj2) && ((NSNumber)obj2).ToBool(),
+ MediaStats = stats.TryGetValue("MediaStats", out obj2) &&
+ ((NSNumber)obj2).ToBool(),
+ VerifyStats = stats.TryGetValue("VerifyStats", out obj2) &&
+ ((NSNumber)obj2).ToBool()
};
}
- else Current.Stats = null;
+ else
+ Current.Stats = null;
Current.GdprCompliance = parsedPreferences.TryGetValue("GdprCompliance", out obj)
- ? (ulong)((NSNumber)obj).ToLong()
- : 0;
+ ? (ulong)((NSNumber)obj).ToLong() : 0;
prefsFs.Close();
}
@@ -340,8 +317,10 @@ namespace DiscImageChef.Settings
SaveSettings();
}
}
+
break;
- #if !NETSTANDARD2_0
+ #if !NETSTANDARD2_0
+
// In case of Windows settings will be saved in the registry: HKLM/SOFTWARE/Claunia.com/DiscImageChef
case PlatformID.Win32NT:
case PlatformID.Win32S:
@@ -350,18 +329,22 @@ namespace DiscImageChef.Settings
case PlatformID.WindowsPhone:
{
RegistryKey parentKey = Registry.CurrentUser.OpenSubKey("SOFTWARE")?.OpenSubKey("Claunia.com");
+
if(parentKey == null)
{
SetDefaultSettings();
SaveSettings();
+
return;
}
RegistryKey key = parentKey.OpenSubKey("DiscImageChef");
+
if(key == null)
{
SetDefaultSettings();
SaveSettings();
+
return;
}
@@ -370,11 +353,11 @@ namespace DiscImageChef.Settings
Current.GdprCompliance = Convert.ToUInt64(key.GetValue("GdprCompliance"));
bool stats = Convert.ToBoolean(key.GetValue("Statistics"));
+
if(stats)
Current.Stats = new StatsSettings
{
ShareStats = Convert.ToBoolean(key.GetValue("ShareStats")),
- BenchmarkStats = Convert.ToBoolean(key.GetValue("BenchmarkStats")),
CommandStats = Convert.ToBoolean(key.GetValue("CommandStats")),
DeviceStats = Convert.ToBoolean(key.GetValue("DeviceStats")),
FilesystemStats = Convert.ToBoolean(key.GetValue("FilesystemStats")),
@@ -388,23 +371,29 @@ namespace DiscImageChef.Settings
}
break;
- #endif
+ #endif
+
// Otherwise, settings will be saved in ~/.config/DiscImageChef.xml
default:
{
string oldConfigPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config");
+
string oldSettingsPath = Path.Combine(oldConfigPath, "DiscImageChef.xml");
string xdgConfigPath =
Path.Combine(homePath,
Environment.GetEnvironmentVariable(XDG_CONFIG_HOME) ??
XDG_CONFIG_HOME_RESOLVED);
+
string settingsPath = Path.Combine(xdgConfigPath, "DiscImageChef.xml");
- if(File.Exists(oldSettingsPath) && !File.Exists(settingsPath))
+ if(File.Exists(oldSettingsPath) &&
+ !File.Exists(settingsPath))
{
- if(!Directory.Exists(xdgConfigPath)) Directory.CreateDirectory(xdgConfigPath);
+ if(!Directory.Exists(xdgConfigPath))
+ Directory.CreateDirectory(xdgConfigPath);
+
File.Move(oldSettingsPath, settingsPath);
}
@@ -412,10 +401,11 @@ namespace DiscImageChef.Settings
{
SetDefaultSettings();
SaveSettings();
+
return;
}
- XmlSerializer xs = new XmlSerializer(Current.GetType());
+ var xs = new XmlSerializer(Current.GetType());
prefsSr = new StreamReader(settingsPath);
Current = (DicSettings)xs.Deserialize(prefsSr);
}
@@ -444,42 +434,72 @@ namespace DiscImageChef.Settings
case PlatformID.MacOSX:
case PlatformID.iOS:
{
- NSDictionary root = new NSDictionary
+ var root = new NSDictionary
{
- {"SaveReportsGlobally", Current.SaveReportsGlobally},
- {"ShareReports", Current.ShareReports},
- {"GdprCompliance", Current.GdprCompliance}
+ {
+ "SaveReportsGlobally", Current.SaveReportsGlobally
+ },
+ {
+ "ShareReports", Current.ShareReports
+ },
+ {
+ "GdprCompliance", Current.GdprCompliance
+ }
};
+
if(Current.Stats != null)
{
- NSDictionary stats = new NSDictionary
+ var stats = new NSDictionary
{
- {"ShareStats", Current.Stats.ShareStats},
- {"BenchmarkStats", Current.Stats.BenchmarkStats},
- {"CommandStats", Current.Stats.CommandStats},
- {"DeviceStats", Current.Stats.DeviceStats},
- {"FilesystemStats", Current.Stats.FilesystemStats},
- {"FilterStats", Current.Stats.FilterStats},
- {"MediaImageStats", Current.Stats.MediaImageStats},
- {"MediaScanStats", Current.Stats.MediaScanStats},
- {"PartitionStats", Current.Stats.PartitionStats},
- {"MediaStats", Current.Stats.MediaStats},
- {"VerifyStats", Current.Stats.VerifyStats}
+ {
+ "ShareStats", Current.Stats.ShareStats
+ },
+ {
+ "CommandStats", Current.Stats.CommandStats
+ },
+ {
+ "DeviceStats", Current.Stats.DeviceStats
+ },
+ {
+ "FilesystemStats", Current.Stats.FilesystemStats
+ },
+ {
+ "FilterStats", Current.Stats.FilterStats
+ },
+ {
+ "MediaImageStats", Current.Stats.MediaImageStats
+ },
+ {
+ "MediaScanStats", Current.Stats.MediaScanStats
+ },
+ {
+ "PartitionStats", Current.Stats.PartitionStats
+ },
+ {
+ "MediaStats", Current.Stats.MediaStats
+ },
+ {
+ "VerifyStats", Current.Stats.VerifyStats
+ }
};
+
root.Add("Stats", stats);
}
string preferencesPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library",
"Preferences");
+
string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.discimagechef.plist");
- FileStream fs = new FileStream(preferencesFilePath, FileMode.Create);
+ var fs = new FileStream(preferencesFilePath, FileMode.Create);
BinaryPropertyListWriter.Write(fs, root);
fs.Close();
}
+
break;
- #if !NETSTANDARD2_0
+ #if !NETSTANDARD2_0
+
// In case of Windows settings will be saved in the registry: HKLM/SOFTWARE/Claunia.com/DiscImageChef
case PlatformID.Win32NT:
case PlatformID.Win32S:
@@ -489,64 +509,69 @@ namespace DiscImageChef.Settings
{
RegistryKey parentKey =
Registry.CurrentUser.OpenSubKey("SOFTWARE", true)?.CreateSubKey("Claunia.com");
+
RegistryKey key = parentKey?.CreateSubKey("DiscImageChef");
if(key != null)
{
key.SetValue("SaveReportsGlobally", Current.SaveReportsGlobally);
- key.SetValue("ShareReports", Current.ShareReports);
- key.SetValue("GdprCompliance", Current.GdprCompliance);
+ key.SetValue("ShareReports", Current.ShareReports);
+ key.SetValue("GdprCompliance", Current.GdprCompliance);
if(Current.Stats != null)
{
- key.SetValue("Statistics", true);
- key.SetValue("ShareStats", Current.Stats.ShareStats);
- key.SetValue("BenchmarkStats", Current.Stats.BenchmarkStats);
- key.SetValue("CommandStats", Current.Stats.CommandStats);
- key.SetValue("DeviceStats", Current.Stats.DeviceStats);
+ key.SetValue("Statistics", true);
+ key.SetValue("ShareStats", Current.Stats.ShareStats);
+ key.SetValue("CommandStats", Current.Stats.CommandStats);
+ key.SetValue("DeviceStats", Current.Stats.DeviceStats);
key.SetValue("FilesystemStats", Current.Stats.FilesystemStats);
- key.SetValue("FilterStats", Current.Stats.FilterStats);
+ key.SetValue("FilterStats", Current.Stats.FilterStats);
key.SetValue("MediaImageStats", Current.Stats.MediaImageStats);
- key.SetValue("MediaScanStats", Current.Stats.MediaScanStats);
- key.SetValue("PartitionStats", Current.Stats.PartitionStats);
- key.SetValue("MediaStats", Current.Stats.MediaStats);
- key.SetValue("VerifyStats", Current.Stats.VerifyStats);
+ key.SetValue("MediaScanStats", Current.Stats.MediaScanStats);
+ key.SetValue("PartitionStats", Current.Stats.PartitionStats);
+ key.SetValue("MediaStats", Current.Stats.MediaStats);
+ key.SetValue("VerifyStats", Current.Stats.VerifyStats);
}
else
{
key.SetValue("Statistics", true);
- key.DeleteValue("ShareStats", false);
- key.DeleteValue("BenchmarkStats", false);
- key.DeleteValue("CommandStats", false);
- key.DeleteValue("DeviceStats", false);
+ key.DeleteValue("ShareStats", false);
+ key.DeleteValue("CommandStats", false);
+ key.DeleteValue("DeviceStats", false);
key.DeleteValue("FilesystemStats", false);
key.DeleteValue("MediaImageStats", false);
- key.DeleteValue("MediaScanStats", false);
- key.DeleteValue("PartitionStats", false);
- key.DeleteValue("MediaStats", false);
- key.DeleteValue("VerifyStats", false);
+ key.DeleteValue("MediaScanStats", false);
+ key.DeleteValue("PartitionStats", false);
+ key.DeleteValue("MediaStats", false);
+ key.DeleteValue("VerifyStats", false);
}
}
}
+
break;
- #endif
+ #endif
+
// Otherwise, settings will be saved in ~/.config/DiscImageChef.xml
default:
{
string homePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
+
string xdgConfigPath =
Path.Combine(homePath,
Environment.GetEnvironmentVariable(XDG_CONFIG_HOME) ??
XDG_CONFIG_HOME_RESOLVED);
+
string settingsPath = Path.Combine(xdgConfigPath, "DiscImageChef.xml");
- if(!Directory.Exists(xdgConfigPath)) Directory.CreateDirectory(xdgConfigPath);
+ if(!Directory.Exists(xdgConfigPath))
+ Directory.CreateDirectory(xdgConfigPath);
- FileStream fs = new FileStream(settingsPath, FileMode.Create);
- XmlSerializer xs = new XmlSerializer(Current.GetType());
+ var fs = new FileStream(settingsPath, FileMode.Create);
+ var xs = new XmlSerializer(Current.GetType());
xs.Serialize(fs, Current);
fs.Close();
}
+
break;
}
}
@@ -558,31 +583,15 @@ namespace DiscImageChef.Settings
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
}
- ///
- /// Sets default settings as all statistics, share everything
- ///
- static void SetDefaultSettings()
+ /// Sets default settings as all statistics, share everything
+ static void SetDefaultSettings() => Current = new DicSettings
{
- Current = new DicSettings
+ SaveReportsGlobally = true, ShareReports = true, GdprCompliance = 0, Stats = new StatsSettings
{
- SaveReportsGlobally = true,
- ShareReports = true,
- GdprCompliance = 0,
- Stats = new StatsSettings
- {
- BenchmarkStats = true,
- CommandStats = true,
- DeviceStats = true,
- FilesystemStats = true,
- MediaImageStats = true,
- MediaScanStats = true,
- FilterStats = true,
- MediaStats = true,
- PartitionStats = true,
- ShareStats = true,
- VerifyStats = true
- }
- };
- }
+ CommandStats = true, DeviceStats = true, FilesystemStats = true, MediaImageStats = true,
+ MediaScanStats = true, FilterStats = true, MediaStats = true, PartitionStats = true,
+ ShareStats = true, VerifyStats = true
+ }
+ };
}
}
\ No newline at end of file
diff --git a/DiscImageChef/Commands/Benchmark.cs b/DiscImageChef/Commands/Benchmark.cs
deleted file mode 100644
index 4ffddb7c2..000000000
--- a/DiscImageChef/Commands/Benchmark.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-// /***************************************************************************
-// The Disc Image Chef
-// ----------------------------------------------------------------------------
-//
-// Filename : Benchmark.cs
-// Author(s) : Natalia Portillo
-//
-// Component : Verbs.
-//
-// --[ Description ] ----------------------------------------------------------
-//
-// Implements the 'benchmark' verb.
-//
-// --[ 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 .
-//
-// ----------------------------------------------------------------------------
-// Copyright © 2011-2020 Natalia Portillo
-// ****************************************************************************/
-
-using System.Collections.Generic;
-using System.CommandLine;
-using System.CommandLine.Invocation;
-using DiscImageChef.CommonTypes.Enums;
-using DiscImageChef.Console;
-using DiscImageChef.Core;
-
-namespace DiscImageChef.Commands
-{
- internal class BenchmarkCommand : Command
- {
- public BenchmarkCommand() : base("benchmark", "Benchmarks hashing and entropy calculation.")
- {
- Add(new Option(new[]
- {
- "--block-size", "-b"
- }, "Block size.")
- {
- Argument = new Argument(() => 512), Required = false
- });
-
- Add(new Option(new[]
- {
- "--buffer-size", "-s"
- }, "Buffer size in mebibytes.")
- {
- Argument = new Argument(() => 128), Required = false
- });
-
- AddArgument(new Argument
- {
- Arity = ArgumentArity.ExactlyOne, Description = "Disc image path", Name = "image-path"
- });
-
- Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
- }
-
- public static int Invoke(bool debug, bool verbose, int blockSize, int bufferSize)
- {
- MainClass.PrintCopyright();
-
- if(debug)
- DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
-
- if(verbose)
- DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
-
- Statistics.AddCommand("benchmark");
-
- DicConsole.DebugWriteLine("Benchmark command", "--debug={0}", debug);
- DicConsole.DebugWriteLine("Benchmark command", "--verbose={0}", verbose);
-
- Benchmark.InitProgressEvent += Progress.InitProgress;
- Benchmark.UpdateProgressEvent += Progress.UpdateProgress;
- Benchmark.EndProgressEvent += Progress.EndProgress;
-
- BenchmarkResults results = Benchmark.Do(bufferSize * 1024 * 1024, blockSize);
-
- DicConsole.WriteLine("Took {0} seconds to fill buffer, {1:F3} MiB/sec.", results.FillTime,
- results.FillSpeed);
-
- DicConsole.WriteLine("Took {0} seconds to read buffer, {1:F3} MiB/sec.", results.ReadTime,
- results.ReadSpeed);
-
- DicConsole.WriteLine("Took {0} seconds to entropy buffer, {1:F3} MiB/sec.", results.EntropyTime,
- results.EntropySpeed);
-
- foreach(KeyValuePair entry in results.Entries)
- DicConsole.WriteLine("Took {0} seconds to {1} buffer, {2:F3} MiB/sec.", entry.Value.TimeSpan, entry.Key,
- entry.Value.Speed);
-
- DicConsole.WriteLine("Took {0} seconds to do all algorithms at the same time, {1:F3} MiB/sec.",
- results.TotalTime, results.TotalSpeed);
-
- DicConsole.WriteLine("Took {0} seconds to do all algorithms sequentially, {1:F3} MiB/sec.",
- results.SeparateTime, results.SeparateSpeed);
-
- DicConsole.WriteLine();
- DicConsole.WriteLine("Max memory used is {0} bytes", results.MaxMemory);
- DicConsole.WriteLine("Min memory used is {0} bytes", results.MinMemory);
-
- return(int)ErrorNumber.NoError;
- }
- }
-}
\ No newline at end of file
diff --git a/DiscImageChef/Commands/Configure.cs b/DiscImageChef/Commands/Configure.cs
index fc1f6af94..fd3432dfa 100644
--- a/DiscImageChef/Commands/Configure.cs
+++ b/DiscImageChef/Commands/Configure.cs
@@ -165,18 +165,6 @@ namespace DiscImageChef.Commands
pressedKey = new ConsoleKeyInfo();
- while(pressedKey.Key != ConsoleKey.Y &&
- pressedKey.Key != ConsoleKey.N)
- {
- DicConsole.Write("Do you want to gather statistics about benchmarks? (Y/N): ");
- pressedKey = System.Console.ReadKey();
- DicConsole.WriteLine();
- }
-
- Settings.Settings.Current.Stats.BenchmarkStats = pressedKey.Key == ConsoleKey.Y;
-
- pressedKey = new ConsoleKeyInfo();
-
while(pressedKey.Key != ConsoleKey.Y &&
pressedKey.Key != ConsoleKey.N)
{
diff --git a/DiscImageChef/DiscImageChef.csproj b/DiscImageChef/DiscImageChef.csproj
index b4cf39207..d8d4e084e 100644
--- a/DiscImageChef/DiscImageChef.csproj
+++ b/DiscImageChef/DiscImageChef.csproj
@@ -83,9 +83,6 @@
-
- False
-
diff --git a/DiscImageChef/Main.cs b/DiscImageChef/Main.cs
index 506dca3c6..8db5d31bf 100644
--- a/DiscImageChef/Main.cs
+++ b/DiscImageChef/Main.cs
@@ -148,7 +148,6 @@ namespace DiscImageChef
rootCommand.AddCommand(new ImageFamily());
rootCommand.AddCommand(new MediaFamily());
- rootCommand.AddCommand(new BenchmarkCommand());
rootCommand.AddCommand(new ConfigureCommand(false, false));
rootCommand.AddCommand(new FormatsCommand());
rootCommand.AddCommand(new ListEncodingsCommand());