Merge pull request #3588 from jlewin/master

Revise Load apis and caching
This commit is contained in:
Lars Brubaker 2018-08-01 21:30:55 -07:00 committed by GitHub
commit ec195a1f3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 174 additions and 65 deletions

View file

@ -131,8 +131,6 @@ namespace MatterHackers.MatterControl
private static PrinterConfig emptyPrinter = new PrinterConfig(PrinterSettings.Empty);
private static string cacheDirectory = Path.Combine(ApplicationDataStorage.ApplicationUserDataPath, "data", "temp", "cache");
// TODO: Any references to this property almost certainly need to be reconsidered. ActiveSliceSettings static references that assume a single printer
// selection are being redirected here. This allows us to break the dependency to the original statics and consolidates
// us down to a single point where code is making assumptions about the presence of a printer, printer counts, etc. If we previously checked for
@ -1309,7 +1307,7 @@ namespace MatterHackers.MatterControl
public static string CacheablePath(string cacheScope, string cacheKey)
{
string scopeDirectory = Path.Combine(cacheDirectory, cacheScope);
string scopeDirectory = Path.Combine(ApplicationDataStorage.Instance.CacheDirectory, cacheScope);
// Ensure directory exists
Directory.CreateDirectory(scopeDirectory);

View file

@ -37,6 +37,7 @@ namespace MatterHackers.MatterControl
using MatterHackers.Agg.Platform;
using MatterHackers.DataConverters3D;
using MatterHackers.PolygonMesh;
using MatterHackers.PolygonMesh.Processors;
using MatterHackers.RenderOpenGl;
using MatterHackers.VectorMath;
@ -55,7 +56,7 @@ namespace MatterHackers.MatterControl
using (var logoStream = AggContext.StaticData.OpenStream(Path.Combine("Stls", "MH Logo.stl")))
{
logoMesh = MeshFileIo.Load(logoStream, ".stl", CancellationToken.None).Mesh;
logoMesh = StlProcessing.Load(logoStream, CancellationToken.None);
}
// Position

View file

@ -347,7 +347,7 @@ namespace MatterHackers.MatterControl
using (var stream = ApplicationController.Instance.LoadHttpAsset(url))
{
var mesh = MeshFileIo.Load(stream, extension, CancellationToken.None).Mesh;
var mesh = Object3D.Load(stream, extension, CancellationToken.None).Mesh;
BspNode bspTree = null;

View file

@ -75,6 +75,7 @@ namespace MatterHackers.MatterControl.DataStorage
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");
public static string ApplicationUserDataPath => EnsurePath(_applicationUserDataPath);
@ -90,6 +91,8 @@ namespace MatterHackers.MatterControl.DataStorage
public string GCodeOutputPath => EnsurePath(_gcodeOutputPath);
public string CacheDirectory => EnsurePath(_cacheDirectory );
public string DownloadsDirectory { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
public string CustomLibraryFoldersPath => Path.Combine(_applicationUserDataPath, "LibraryFolders.conf");

View file

@ -46,13 +46,13 @@ namespace MatterHackers.MatterControl.Library.Export
{
// If the content is an IObject3D, the we need to load it and MeshFileIO save to the target path
var content = await contentItem.GetObject3D(null);
return MeshFileIo.Save(content, filePathToSave, CancellationToken.None);
return Object3D.Save(content, filePathToSave, CancellationToken.None);
}
else if (source is ILibraryAssetStream streamContent)
{
if (!string.IsNullOrEmpty(filePathToSave))
{
// If the file is already AMF, it just needs copied to the target path
// If the file is already the target type, it just needs copied to the target path
if (Path.GetExtension(streamContent.FileName).ToUpper() == Path.GetExtension(filePathToSave).ToUpper())
{
using (var result = await streamContent.GetStream(null))
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.Library.Export
using (var result = await streamContent.GetStream(null))
{
IObject3D item = Object3D.Load(result.Stream, Path.GetExtension(streamContent.FileName), CancellationToken.None);
return MeshFileIo.Save(item, filePathToSave, CancellationToken.None);
return Object3D.Save(item, filePathToSave, CancellationToken.None);
}
}
}

View file

@ -38,6 +38,7 @@ using MatterHackers.DataConverters3D;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MeshVisualizer;
using MatterHackers.PolygonMesh;
using MatterHackers.PolygonMesh.Processors;
using MatterHackers.RayTracer;
using MatterHackers.RenderOpenGl;
using MatterHackers.VectorMath;
@ -134,10 +135,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
DrawOnTop = true;
string arrowFile = Path.Combine("Icons", "3D Icons", "up_pointer.stl");
using (Stream arrowStream = AggContext.StaticData.OpenStream(arrowFile))
using (Stream arrowStream = AggContext.StaticData.OpenStream(Path.Combine("Icons", "3D Icons", "up_pointer.stl")))
{
upArrowMesh = MeshFileIo.Load(arrowStream, Path.GetExtension(arrowFile), CancellationToken.None).Mesh;
upArrowMesh = StlProcessing.Load(arrowStream, CancellationToken.None);
}
CollisionVolume = upArrowMesh.CreateTraceData();

View file

@ -37,12 +37,10 @@ using MatterHackers.Agg;
using MatterHackers.Agg.Font;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
using MatterHackers.DataConverters3D;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.Library;
using MatterHackers.PolygonMesh;
using MatterHackers.VectorMath;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
@ -98,7 +96,7 @@ namespace MatterHackers.MatterControl
public double PixelPerMM => inchesPerMm * SheetDpi;
public BorderDouble PageMarginMM { get; } = new BorderDouble(10, 5);
public BorderDouble PageMarginPixels => PageMarginMM * PixelPerMM;
public double PartMarginMM { get; } = 2;
@ -106,7 +104,7 @@ namespace MatterHackers.MatterControl
public double PartMarginPixels => PartMarginMM * PixelPerMM;
public double PartPaddingMM { get; } = 2;
public double PartPaddingPixels => PartPaddingMM * PixelPerMM;
public int SheetDpi { get; set; }
@ -281,14 +279,10 @@ namespace MatterHackers.MatterControl
printer.Origin = new Vector2(plateGraphics.DestImage.Width / 2, 60);
plateGraphics.Render(printer, Color.Black);
string applicationUserDataPath = ApplicationDataStorage.ApplicationUserDataPath;
string folderToSavePrintsTo = Path.Combine(applicationUserDataPath, "data", "temp", "plateImages");
string folderToSavePrintsTo = Path.Combine(ApplicationDataStorage.Instance.ApplicationTempDataPath, "plateImages");
string jpegFileName = Path.Combine(folderToSavePrintsTo, plateNumber.ToString() + ".jpeg");
if (!Directory.Exists(folderToSavePrintsTo))
{
Directory.CreateDirectory(folderToSavePrintsTo);
}
Directory.CreateDirectory(folderToSavePrintsTo);
AggContext.ImageIO.SaveImageData(jpegFileName, plateInventoryImage);

View file

@ -39,6 +39,7 @@ using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.PolygonMesh.Processors;
namespace MatterHackers.MatterControl.PrintQueue
{
@ -205,7 +206,7 @@ namespace MatterHackers.MatterControl.PrintQueue
for (int i = 0; i < ItemCount; i++)
{
var printItem = GetPrintItemWrapper(i).PrintItem;
if (includeProtectedItems
if (includeProtectedItems
|| !printItem.Protected)
{
listToReturn.Add(printItem);
@ -231,7 +232,7 @@ namespace MatterHackers.MatterControl.PrintQueue
if (File.Exists(item.FileLocation)
&& checkSize == ValidateSizeOn32BitSystems.Required)
{
estimatedMemoryUse = MeshFileIo.GetEstimatedMemoryUse(item.FileLocation);
estimatedMemoryUse = GetEstimatedMemoryUse(item.FileLocation);
// If we have less than 2 gigs memory, warn on smaller file size
if (AggContext.PhysicalMemory < 2000000000)
@ -257,7 +258,8 @@ namespace MatterHackers.MatterControl.PrintQueue
UiThread.RunOnIdle(() =>
{
string memoryWarningMessage = "Are you sure you want to add this part ({0}) to the Queue?\nThe 3D part you are trying to load may be too complicated and cause performance or stability problems.\n\nConsider reducing the geometry before proceeding.".Localize().FormatWith(item.Name);
StyledMessageBox.ShowMessageBox(UserSaidToAllowAddToQueue, memoryWarningMessage, "File May Cause Problems".Localize(), StyledMessageBox.MessageType.YES_NO, "Add To Queue", "Do Not Add");
StyledMessageBox.ShowMessageBox(
UserSaidToAllowAddToQueue, memoryWarningMessage, "File May Cause Problems".Localize(), StyledMessageBox.MessageType.YES_NO, "Add To Queue", "Do Not Add");
// show a dialog to tell the user there is an update
});
return;
@ -273,6 +275,23 @@ namespace MatterHackers.MatterControl.PrintQueue
}
}
public static long GetEstimatedMemoryUse(string fileLocation)
{
switch (Path.GetExtension(fileLocation).ToUpper())
{
case ".STL":
return StlProcessing.GetEstimatedMemoryUse(fileLocation);
case ".AMF":
return AmfDocument.GetEstimatedMemoryUse(fileLocation);
case ".OBJ":
throw new NotImplementedException();
}
return 0;
}
private void UserSaidToAllowAddToQueue(bool messageBoxResponse)
{
if (messageBoxResponse)
@ -285,7 +304,7 @@ namespace MatterHackers.MatterControl.PrintQueue
{
if (insertAt == -1)
{
insertAt = PrintItems.Count;
insertAt = PrintItems.Count;
}
PrintItems.Insert(insertAt, item);

View file

@ -43,6 +43,7 @@ using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.SettingsManagement;
using MatterHackers.MeshVisualizer;
using MatterHackers.PolygonMesh;
using MatterHackers.PolygonMesh.Processors;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.SlicerConfiguration
@ -135,7 +136,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
item.WorldOutputType() == PrintOutputTypes.Support);
// if we added user generated support
// if we added user generated support
if (supportObjects.Any())
{
// add a flag to the merge rules to let us know there was support
@ -165,6 +166,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
mergeString += ",";
}
// TODO: Use existing AssetsPath property
string assetsDirectory = Path.Combine(ApplicationDataStorage.Instance.ApplicationLibraryDataPath, "Assets");
outputItems.Add((item.WorldMatrix(), Path.Combine(assetsDirectory, item.MeshPath)));
mergeString += $"({savedStlCount++}";
@ -175,7 +178,18 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
else
{
var tinyObjectFileName = SaveAndGetFilePathForMesh(PlatonicSolids.CreateCube(.001, .001, .001), CancellationToken.None);
// TODO: consider dropping the custom path and using the AssetPath as above
string folderToSaveStlsTo = Path.Combine(ApplicationDataStorage.Instance.ApplicationTempDataPath, "amf_to_stl");
// Create directory if needed
Directory.CreateDirectory(folderToSaveStlsTo);
Mesh tinyMesh = PlatonicSolids.CreateCube(.001, .001, .001);
string tinyObjectFileName = Path.Combine(folderToSaveStlsTo, Path.ChangeExtension(tinyMesh.GetLongHashCode().ToString(), ".stl"));
StlProcessing.Save(tinyMesh, tinyObjectFileName, CancellationToken.None);
outputItems.Add((Matrix4X4.Identity, tinyObjectFileName));
mergeString += $"({savedStlCount++})";
}
@ -183,20 +197,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return mergeString;
}
private static string SaveAndGetFilePathForMesh(Mesh meshToSave, CancellationToken cancellationToken)
{
string folderToSaveStlsTo = Path.Combine(ApplicationDataStorage.ApplicationUserDataPath, "data", "temp", "amf_to_stl");
// Create directory if needed
Directory.CreateDirectory(folderToSaveStlsTo);
string filePath = Path.Combine(folderToSaveStlsTo, Path.ChangeExtension(meshToSave.GetLongHashCode().ToString(), ".stl"));
MeshFileIo.Save(meshToSave, filePath, cancellationToken);
return filePath;
}
public static Task<bool> SliceFile(string sourceFile, string gcodeFilePath, PrinterConfig printer, IProgress<ProgressStatus> progressReporter, CancellationToken cancellationToken)
{
var progressStatus = new ProgressStatus()

@ -1 +1 @@
Subproject commit 9ea14f16af839df28644ad4d04f847c064764bf5
Subproject commit 787fb82d2cb4176e33f67078a030c4ec86aaffb3

View file

@ -387,7 +387,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
scrollable.Width = width;
// Tuning values should default to 1 when missing
ConfirmExpectedSpeeds(testRunner, 1, 1);
ConfirmExpectedSpeeds(testRunner, 1, 1, "Initial case");
testRunner.Delay();
testRunner.ClickByName("Extrusion Multiplier NumberEdit");
@ -399,19 +399,19 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Force focus away from the feed rate field, causing an persisted update
testRunner.ClickByName("Extrusion Multiplier NumberEdit");
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate, "After setting TextEdit values");
// Wait for slicing to complete before setting target values
testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.DetailedPrintingState == DetailedPrintingState.Printing, 8);
testRunner.Delay();
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate, "While printing");
// Wait up to 60 seconds for the print to finish
printFinishedResetEvent.WaitOne(60 * 1000);
// Values should match entered values
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate, "After print finished");
testRunner.WaitForPrintFinished();
@ -420,13 +420,13 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(2);
// Values should match entered values
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate, "After print restarted");
testRunner.CancelPrint();
testRunner.Delay(1);
// Values should match entered values
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate, "After canceled print");
}
return Task.CompletedTask;
@ -481,7 +481,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
scrollable.Width = width;
// Tuning values should match
ConfirmExpectedSpeeds(testRunner, initialExtrusionRate, initialFeedRate);
ConfirmExpectedSpeeds(testRunner, initialExtrusionRate, initialFeedRate, "Initial case");
testRunner.Delay();
testRunner.ClickByName("Extrusion Multiplier NumberEdit");
@ -491,16 +491,16 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Type(targetFeedRate.ToString());
// Force focus away from the feed rate field, causing an persisted update
testRunner.SwitchToControlsTab();
testRunner.ClickByName("Extrusion Multiplier NumberEdit");
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate, "After setting TextEdit values");
// Wait for slicing to complete before setting target values
testRunner.WaitFor(() => printer.Connection.DetailedPrintingState == DetailedPrintingState.Printing, 8);
testRunner.Delay();
// Values should remain after print completes
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate, "While printing");
// Wait for printing to complete
printFinishedResetEvent.WaitOne();
@ -512,13 +512,13 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.WaitFor(() => printer.Connection.CommunicationState == CommunicationStates.Printing, 15);
// Values should match entered values
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate, "While reprinting");
testRunner.CancelPrint();
testRunner.WaitFor(() => printer.Connection.CommunicationState == CommunicationStates.Connected, 15);
// Values should match entered values
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate, "After cancel");
}
return Task.CompletedTask;
@ -635,23 +635,27 @@ namespace MatterHackers.MatterControl.Tests.Automation
}, overrideHeight: 900, maxTimeToRun: 90);
}
private static void ConfirmExpectedSpeeds(AutomationRunner testRunner, double targetExtrusionRate, double targetFeedRate)
private static void ConfirmExpectedSpeeds(AutomationRunner testRunner, double targetExtrusionRate, double targetFeedRate, string scope)
{
SystemWindow systemWindow;
SolidSlider slider;
// Assert the UI has the expected values
slider = testRunner.GetWidgetByName("Extrusion Multiplier Slider", out systemWindow, 5) as SolidSlider;
Assert.IsTrue(targetExtrusionRate == slider.Value);
testRunner.WaitFor(() => targetExtrusionRate == slider.Value);
Assert.AreEqual(targetExtrusionRate, slider.Value, $"Unexpected Extrusion Rate Slider Value - {scope}");
slider = testRunner.GetWidgetByName("Feed Rate Slider", out systemWindow, 5) as SolidSlider;
Assert.IsTrue(targetFeedRate == slider.Value);
testRunner.Delay(.2);
testRunner.WaitFor(() => targetFeedRate == slider.Value);
Assert.AreEqual(targetFeedRate, slider.Value, $"Unexpected Feed Rate Slider Value - {scope}");
// Assert the changes took effect on the model
Assert.IsTrue(targetExtrusionRate == ExtrusionMultiplyerStream.ExtrusionRatio);
Assert.IsTrue(targetFeedRate == FeedRateMultiplyerStream.FeedRateRatio);
testRunner.WaitFor(() => targetExtrusionRate == ExtrusionMultiplyerStream.ExtrusionRatio);
Assert.AreEqual(targetExtrusionRate, ExtrusionMultiplyerStream.ExtrusionRatio, $"Unexpected Extrusion Rate - {scope}");
testRunner.WaitFor(() => targetFeedRate == FeedRateMultiplyerStream.FeedRateRatio);
Assert.AreEqual(targetFeedRate, FeedRateMultiplyerStream.FeedRateRatio, $"Unexpected Feed Rate - {scope}");
}
}
}

View file

@ -75,6 +75,7 @@
<Compile Include="MatterControl\GCodeStreamTests.cs" />
<Compile Include="MatterControl\TranslationsTests.cs" />
<Compile Include="MatterControl\UIFieldTestWindow.cs" />
<Compile Include="MatterControl\PathTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SceneTests.cs" />
</ItemGroup>

View file

@ -0,0 +1,90 @@
/*
Copyright (c) 2018, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
using MatterHackers.MatterControl;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.Tests.Automation;
using NUnit.Framework;
namespace MatterControl.Tests.MatterControl
{
[TestFixture, RunInApplicationDomain, Apartment(ApartmentState.STA)]
public class PathTests
{
[Test]
public Task CacheablePathTest()
{
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
string path = ApplicationController.CacheablePath("scope", "key.file");
Assert.AreEqual(
path.Substring(path.IndexOf("MatterControl")),
Path.Combine("MatterControl", "data", "temp", "cache", "scope", "key.file"),
"Unexpected CacheablePath Value");
return Task.CompletedTask;
}
[Test]
public Task CacheDirectoryTest()
{
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
string path = ApplicationDataStorage.Instance.CacheDirectory;
Assert.AreEqual(
path.Substring(path.IndexOf("MatterControl")),
Path.Combine("MatterControl", "data", "temp", "cache"),
"Unexpected CacheDirectory Value");
return Task.CompletedTask;
}
[Test]
public Task TempPathTest()
{
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
string path = ApplicationDataStorage.Instance.ApplicationTempDataPath;
Assert.AreEqual(
path.Substring(path.IndexOf("MatterControl")),
Path.Combine("MatterControl", "data", "temp"),
"Unexpected ApplicationTempDataPath Value");
return Task.CompletedTask;
}
}
}

View file

@ -120,10 +120,9 @@ namespace MatterHackers.MatterControl
});
}
private static string applicationDataPath = ApplicationDataStorage.ApplicationUserDataPath;
private static string archiveStagingFolder = Path.Combine(applicationDataPath, "data", "temp", "project-assembly");
private static string archiveStagingFolder = Path.Combine(ApplicationDataStorage.Instance.ApplicationTempDataPath, "project-assembly");
private static string defaultManifestPathAndFileName = Path.Combine(archiveStagingFolder, "manifest.json");
private static string defaultProjectPathAndFileName = Path.Combine(applicationDataPath, "data", "default.zip");
private static string defaultProjectPathAndFileName = Path.Combine(ApplicationDataStorage.ApplicationUserDataPath, "data", "default.zip");
public static void EmptyFolder(System.IO.DirectoryInfo directory)
{
@ -224,7 +223,7 @@ namespace MatterHackers.MatterControl
int projectHashCode = zip.GetHashCode();
//If the temp folder doesn't exist - create it, otherwise clear it
string stagingFolder = Path.Combine(applicationDataPath, "data", "temp", "project-extract", projectHashCode.ToString());
string stagingFolder = Path.Combine(ApplicationDataStorage.Instance.ApplicationTempDataPath, "project-extract", projectHashCode.ToString());
if (!Directory.Exists(stagingFolder))
{
Directory.CreateDirectory(stagingFolder);