diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs
index a31a070e6..fbb030ec9 100644
--- a/ApplicationView/ApplicationController.cs
+++ b/ApplicationView/ApplicationController.cs
@@ -1143,28 +1143,6 @@ namespace MatterHackers.MatterControl
}
}
- public string ComputeFileSha1(string filePath)
- {
- using (var stream = File.OpenRead(filePath))
- {
- return GenerateSha1(stream);
- }
- }
-
- private string GenerateSha1(Stream stream)
- {
- // var timer = Stopwatch.StartNew();
- using (var sha1 = System.Security.Cryptography.SHA1.Create())
- {
- byte[] hash = sha1.ComputeHash(stream);
- string SHA1 = BitConverter.ToString(hash).Replace("-", String.Empty);
-
- // Console.WriteLine("{0} {1} {2}", SHA1, timer.ElapsedMilliseconds, filePath);
- return SHA1;
- }
- }
-
-
///
/// Compute hash for string encoded as UTF8
///
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index ece2d026b..ba392cf60 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -22,6 +22,7 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("MatterControl.Tests")]
[assembly: InternalsVisibleTo("MatterControl.AutomationTests")]
+[assembly: InternalsVisibleTo("CloudServices.Tests")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1558c103-dff3-49bd-854b-97d57339d662")]
diff --git a/Queue/PrintItemWrapper.cs b/Queue/PrintItemWrapper.cs
index 78500f591..d1b3a6df0 100644
--- a/Queue/PrintItemWrapper.cs
+++ b/Queue/PrintItemWrapper.cs
@@ -33,6 +33,7 @@ using System.Globalization;
using System.IO;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
+using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.Library;
@@ -102,7 +103,7 @@ namespace MatterHackers.MatterControl.PrintQueue
{
if (File.Exists(this.FileLocation))
{
- return ApplicationController.Instance.ComputeFileSha1(this.FileLocation);
+ return Object3D.ComputeSHA1(this.FileLocation);
}
return "file-missing";
diff --git a/SlicerConfiguration/Settings/PrinterSettings.cs b/SlicerConfiguration/Settings/PrinterSettings.cs
index 155300e1c..4894c6506 100644
--- a/SlicerConfiguration/Settings/PrinterSettings.cs
+++ b/SlicerConfiguration/Settings/PrinterSettings.cs
@@ -39,6 +39,7 @@ using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
+using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.ContactForm;
using MatterHackers.MatterControl.SettingsManagement;
@@ -335,29 +336,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public List MaterialSettingsKeys { get; set; } = new List();
- private string GenerateSha1()
- {
- // Maybe be UTF8 encoded, may not...
- using (var fileStream = new FileStream(DocumentPath, FileMode.Open))
- using (var bufferedStream = new BufferedStream(fileStream, 1200000))
- {
- return GenerateSha1(bufferedStream);
- }
- }
-
- private string GenerateSha1(Stream stream)
- {
- // var timer = Stopwatch.StartNew();
- using (var sha1 = System.Security.Cryptography.SHA1.Create())
- {
- byte[] hash = sha1.ComputeHash(stream);
- string SHA1 = BitConverter.ToString(hash).Replace("-", String.Empty);
-
- // Console.WriteLine("{0} {1} {2}", SHA1, timer.ElapsedMilliseconds, filePath);
- return SHA1;
- }
- }
-
[JsonIgnore]
public string DocumentPath => ProfileManager.Instance.ProfilePath(this.ID);
@@ -384,7 +362,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
var printerInfo = ProfileManager.Instance[this.ID];
if (printerInfo != null)
{
- printerInfo.ContentSHA1 = this.ComputeSha1(json);
+ printerInfo.ContentSHA1 = this.ComputeSHA1(json);
ProfileManager.Instance.Save();
}
@@ -397,17 +375,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
}
- public string ComputeSha1()
+ internal string ComputeSHA1()
{
- return ComputeSha1(this.ToJson());
+ return ComputeSHA1(this.ToJson());
}
- private string ComputeSha1(string json)
+ private string ComputeSHA1(string json)
{
// SHA1 value is based on UTF8 encoded file contents
using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(json)))
{
- return GenerateSha1(memoryStream);
+ return Object3D.ComputeSHA1(memoryStream);
}
}