diff options
Diffstat (limited to 'UVtools.Core/GCode/GCodeBuilder.cs')
-rw-r--r-- | UVtools.Core/GCode/GCodeBuilder.cs | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/UVtools.Core/GCode/GCodeBuilder.cs b/UVtools.Core/GCode/GCodeBuilder.cs index 282c624..e53faa2 100644 --- a/UVtools.Core/GCode/GCodeBuilder.cs +++ b/UVtools.Core/GCode/GCodeBuilder.cs @@ -15,7 +15,6 @@ using System.Linq; using System.Reflection; using System.Text; using System.Text.RegularExpressions; -using Org.BouncyCastle.Asn1.Cms; using UVtools.Core.Extensions; using UVtools.Core.FileFormats; using UVtools.Core.Objects; @@ -89,10 +88,10 @@ namespace UVtools.Core.GCode public enum GCodeShowImageTypes : byte { - FilenameZeroPNG, - FilenameNonZeroPNG, - LayerIndexZero, - LayerIndexNonZero, + FilenamePng0Started, + FilenamePng1Started, + LayerIndex0Started, + LayerIndex1Started, } #endregion @@ -103,7 +102,7 @@ namespace UVtools.Core.GCode private GCodePositioningTypes _gCodePositioningType = GCodePositioningTypes.Absolute; private GCodeTimeUnits _gCodeTimeUnit = GCodeTimeUnits.Milliseconds; private GCodeSpeedUnits _gCodeSpeedUnit = GCodeSpeedUnits.MillimetersPerMinute; - private GCodeShowImageTypes _gCodeShowImageType = GCodeShowImageTypes.FilenameNonZeroPNG; + private GCodeShowImageTypes _gCodeShowImageType = GCodeShowImageTypes.FilenamePng1Started; private bool _syncMovementsWithDelay; private bool _useTailComma = true; private bool _useComments = true; @@ -308,9 +307,7 @@ namespace UVtools.Core.GCode public void AppendUVtools() { - string arch = Environment.Is64BitOperatingSystem ? "64-bits" : "32-bits"; - var version = Assembly.GetExecutingAssembly().GetName().Version; - AppendComment($"Generated by {About.Software} v{version.ToString(3)} {arch} @ {DateTime.Now}"); + AppendComment($"Generated by {About.Software} v{About.VersionStr} {About.Arch} @ {DateTime.UtcNow}"); } public void AppendStartGCode() @@ -538,19 +535,19 @@ namespace UVtools.Core.GCode public string GetShowImageString(uint layerIndex) => _gCodeShowImageType switch { - GCodeShowImageTypes.FilenameZeroPNG => $"{layerIndex}.png", - GCodeShowImageTypes.FilenameNonZeroPNG => $"{layerIndex + 1}.png", - GCodeShowImageTypes.LayerIndexZero => $"{layerIndex}", - GCodeShowImageTypes.LayerIndexNonZero => $"{layerIndex + 1}", + GCodeShowImageTypes.FilenamePng0Started => $"{layerIndex}.png", + GCodeShowImageTypes.FilenamePng1Started => $"{layerIndex + 1}.png", + GCodeShowImageTypes.LayerIndex0Started => $"{layerIndex}", + GCodeShowImageTypes.LayerIndex1Started => $"{layerIndex + 1}", _ => throw new InvalidExpressionException($"Unhandled image type for {_gCodeShowImageType}") }; public string GetShowImageString(string value) => _gCodeShowImageType switch { - GCodeShowImageTypes.FilenameZeroPNG => $"{value}.png", - GCodeShowImageTypes.FilenameNonZeroPNG => $"{value}.png", - GCodeShowImageTypes.LayerIndexZero => $"{value}", - GCodeShowImageTypes.LayerIndexNonZero => $"{value}", + GCodeShowImageTypes.FilenamePng0Started => $"{value}.png", + GCodeShowImageTypes.FilenamePng1Started => $"{value}.png", + GCodeShowImageTypes.LayerIndex0Started => $"{value}", + GCodeShowImageTypes.LayerIndex1Started => $"{value}", _ => throw new InvalidExpressionException($"Unhandled image type for {_gCodeShowImageType}") }; @@ -752,8 +749,8 @@ namespace UVtools.Core.GCode if (match.Success && match.Groups.Count >= 2) // Begin new layer { var layerIndex = uint.Parse(match.Groups[1].Value); - if (_gCodeShowImageType is GCodeShowImageTypes.FilenameNonZeroPNG or GCodeShowImageTypes - .LayerIndexNonZero) layerIndex--; + if (_gCodeShowImageType is GCodeShowImageTypes.FilenamePng1Started or GCodeShowImageTypes + .LayerIndex1Started) layerIndex--; if (layerIndex > slicerFile.LayerCount) { throw new FileLoadException( |