diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs
index ee5b7a936..063c9cda6 100644
--- a/MatterControlLib/ApplicationView/ApplicationController.cs
+++ b/MatterControlLib/ApplicationView/ApplicationController.cs
@@ -2566,12 +2566,8 @@ namespace MatterHackers.MatterControl
// Create archive point for printing attempt
if (Path.GetExtension(sourcePath).ToUpper() == ".MCX")
{
- // TODO: We should zip mcx and settings when starting a print
- string platingDirectory = Path.Combine(ApplicationDataStorage.Instance.ApplicationLibraryDataPath, "PrintHistory");
- Directory.CreateDirectory(platingDirectory);
-
string now = "Workspace " + DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss");
- string archivePath = Path.Combine(platingDirectory, now + ".zip");
+ string archivePath = Path.Combine(ApplicationDataStorage.Instance.PrintHistoryPath, now + ".zip");
string settingsFilePath = ProfileManager.Instance.ProfilePath(printer.Settings.ID);
diff --git a/MatterControlLib/DataStorage/ApplicationDataStorage.cs b/MatterControlLib/DataStorage/ApplicationDataStorage.cs
index b9a34906a..c3ba816c9 100644
--- a/MatterControlLib/DataStorage/ApplicationDataStorage.cs
+++ b/MatterControlLib/DataStorage/ApplicationDataStorage.cs
@@ -28,19 +28,25 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
+using System.Diagnostics.CodeAnalysis;
using System.IO;
namespace MatterHackers.MatterControl.DataStorage
{
+ [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Private getters used to enforce presence of directories")]
public class ApplicationDataStorage
{
- public bool FirstRun = false;
+ // Required by Android
+ public bool FirstRun { get; set; } = false;
- //Describes the location for storing all local application data
+ // Describes the location for storing all local application data
private static ApplicationDataStorage globalInstance;
- private const string applicationDataFolderName = "MatterControl";
- private const string datastoreName = "MatterControl.db";
+ private const string ApplicationDataFolderName = "MatterControl";
+
+ private const string DatastoreName = "MatterControl.db";
+
+ private string _applicationPath;
public static ApplicationDataStorage Instance
{
@@ -50,11 +56,11 @@ namespace MatterHackers.MatterControl.DataStorage
{
globalInstance = new ApplicationDataStorage();
}
+
return globalInstance;
}
}
- private string _applicationPath;
public string ApplicationPath
{
get
@@ -68,15 +74,22 @@ namespace MatterHackers.MatterControl.DataStorage
}
}
- private static string _applicationUserDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), applicationDataFolderName);
+ private static string _applicationUserDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ApplicationDataFolderName);
+
private static string _applicationLibraryDataPath => Path.Combine(_applicationUserDataPath, "Library");
+
private static string _libraryAssetPath => Path.Combine(_applicationLibraryDataPath, "Assets");
+
private static string _platingDirectory => Path.Combine(_applicationLibraryDataPath, "Plating");
- private static string _partHistoryDirectory => Path.Combine(_applicationLibraryDataPath, "PartHistory");
+
private static string _applicationTempDataPath => Path.Combine(_applicationUserDataPath, "data", "temp");
+
private static string _gcodeOutputPath => Path.Combine(_applicationTempDataPath, "gcode");
+
private static string _cacheDirectory => Path.Combine(_applicationTempDataPath, "cache");
+ private static string _printHistoryPath => Path.Combine(_applicationLibraryDataPath, "PrintHistory");
+
private static string _webCacheDirectory => Path.Combine(_applicationTempDataPath, "WebCache");
public static string ApplicationUserDataPath => EnsurePath(_applicationUserDataPath);
@@ -89,12 +102,12 @@ namespace MatterHackers.MatterControl.DataStorage
public string PlatingDirectory => EnsurePath(_platingDirectory);
- public string PartHistoryDirectory => EnsurePath(_partHistoryDirectory);
-
public string GCodeOutputPath => EnsurePath(_gcodeOutputPath);
public string CacheDirectory => EnsurePath(_cacheDirectory);
+ public string PrintHistoryPath => EnsurePath(_printHistoryPath);
+
public string WebCacheDirectory => EnsurePath(_webCacheDirectory);
public string DownloadsDirectory { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
@@ -102,20 +115,20 @@ namespace MatterHackers.MatterControl.DataStorage
public string CustomLibraryFoldersPath => Path.Combine(_applicationUserDataPath, "LibraryFolders.conf");
///
- /// Returns the path to the sqlite database
+ /// Gets the path to the Sqlite database
///
- ///
- public string DatastorePath => Path.Combine(EnsurePath(_applicationUserDataPath), datastoreName);
+ /// The path toe Sqlite database
+ public string DatastorePath => Path.Combine(EnsurePath(_applicationUserDataPath), DatastoreName);
///
- /// Returns the public storage folder (ex. download folder on Android)
+ /// Gets or sets the public storage folder (ex. download folder on Android)
///
public string PublicDataStoragePath { get; set; }
///
/// Invokes CreateDirectory on all paths, creating if missing, before returning
///
- ///
+ /// Returns the path to the given directory
private static string EnsurePath(string fullPath)
{
Directory.CreateDirectory(fullPath);
@@ -126,6 +139,7 @@ namespace MatterHackers.MatterControl.DataStorage
/// Overrides the AppData location. Used by tests to set a non-standard AppData location
///
/// The new AppData path.
+ /// The Sqlite generator with platform specific bindings
internal void OverrideAppDataLocation(string path, Func sqliteBuilder)
{
Console.WriteLine(" Overriding ApplicationUserDataPath: " + path);
diff --git a/MatterControlLib/DataStorage/Datastore.cs b/MatterControlLib/DataStorage/Datastore.cs
index b5c89202a..688952461 100644
--- a/MatterControlLib/DataStorage/Datastore.cs
+++ b/MatterControlLib/DataStorage/Datastore.cs
@@ -31,21 +31,19 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
-using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
namespace MatterHackers.MatterControl.DataStorage
{
public class Datastore
{
- bool wasExited = false;
- public bool ConnectionError = false;
+ private bool wasExited = false;
public ISQLite dbSQLite;
private string datastoreLocation = ApplicationDataStorage.Instance.DatastorePath;
private static Datastore globalInstance;
private ApplicationSession activeSession;
- private List dataStoreTables = new List
+ private readonly List dataStoreTables = new List
{
typeof(PrintItemCollection),
typeof(PrinterSetting),
@@ -76,6 +74,7 @@ namespace MatterHackers.MatterControl.DataStorage
{
globalInstance = new Datastore();
}
+
return globalInstance;
}
@@ -85,6 +84,7 @@ namespace MatterHackers.MatterControl.DataStorage
globalInstance = value;
}
}
+
public void Exit()
{
if (wasExited)
@@ -94,10 +94,10 @@ namespace MatterHackers.MatterControl.DataStorage
wasExited = true;
- if (this.activeSession != null)
+ if (activeSession != null)
{
- this.activeSession.SessionEnd = DateTime.Now;
- this.activeSession.Commit();
+ activeSession.SessionEnd = DateTime.Now;
+ activeSession.Commit();
}
// lets wait a bit to make sure the commit has resolved.
@@ -122,7 +122,7 @@ namespace MatterHackers.MatterControl.DataStorage
}
}
- //Run initial checks and operations on sqlite datastore
+ // Run initial checks and operations on sqlite datastore
public void Initialize(ISQLite dbSQLite)
{
this.dbSQLite = dbSQLite;
@@ -148,25 +148,13 @@ namespace MatterHackers.MatterControl.DataStorage
return Convert.ToInt32(result);
}
- //Begins new application session record
+ // Begins new application session record
private void StartSession()
{
activeSession = new ApplicationSession();
dbSQLite.Insert(activeSession);
}
- private void GenerateSampleData()
- {
- for (int index = 1; index <= 5; index++)
- {
- Printer printer = new Printer();
- printer.ComPort = string.Format("COM{0}", index);
- printer.BaudRate = "250000";
- printer.Name = string.Format("Printer {0}", index);
- Datastore.Instance.dbSQLite.Insert(printer);
- }
- }
-
// Checks if the datastore contains the appropriate tables - adds them if necessary
private void ValidateSchema()
{
diff --git a/MatterControlLib/PartPreviewWindow/View3D/InteractionLayer.cs b/MatterControlLib/PartPreviewWindow/View3D/InteractionLayer.cs
index 982ed0657..0cec779a2 100644
--- a/MatterControlLib/PartPreviewWindow/View3D/InteractionLayer.cs
+++ b/MatterControlLib/PartPreviewWindow/View3D/InteractionLayer.cs
@@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
graphics2D.Clear(Color.White);
graphics2D.FillRectangle(0, 0, ViewOnlyTexture.Width / 2, ViewOnlyTexture.Height, Color.LightGray);
// request the texture so we can set it to repeat
- var plugin = ImageGlPlugin.GetImageGlPlugin(ViewOnlyTexture, true, true, false);
+ ImageGlPlugin.GetImageGlPlugin(ViewOnlyTexture, true, true, false);
});
}
diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp
index 14a7b7033..f78e55d7e 160000
--- a/Submodules/agg-sharp
+++ b/Submodules/agg-sharp
@@ -1 +1 @@
-Subproject commit 14a7b70331b8001ff55e46363d973ee95e4cac5c
+Subproject commit f78e55d7e1f027eafd9c6808bbb3587f3b0abda4