Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'UVtools.Core/FileFormats/FileFormat.cs')
-rw-r--r--UVtools.Core/FileFormats/FileFormat.cs20
1 files changed, 3 insertions, 17 deletions
diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs
index c36790d..d5cdbbf 100644
--- a/UVtools.Core/FileFormats/FileFormat.cs
+++ b/UVtools.Core/FileFormats/FileFormat.cs
@@ -15,7 +15,6 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
-using System.Text;
using System.Threading.Tasks;
using Emgu.CV;
using Emgu.CV.CvEnum;
@@ -1300,6 +1299,8 @@ namespace UVtools.Core.FileFormats
progress ??= new OperationProgress();
progress.Reset(OperationProgress.StatusEncodeLayers, LayerCount);
+ _layerManager.Sanitize();
+
FileFullPath = fileFullPath;
if (File.Exists(fileFullPath))
@@ -1351,23 +1352,8 @@ namespace UVtools.Core.FileFormats
"Lower and fix your layer height on slicer to avoid precision errors.", fileFullPath);
}
- // Sanitize
- for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
- {
- // Check for null layers
- if(this[layerIndex] is null) throw new FileLoadException($"Layer {layerIndex} was defined but doesn't contain a valid image.", fileFullPath);
- if(layerIndex <= 0) continue;
- // Check for bigger position z than it successor
- if(this[layerIndex-1].PositionZ > this[layerIndex].PositionZ) throw new FileLoadException($"Layer {layerIndex-1} ({this[layerIndex - 1].PositionZ}mm) have a higher Z position than the successor layer {layerIndex} ({this[layerIndex].PositionZ}mm).\n", fileFullPath);
- }
-
- // Fix 0mm positions at layer 0
- if(this[0].PositionZ == 0)
+ if (_layerManager.Sanitize())
{
- for (uint layerIndex = 0; layerIndex < LayerCount; layerIndex++)
- {
- this[layerIndex].PositionZ += LayerHeight;
- }
Save(progress);
}
}