From c43badb9c15b22a27b1cae5e386f158c6c2f3b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Concei=C3=A7=C3=A3o?= Date: Wed, 19 May 2021 21:42:07 +0100 Subject: v2.12.1 - (Upgrade) AvaloniaUI from 0.10.4 to 0.10.5 - (Improvement) VDT: Implement a new key for better auto convert files between with latest version of Tango - (Change) Exposure time finder: Bar fence offset from 2px to 4px --- CHANGELOG.md | 6 ++++++ UVtools.Core/Extensions/EmguExtensions.cs | 4 ++-- UVtools.Core/Extensions/PointExtensions.cs | 2 +- UVtools.Core/FileFormats/CWSFile.cs | 4 ++-- UVtools.Core/FileFormats/ChituboxFile.cs | 14 +++++++------- UVtools.Core/FileFormats/FDGFile.cs | 14 +++++++------- UVtools.Core/FileFormats/LGSFile.cs | 4 ++-- UVtools.Core/FileFormats/PHZFile.cs | 14 +++++++------- UVtools.Core/FileFormats/PhotonWorkshopFile.cs | 8 ++++---- UVtools.Core/FileFormats/SL1File.cs | 4 ++-- UVtools.Core/FileFormats/UVJFile.cs | 4 ++-- UVtools.Core/FileFormats/VDTFile.cs | 1 + UVtools.Core/FileFormats/ZCodeFile.cs | 8 ++++---- UVtools.Core/Helpers.cs | 2 +- UVtools.Core/Operations/OperationBlur.cs | 2 +- .../Operations/OperationCalibrateExposureFinder.cs | 2 +- .../Operations/OperationCalibrateGrayscale.cs | 4 ++-- .../Operations/OperationCalibrateStressTower.cs | 4 ++-- .../Operations/OperationCalibrateXYZAccuracy.cs | 4 ++-- UVtools.Core/Operations/OperationFlip.cs | 2 +- UVtools.Core/Operations/OperationRaftRelief.cs | 2 +- UVtools.Core/Operations/OperationRepairLayers.cs | 2 +- UVtools.Core/UVtools.Core.csproj | 2 +- UVtools.InstallerMM/UVtools.InstallerMM.wxs | 4 ++-- .../CalibrateXYZAccuracyControl.axaml.cs | 2 +- UVtools.WPF/Controls/StaticControls.cs | 6 +++--- UVtools.WPF/MainWindow.LayerPreview.cs | 21 +++++++++++---------- UVtools.WPF/MainWindow.axaml.cs | 5 ++--- UVtools.WPF/Structures/Color.cs | 2 +- UVtools.WPF/Structures/PEProfileFolder.cs | 6 +++--- UVtools.WPF/Structures/PixelPicker.cs | 2 +- UVtools.WPF/UVtools.WPF.csproj | 10 +++++----- UVtools.WPF/Windows/BenchmarkWindow.axaml.cs | 10 +++++----- UVtools.WPF/Windows/SettingsWindow.axaml.cs | 2 +- build/CreateRelease.WPF.ps1 | 12 ++++++------ 35 files changed, 101 insertions(+), 94 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cb3b8a..923fad4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 19/05/2021 - v2.12.1 + +- (Upgrade) AvaloniaUI from 0.10.4 to 0.10.5 +- (Improvement) VDT: Implement a new key for better auto convert files between with latest version of Tango +- (Change) Exposure time finder: Bar fence offset from 2px to 4px + ## 17/05/2021 - v2.12.0 - **Layer arithmetic:** diff --git a/UVtools.Core/Extensions/EmguExtensions.cs b/UVtools.Core/Extensions/EmguExtensions.cs index 2631597..3a55047 100644 --- a/UVtools.Core/Extensions/EmguExtensions.cs +++ b/UVtools.Core/Extensions/EmguExtensions.cs @@ -145,14 +145,14 @@ namespace UVtools.Core.Extensions { var dx = Math.Abs(dst.Step - src.Step) / 2; var dy = Math.Abs(dst.Height - src.Height) / 2; - Mat m = new Mat(dst, new Rectangle(dx, dy, src.Width, src.Height)); + Mat m = new(dst, new Rectangle(dx, dy, src.Width, src.Height)); src.CopyTo(m); } else if (dst.Step < src.Step && dst.Height < src.Height) { var dx = Math.Abs(dst.Step - src.Step) / 2; var dy = Math.Abs(dst.Height - src.Height) / 2; - Mat m = new Mat(src, new Rectangle(dx, dy, dst.Width, dst.Height)); + Mat m = new(src, new Rectangle(dx, dy, dst.Width, dst.Height)); m.CopyTo(dst); } } diff --git a/UVtools.Core/Extensions/PointExtensions.cs b/UVtools.Core/Extensions/PointExtensions.cs index a696489..4ba31d8 100644 --- a/UVtools.Core/Extensions/PointExtensions.cs +++ b/UVtools.Core/Extensions/PointExtensions.cs @@ -25,7 +25,7 @@ namespace UVtools.Core.Extensions double x = cos * dx - sin * dy + pivot.X; double y = sin * dx + cos * dy + pivot.Y; - Point rotated = new Point((int)Math.Round(x), (int)Math.Round(y)); + Point rotated = new((int)Math.Round(x), (int)Math.Round(y)); return rotated; } diff --git a/UVtools.Core/FileFormats/CWSFile.cs b/UVtools.Core/FileFormats/CWSFile.cs index f541172..41cfe5f 100644 --- a/UVtools.Core/FileFormats/CWSFile.cs +++ b/UVtools.Core/FileFormats/CWSFile.cs @@ -569,8 +569,8 @@ namespace UVtools.Core.FileFormats manifest.Slices[layerIndex] = new CWSManifest.Slice(this[layerIndex].FormatFileName(filename)); } - XmlSerializer serializer = new XmlSerializer(manifest.GetType()); - XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); + XmlSerializer serializer = new(manifest.GetType()); + XmlSerializerNamespaces ns = new(); ns.Add("", ""); var entry = outputFile.CreateEntry(CWSManifest.FileName); using (var stream = entry.Open()) diff --git a/UVtools.Core/FileFormats/ChituboxFile.cs b/UVtools.Core/FileFormats/ChituboxFile.cs index ab86e58..470bbb9 100644 --- a/UVtools.Core/FileFormats/ChituboxFile.cs +++ b/UVtools.Core/FileFormats/ChituboxFile.cs @@ -413,7 +413,7 @@ namespace UVtools.Core.FileFormats public unsafe byte[] Encode(Mat image) { - List rawData = new List(); + List rawData = new(); ushort color15 = 0; uint rep = 0; @@ -617,7 +617,7 @@ namespace UVtools.Core.FileFormats if (Parent.HeaderSettings.EncryptionKey > 0) { - KeyRing kr = new KeyRing(Parent.HeaderSettings.EncryptionKey, layerIndex); + KeyRing kr = new(Parent.HeaderSettings.EncryptionKey, layerIndex); EncodedRle = kr.Read(EncodedRle); } @@ -691,7 +691,7 @@ namespace UVtools.Core.FileFormats public unsafe byte[] EncodeCbddlpImage(Mat image, byte bit) { - List rawData = new List(); + List rawData = new(); var span = image.GetBytePointer(); var imageLength = image.GetLength(); @@ -754,7 +754,7 @@ namespace UVtools.Core.FileFormats private unsafe byte[] EncodeCbtImage(Mat image, uint layerIndex) { - List rawData = new List(); + List rawData = new(); byte color = byte.MaxValue >> 1; uint stride = 0; var span = image.GetBytePointer(); @@ -831,7 +831,7 @@ namespace UVtools.Core.FileFormats if (Parent.HeaderSettings.EncryptionKey > 0) { - KeyRing kr = new KeyRing(Parent.HeaderSettings.EncryptionKey, layerIndex); + KeyRing kr = new(Parent.HeaderSettings.EncryptionKey, layerIndex); EncodedRle = kr.Read(rawData.ToArray()); } else @@ -935,7 +935,7 @@ namespace UVtools.Core.FileFormats public List Read(List input) { - List data = new List(input.Count); + List data = new(input.Count); data.AddRange(input.Select(t => (byte) (t ^ Next()))); return data; @@ -1380,7 +1380,7 @@ namespace UVtools.Core.FileFormats Parallel.For(0, LayerCount, /*new ParallelOptions{MaxDegreeOfParallelism = 1},*/ layerIndex => { if (progress.Token.IsCancellationRequested) return; - LayerData layerData = new LayerData(this, (uint) layerIndex); + LayerData layerData = new(this, (uint) layerIndex); using (var image = this[layerIndex].LayerMat) { layerData.Encode(image, aaIndex, (uint) layerIndex); diff --git a/UVtools.Core/FileFormats/FDGFile.cs b/UVtools.Core/FileFormats/FDGFile.cs index 71fc401..57b5ff6 100644 --- a/UVtools.Core/FileFormats/FDGFile.cs +++ b/UVtools.Core/FileFormats/FDGFile.cs @@ -333,7 +333,7 @@ namespace UVtools.Core.FileFormats public static unsafe byte[] Encode(Mat image) { - List rawData = new List(); + List rawData = new(); var span = image.GetBytePointer(); var imageLength = image.GetLength(); @@ -464,7 +464,7 @@ namespace UVtools.Core.FileFormats if (Parent.HeaderSettings.EncryptionKey > 0) { - KeyRing kr = new KeyRing(Parent.HeaderSettings.EncryptionKey, layerIndex); + KeyRing kr = new(Parent.HeaderSettings.EncryptionKey, layerIndex); EncodedRle = kr.Read(EncodedRle); } @@ -524,7 +524,7 @@ namespace UVtools.Core.FileFormats public void Encode(Mat image, uint layerIndex) { - List rawData = new List(); + List rawData = new(); //byte color = byte.MaxValue >> 1; byte color = byte.MaxValue; @@ -589,7 +589,7 @@ namespace UVtools.Core.FileFormats if (Parent.HeaderSettings.EncryptionKey > 0) { - KeyRing kr = new KeyRing(Parent.HeaderSettings.EncryptionKey, layerIndex); + KeyRing kr = new(Parent.HeaderSettings.EncryptionKey, layerIndex); EncodedRle = kr.Read(rawData).ToArray(); } else @@ -637,7 +637,7 @@ namespace UVtools.Core.FileFormats public List Read(List input) { - List data = new List(input.Count); + List data = new(input.Count); data.AddRange(input.Select(t => (byte)(t ^ Next()))); return data; @@ -963,7 +963,7 @@ namespace UVtools.Core.FileFormats HeaderSettings.PreviewLargeOffsetAddress = currentOffset; } - Preview preview = new Preview + Preview preview = new() { ResolutionX = (uint) image.Width, ResolutionY = (uint) image.Height, @@ -990,7 +990,7 @@ namespace UVtools.Core.FileFormats Parallel.For(0, LayerCount, /*new ParallelOptions{MaxDegreeOfParallelism = 1},*/ layerIndex => { if(progress.Token.IsCancellationRequested) return; - LayerData layer = new LayerData(this, (uint) layerIndex); + LayerData layer = new(this, (uint) layerIndex); using (var image = this[layerIndex].LayerMat) { layer.Encode(image, (uint) layerIndex); diff --git a/UVtools.Core/FileFormats/LGSFile.cs b/UVtools.Core/FileFormats/LGSFile.cs index 9a3a0a6..97f7cbc 100644 --- a/UVtools.Core/FileFormats/LGSFile.cs +++ b/UVtools.Core/FileFormats/LGSFile.cs @@ -99,8 +99,8 @@ namespace UVtools.Core.FileFormats public unsafe byte[] Encode(Mat mat) { - List rawData = new List(); - List chunk = new List(); + List rawData = new(); + List chunk = new(); var spanMat = mat.GetBytePointer(); var imageLength = mat.GetLength(); diff --git a/UVtools.Core/FileFormats/PHZFile.cs b/UVtools.Core/FileFormats/PHZFile.cs index 3131b43..6ede707 100644 --- a/UVtools.Core/FileFormats/PHZFile.cs +++ b/UVtools.Core/FileFormats/PHZFile.cs @@ -350,7 +350,7 @@ namespace UVtools.Core.FileFormats public static unsafe byte[] Encode(Mat image) { - List rawData = new List(); + List rawData = new(); var span = image.GetBytePointer(); var imageLength = image.GetLength(); @@ -481,7 +481,7 @@ namespace UVtools.Core.FileFormats if (Parent.HeaderSettings.EncryptionKey > 0) { - KeyRing kr = new KeyRing(Parent.HeaderSettings.EncryptionKey, layerIndex); + KeyRing kr = new(Parent.HeaderSettings.EncryptionKey, layerIndex); EncodedRle = kr.Read(EncodedRle); } @@ -541,7 +541,7 @@ namespace UVtools.Core.FileFormats public void Encode(Mat image, uint layerIndex) { - List rawData = new List(); + List rawData = new(); //byte color = byte.MaxValue >> 1; byte color = byte.MaxValue; @@ -606,7 +606,7 @@ namespace UVtools.Core.FileFormats if (Parent.HeaderSettings.EncryptionKey > 0) { - KeyRing kr = new KeyRing(Parent.HeaderSettings.EncryptionKey, layerIndex); + KeyRing kr = new(Parent.HeaderSettings.EncryptionKey, layerIndex); EncodedRle = kr.Read(rawData).ToArray(); } else @@ -655,7 +655,7 @@ namespace UVtools.Core.FileFormats public List Read(List input) { - List data = new List(input.Count); + List data = new(input.Count); data.AddRange(input.Select(t => (byte)(t ^ Next()))); return data; @@ -988,7 +988,7 @@ namespace UVtools.Core.FileFormats - Preview preview = new Preview + Preview preview = new() { ResolutionX = (uint) image.Width, ResolutionY = (uint) image.Height, @@ -1015,7 +1015,7 @@ namespace UVtools.Core.FileFormats Parallel.For(0, LayerCount, /*new ParallelOptions{MaxDegreeOfParallelism = 1},*/ layerIndex => { if(progress.Token.IsCancellationRequested) return; - LayerData layer = new LayerData(this, (uint) layerIndex); + LayerData layer = new(this, (uint) layerIndex); using (var image = this[layerIndex].LayerMat) { layer.Encode(image, (uint) layerIndex); diff --git a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs index abff762..f4a7220 100644 --- a/UVtools.Core/FileFormats/PhotonWorkshopFile.cs +++ b/UVtools.Core/FileFormats/PhotonWorkshopFile.cs @@ -450,7 +450,7 @@ namespace UVtools.Core.FileFormats var span = image.GetBytePointer(); var imageLength = image.GetLength(); - Preview preview = new Preview((uint) image.Width, (uint) image.Height); + Preview preview = new((uint) image.Width, (uint) image.Height); int i = 0; for (int pixel = 0; pixel < imageLength; pixel += image.NumberOfChannels) @@ -612,7 +612,7 @@ namespace UVtools.Core.FileFormats public unsafe byte[] EncodePWS(Mat image) { - List rawData = new List(); + List rawData = new(); var span = image.GetBytePointer(); var imageLength = image.GetLength(); @@ -751,7 +751,7 @@ namespace UVtools.Core.FileFormats public unsafe byte[] EncodePW0(Mat image) { - List rawData = new List(); + List rawData = new(); var span = image.GetBytePointer(); var imageLength = image.GetLength(); @@ -1295,7 +1295,7 @@ namespace UVtools.Core.FileFormats Parallel.For(0, LayerCount, layerIndex => { if (progress.Token.IsCancellationRequested) return; - LayerData layer = new LayerData(this, (uint) layerIndex); + LayerData layer = new(this, (uint) layerIndex); using (var image = this[layerIndex].LayerMat) { layer.Encode(image); diff --git a/UVtools.Core/FileFormats/SL1File.cs b/UVtools.Core/FileFormats/SL1File.cs index e7ca005..97e34eb 100644 --- a/UVtools.Core/FileFormats/SL1File.cs +++ b/UVtools.Core/FileFormats/SL1File.cs @@ -589,7 +589,7 @@ namespace UVtools.Core.FileFormats { if (!entity.Name.EndsWith(".ini")) continue; iniFiles.Add(entity.Name); - using StreamReader streamReader = new StreamReader(entity.Open()); + using StreamReader streamReader = new(entity.Open()); string line; while ((line = streamReader.ReadLine()) != null) { @@ -652,7 +652,7 @@ namespace UVtools.Core.FileFormats if (entity.Name.StartsWith("thumbnail")) { using Stream stream = entity.Open(); - Mat image = new Mat(); + Mat image = new(); CvInvoke.Imdecode(stream.ToArray(), ImreadModes.AnyColor, image); byte thumbnailIndex = (byte) (image.Width == ThumbnailsOriginalSize[(int) FileThumbnailSize.Small].Width && diff --git a/UVtools.Core/FileFormats/UVJFile.cs b/UVtools.Core/FileFormats/UVJFile.cs index b38ad2f..0e9b4b7 100644 --- a/UVtools.Core/FileFormats/UVJFile.cs +++ b/UVtools.Core/FileFormats/UVJFile.cs @@ -396,7 +396,7 @@ namespace UVtools.Core.FileFormats { using (Stream stream = entry.Open()) { - Mat image = new Mat(); + Mat image = new(); CvInvoke.Imdecode(stream.ToArray(), ImreadModes.AnyColor, image); Thumbnails[0] = image; stream.Close(); @@ -407,7 +407,7 @@ namespace UVtools.Core.FileFormats if (entry is not null) { using Stream stream = entry.Open(); - Mat image = new Mat(); + Mat image = new(); CvInvoke.Imdecode(stream.ToArray(), ImreadModes.AnyColor, image); Thumbnails[1] = image; stream.Close(); diff --git a/UVtools.Core/FileFormats/VDTFile.cs b/UVtools.Core/FileFormats/VDTFile.cs index 42a9bfc..aa6e7dc 100644 --- a/UVtools.Core/FileFormats/VDTFile.cs +++ b/UVtools.Core/FileFormats/VDTFile.cs @@ -83,6 +83,7 @@ namespace UVtools.Core.FileFormats [JsonProperty("x_mirror")] public bool XMirror { get; set; } [JsonProperty("y_mirror")] public bool YMirror { get; set; } [JsonProperty("notes")] public string Notes { get; set; } + [JsonProperty("uvtools_convert_to")] public string UVToolsConvertTo { get; set; } } public sealed class VDTResin diff --git a/UVtools.Core/FileFormats/ZCodeFile.cs b/UVtools.Core/FileFormats/ZCodeFile.cs index 698e87f..7559580 100644 --- a/UVtools.Core/FileFormats/ZCodeFile.cs +++ b/UVtools.Core/FileFormats/ZCodeFile.cs @@ -460,8 +460,8 @@ namespace UVtools.Core.FileFormats progress++; } - XmlSerializer serializer = new XmlSerializer(ManifestFile.GetType()); - XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); + XmlSerializer serializer = new(ManifestFile.GetType()); + XmlSerializerNamespaces ns = new(); ns.Add("", ""); var entry = outputFile.CreateEntry(ManifestFilename); using (var stream = entry.Open()) @@ -596,8 +596,8 @@ namespace UVtools.Core.FileFormats } } while (deleted); - XmlSerializer serializer = new XmlSerializer(ManifestFile.GetType()); - XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); + XmlSerializer serializer = new(ManifestFile.GetType()); + XmlSerializerNamespaces ns = new(); ns.Add("", ""); var entry = outputFile.CreateEntry(ManifestFilename); using var stream = entry.Open(); diff --git a/UVtools.Core/Helpers.cs b/UVtools.Core/Helpers.cs index 5ba461c..b4b1dab 100644 --- a/UVtools.Core/Helpers.cs +++ b/UVtools.Core/Helpers.cs @@ -29,7 +29,7 @@ namespace UVtools.Core public static MemoryStream Serialize(object value) { - MemoryStream stream = new MemoryStream(); + MemoryStream stream = new(); Serializer.Serialize(stream, value); return stream; } diff --git a/UVtools.Core/Operations/OperationBlur.cs b/UVtools.Core/Operations/OperationBlur.cs index b472d7d..255c57f 100644 --- a/UVtools.Core/Operations/OperationBlur.cs +++ b/UVtools.Core/Operations/OperationBlur.cs @@ -146,7 +146,7 @@ namespace UVtools.Core.Operations public override bool Execute(Mat mat, params object[] arguments) { - Size size = new Size((int)Size, (int)Size); + Size size = new((int)Size, (int)Size); Point anchor = Kernel.Anchor; if (anchor.IsEmpty) anchor = new Point(-1, -1); //if (size.IsEmpty) size = new Size(3, 3); diff --git a/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs b/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs index 9fb8d6b..3f1d0f2 100644 --- a/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs +++ b/UVtools.Core/Operations/OperationCalibrateExposureFinder.cs @@ -89,7 +89,7 @@ namespace UVtools.Core.Operations private decimal _barLength = 4; private sbyte _barVerticalSplitter = 0; private byte _barFenceThickness = 10; - private sbyte _barFenceOffset = 2; + private sbyte _barFenceOffset = 4; private string _barThicknessesPx = "4, 6, 8, 60"; //"4, 6, 8, 10, 12, 14, 16, 18, 20"; private string _barThicknessesMm = "0.2, 0.3, 0.4, 3"; //"0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2"; diff --git a/UVtools.Core/Operations/OperationCalibrateGrayscale.cs b/UVtools.Core/Operations/OperationCalibrateGrayscale.cs index caadd8e..db8dce4 100644 --- a/UVtools.Core/Operations/OperationCalibrateGrayscale.cs +++ b/UVtools.Core/Operations/OperationCalibrateGrayscale.cs @@ -358,7 +358,7 @@ namespace UVtools.Core.Operations layers[0] = EmguExtensions.InitMat(SlicerFile.Resolution); int radius = Math.Max(100, Math.Min(SlicerFile.Resolution.Width, SlicerFile.Resolution.Height) - _outerMargin * 2) / 2 ; - Point center = new Point(SlicerFile.Resolution.Width / 2, SlicerFile.Resolution.Height / 2); + Point center = new(SlicerFile.Resolution.Width / 2, SlicerFile.Resolution.Height / 2); int innerRadius = Math.Max(100, radius - _innerMargin); double topLineLength = 0; @@ -400,7 +400,7 @@ namespace UVtools.Core.Operations FontFace fontFace = FontFace.HersheyDuplex; double fontScale = 2; int fontThickness = 5; - Point fontPoint = new Point((int) (center.X + radius / 2.5f + _textXOffset), (int)(center.Y + AngleStep / 1.5)); + Point fontPoint = new((int) (center.X + radius / 2.5f + _textXOffset), (int)(center.Y + AngleStep / 1.5)); var halfAngleStep = AngleStep / 2; var rotatedAngle = halfAngleStep; diff --git a/UVtools.Core/Operations/OperationCalibrateStressTower.cs b/UVtools.Core/Operations/OperationCalibrateStressTower.cs index 1a2784c..314b753 100644 --- a/UVtools.Core/Operations/OperationCalibrateStressTower.cs +++ b/UVtools.Core/Operations/OperationCalibrateStressTower.cs @@ -315,7 +315,7 @@ namespace UVtools.Core.Operations var layers = new Mat[LayerCount]; Slicer slicer = new(SlicerFile.Resolution, new SizeF((float) DisplayWidth, (float) DisplayHeight)); - Point center = new Point(SlicerFile.Resolution.Width / 2, SlicerFile.Resolution.Height / 2); + Point center = new(SlicerFile.Resolution.Width / 2, SlicerFile.Resolution.Height / 2); uint baseRadius = slicer.PixelsFromMillimeters(_baseDiameter) / 2; uint baseLayers = (ushort) Math.Floor(_baseHeight / _layerHeight); uint bodyLayers = (ushort) Math.Floor(_bodyHeight / _layerHeight); @@ -355,7 +355,7 @@ namespace UVtools.Core.Operations { spiralAngle = -spiralAngle; } - Point location = new Point((int) (center.X - baseRadius + spiralRadius), center.Y); + Point location = new((int) (center.X - baseRadius + spiralRadius), center.Y); var locationCW = location.Rotate((double) spiralAngle, center); var locationCCW = location.Rotate((double) -spiralAngle, center); diff --git a/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs b/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs index 444178d..8784f5b 100644 --- a/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs +++ b/UVtools.Core/Operations/OperationCalibrateXYZAccuracy.cs @@ -690,8 +690,8 @@ namespace UVtools.Core.Operations if (_hollowModel && i != 0 && _wallThickness > 0) { - Size rectSize = new Size((int) (XPixels - WallThicknessXPixels * 2), (int) (YPixels - WallThicknessYPixels * 2)); - Point rectLocation = new Point((int) (currentX + WallThicknessXPixels), (int) (currentY + WallThicknessYPixels)); + Size rectSize = new((int) (XPixels - WallThicknessXPixels * 2), (int) (YPixels - WallThicknessYPixels * 2)); + Point rectLocation = new((int) (currentX + WallThicknessXPixels), (int) (currentY + WallThicknessYPixels)); CvInvoke.Rectangle(layers[i], new Rectangle(rectLocation, rectSize), EmguExtensions.Black3Byte, -1); } diff --git a/UVtools.Core/Operations/OperationFlip.cs b/UVtools.Core/Operations/OperationFlip.cs index b9befcc..047117d 100644 --- a/UVtools.Core/Operations/OperationFlip.cs +++ b/UVtools.Core/Operations/OperationFlip.cs @@ -143,7 +143,7 @@ namespace UVtools.Core.Operations if (MakeCopy) { - using Mat dst = new Mat(); + using Mat dst = new(); CvInvoke.Flip(target, dst, FlipTypeOpenCV); CvInvoke.Add(target, dst, target); } diff --git a/UVtools.Core/Operations/OperationRaftRelief.cs b/UVtools.Core/Operations/OperationRaftRelief.cs index 93b8104..52401ee 100644 --- a/UVtools.Core/Operations/OperationRaftRelief.cs +++ b/UVtools.Core/Operations/OperationRaftRelief.cs @@ -250,7 +250,7 @@ namespace UVtools.Core.Operations { case RaftReliefTypes.Relief: case RaftReliefTypes.Dimming: - using (Mat mask = new Mat()) + using (Mat mask = new()) { /*CvInvoke.Subtract(target, supportsMat, mask); CvInvoke.Erode(mask, mask, kernel, anchor, operation.WallMargin, BorderType.Reflect101, new MCvScalar()); diff --git a/UVtools.Core/Operations/OperationRepairLayers.cs b/UVtools.Core/Operations/OperationRepairLayers.cs index ab0a5e5..2ba34f0 100644 --- a/UVtools.Core/Operations/OperationRepairLayers.cs +++ b/UVtools.Core/Operations/OperationRepairLayers.cs @@ -291,7 +291,7 @@ namespace UVtools.Core.Operations if (RemoveEmptyLayers) { - List removeLayers = new List(); + List removeLayers = new(); for (uint layerIndex = LayerIndexStart; layerIndex <= LayerIndexEnd; layerIndex++) { if (SlicerFile[layerIndex].NonZeroPixelCount == 0) diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index 46b05c3..9dedee7 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -10,7 +10,7 @@ https://github.com/sn4k3/UVtools https://github.com/sn4k3/UVtools MSLA/DLP, file analysis, calibration, repair, conversion and manipulation - 2.12.0 + 2.12.1 Copyright © 2020 PTRTECH UVtools.png AnyCPU;x64 diff --git a/UVtools.InstallerMM/UVtools.InstallerMM.wxs b/UVtools.InstallerMM/UVtools.InstallerMM.wxs index 3cb785c..8984c44 100644 --- a/UVtools.InstallerMM/UVtools.InstallerMM.wxs +++ b/UVtools.InstallerMM/UVtools.InstallerMM.wxs @@ -308,8 +308,8 @@ - - + + diff --git a/UVtools.WPF/Controls/Calibrators/CalibrateXYZAccuracyControl.axaml.cs b/UVtools.WPF/Controls/Calibrators/CalibrateXYZAccuracyControl.axaml.cs index 09c514f..04f256e 100644 --- a/UVtools.WPF/Controls/Calibrators/CalibrateXYZAccuracyControl.axaml.cs +++ b/UVtools.WPF/Controls/Calibrators/CalibrateXYZAccuracyControl.axaml.cs @@ -88,7 +88,7 @@ namespace UVtools.WPF.Controls.Calibrators public async void AddProfile() { - OperationResize resize = new OperationResize + OperationResize resize = new() { ProfileName = ProfileName, X = Operation.ScaleXFactor, diff --git a/UVtools.WPF/Controls/StaticControls.cs b/UVtools.WPF/Controls/StaticControls.cs index 3d0f943..488891c 100644 --- a/UVtools.WPF/Controls/StaticControls.cs +++ b/UVtools.WPF/Controls/StaticControls.cs @@ -4,8 +4,8 @@ namespace UVtools.WPF.Controls { public static class StaticControls { - public static Cursor ArrowCursor = new Cursor(StandardCursorType.Arrow); - public static Cursor CrossCursor = new Cursor(StandardCursorType.Cross); - public static Cursor HandCursor = new Cursor(StandardCursorType.Hand); + public static Cursor ArrowCursor = new(StandardCursorType.Arrow); + public static Cursor CrossCursor = new(StandardCursorType.Cross); + public static Cursor HandCursor = new(StandardCursorType.Hand); } } diff --git a/UVtools.WPF/MainWindow.LayerPreview.cs b/UVtools.WPF/MainWindow.LayerPreview.cs index b837352..49ed2d8 100644 --- a/UVtools.WPF/MainWindow.LayerPreview.cs +++ b/UVtools.WPF/MainWindow.LayerPreview.cs @@ -57,7 +57,7 @@ namespace UVtools.WPF private Canvas _issuesSliderCanvas; - private Timer _layerNavigationTooltipTimer = new Timer(0.1) { AutoReset = false }; + private Timer _layerNavigationTooltipTimer = new(0.1) { AutoReset = false }; private uint _actualLayer; private bool _showLayerImageRotated; @@ -99,22 +99,23 @@ namespace UVtools.WPF _showLayerOutlineHollowAreas = Settings.LayerPreview.HollowOutline; LayerImageBox.ZoomLevels = new AdvancedImageBox.ZoomLevelCollection(AppSettings.ZoomLevels); - + LayerImageBox.GetObservable(AdvancedImageBox.ZoomProperty).Subscribe(zoom => { + var newZoom = zoom; var oldZoom = LayerImageBox.OldZoom; RaisePropertyChanged(nameof(LayerZoomStr)); - AddLogVerbose($"Zoomed from {oldZoom} to {zoom}"); + AddLogVerbose($"Zoomed from {oldZoom} to {newZoom}"); if (_showLayerImageCrosshairs && Issues.Count > 0 && (oldZoom < 50 && - zoom >= 50 // Trigger refresh as crosshair thickness increases at lower zoom levels - || oldZoom > 100 && zoom <= 100 - || oldZoom is >= 50 and <= 100 && (zoom is < 50 or > 100) + newZoom >= 50 // Trigger refresh as crosshair thickness increases at lower zoom levels + || oldZoom > 100 && newZoom <= 100 + || oldZoom is >= 50 and <= 100 && (newZoom is < 50 or > 100) || oldZoom <= AppSettings.CrosshairFadeLevel && - zoom > AppSettings.CrosshairFadeLevel // Trigger refresh as zoom level manually crosses fade threshold - || oldZoom > AppSettings.CrosshairFadeLevel && zoom <= AppSettings.CrosshairFadeLevel) + newZoom > AppSettings.CrosshairFadeLevel // Trigger refresh as zoom level manually crosses fade threshold + || oldZoom > AppSettings.CrosshairFadeLevel && newZoom <= AppSettings.CrosshairFadeLevel) ) { @@ -1739,7 +1740,7 @@ namespace UVtools.WPF public uint SelectObjectRoi(Rectangle roiRectangle) { if (roiRectangle.IsEmpty) return 0; - List rectangles = new List(); + List rectangles = new(); for (int i = 0; i < LayerCache.LayerContours.Size; i++) { var rectangle = CvInvoke.BoundingRectangle(LayerCache.LayerContours[i]); @@ -1827,7 +1828,7 @@ namespace UVtools.WPF public void UpdatePixelEditorCursor() { Mat cursor = null; - MCvScalar _pixelEditorCursorColor = new MCvScalar( + MCvScalar _pixelEditorCursorColor = new( Settings.PixelEditor.CursorColor.B, Settings.PixelEditor.CursorColor.G, Settings.PixelEditor.CursorColor.R, diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index de6127a..d0ffafc 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -1047,7 +1047,7 @@ namespace UVtools.WPF string convertFileExtension = SlicerFile switch { SL1File sl1File => sl1File.LookupCustomValue(SL1File.Keyword_FileFormat, null), - VDTFile vdtFile => vdtFile.LookupCustomValue(SL1File.Keyword_FileFormat, null), + VDTFile vdtFile => vdtFile.ManifestFile.Machine.UVToolsConvertTo, _ => null }; @@ -1074,8 +1074,7 @@ namespace UVtools.WPF return true; } catch (OperationCanceledException) - { - } + { } catch (Exception exception) { Dispatcher.UIThread.InvokeAsync(async () => diff --git a/UVtools.WPF/Structures/Color.cs b/UVtools.WPF/Structures/Color.cs index f347d2e..9370653 100644 --- a/UVtools.WPF/Structures/Color.cs +++ b/UVtools.WPF/Structures/Color.cs @@ -62,7 +62,7 @@ namespace UVtools.WPF.Structures return new Color(a, r, g, b); } - public static Color Empty => new Color(0,0,0,0); + public static Color Empty => new(0,0,0,0); public Color FactorColor(byte pixelColor, byte min = 0, byte max = byte.MaxValue) => FactorColor(pixelColor / 255f, min, max); diff --git a/UVtools.WPF/Structures/PEProfileFolder.cs b/UVtools.WPF/Structures/PEProfileFolder.cs index d0ce382..2c6a410 100644 --- a/UVtools.WPF/Structures/PEProfileFolder.cs +++ b/UVtools.WPF/Structures/PEProfileFolder.cs @@ -49,7 +49,7 @@ namespace UVtools.WPF.Structures { get { - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new(); foreach (CheckBox item in Items) { if (!item.IsChecked.HasValue || !item.IsChecked.Value) continue; @@ -87,7 +87,7 @@ namespace UVtools.WPF.Structures Updates = 0; Installed = 0; if (!Directory.Exists(SourcePath)) return; - DirectoryInfo di = new DirectoryInfo(SourcePath); + DirectoryInfo di = new(SourcePath); var files = di.GetFiles("*.ini"); if (files.Length == 0) return; @@ -104,7 +104,7 @@ namespace UVtools.WPF.Structures if (folderExists) { var targetFile = $"{TargetPath}{Path.DirectorySeparatorChar}{files[i].Name}"; - FileInfo targetFileInfo = new FileInfo(targetFile); + FileInfo targetFileInfo = new(targetFile); if (targetFileInfo.Exists) { Installed++; diff --git a/UVtools.WPF/Structures/PixelPicker.cs b/UVtools.WPF/Structures/PixelPicker.cs index a3d26a0..c0459ff 100644 --- a/UVtools.WPF/Structures/PixelPicker.cs +++ b/UVtools.WPF/Structures/PixelPicker.cs @@ -6,7 +6,7 @@ namespace UVtools.WPF.Structures public class PixelPicker : BindableBase { private bool _isSet; - private Point _location = new Point(0,0); + private Point _location = new(0,0); private byte _brightness; public bool IsSet diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index 3eb829a..564edcf 100644 --- a/UVtools.WPF/UVtools.WPF.csproj +++ b/UVtools.WPF/UVtools.WPF.csproj @@ -12,7 +12,7 @@ LICENSE https://github.com/sn4k3/UVtools Git - 2.12.0 + 2.12.1 @@ -24,11 +24,11 @@ 1701;1702; - + - - - + + + diff --git a/UVtools.WPF/Windows/BenchmarkWindow.axaml.cs b/UVtools.WPF/Windows/BenchmarkWindow.axaml.cs index 1b8a499..7eb4229 100644 --- a/UVtools.WPF/Windows/BenchmarkWindow.axaml.cs +++ b/UVtools.WPF/Windows/BenchmarkWindow.axaml.cs @@ -33,7 +33,7 @@ namespace UVtools.WPF.Windows public const string RunsAbbreviation = "TDPS"; public const string StressCPUTestName = "Stress CPU (Run until stop)"; - private readonly RNGCryptoServiceProvider _randomProvider = new RNGCryptoServiceProvider(); + private readonly RNGCryptoServiceProvider _randomProvider = new(); private CancellationTokenSource _tokenSource; private CancellationToken _token => _tokenSource.Token; @@ -219,7 +219,7 @@ namespace UVtools.WPF.Windows #region Tests public byte[] EncodeCbddlpImage(Mat image, byte bit = 0) { - List rawData = new List(); + List rawData = new(); var span = image.GetPixelSpan(); bool obit = false; @@ -279,7 +279,7 @@ namespace UVtools.WPF.Windows private byte[] EncodeCbtImage(Mat image) { - List rawData = new List(); + List rawData = new(); byte color = byte.MaxValue >> 1; uint stride = 0; var span = image.GetPixelSpan(); @@ -359,7 +359,7 @@ namespace UVtools.WPF.Windows public byte[] EncodePW0Image(Mat image) { - List rawData = new List(); + List rawData = new(); var span = image.GetPixelSpan(); int lastColor = -1; @@ -424,7 +424,7 @@ namespace UVtools.WPF.Windows { var bytes = new byte[width * height]; _randomProvider.GetBytes(bytes); - Mat mat = new Mat(new Size(width, height), DepthType.Cv8U, 1); + Mat mat = new(new Size(width, height), DepthType.Cv8U, 1); mat.SetBytes(bytes); return mat; } diff --git a/UVtools.WPF/Windows/SettingsWindow.axaml.cs b/UVtools.WPF/Windows/SettingsWindow.axaml.cs index edc4bc4..0052bd0 100644 --- a/UVtools.WPF/Windows/SettingsWindow.axaml.cs +++ b/UVtools.WPF/Windows/SettingsWindow.axaml.cs @@ -116,7 +116,7 @@ namespace UVtools.WPF.Windows foreach (PropertyInfo propertyInfo in Settings.General.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) { if (propertyInfo.Name != field) continue; - OpenFolderDialog dialog = new OpenFolderDialog(); + OpenFolderDialog dialog = new(); var filename = await dialog.ShowAsync(this); if (string.IsNullOrEmpty(filename)) return; propertyInfo.SetValue(Settings.General, filename); diff --git a/build/CreateRelease.WPF.ps1 b/build/CreateRelease.WPF.ps1 index 24e73e9..086b533 100644 --- a/build/CreateRelease.WPF.ps1 +++ b/build/CreateRelease.WPF.ps1 @@ -34,7 +34,7 @@ Set-Location $PSScriptRoot\.. #################################### $enableMSI = $true #$buildOnly = $null -#$buildOnly = "win-x64" +$buildOnly = "win-x64" # Profilling $stopWatch = New-Object -TypeName System.Diagnostics.Stopwatch $deployStopWatch = New-Object -TypeName System.Diagnostics.Stopwatch @@ -104,11 +104,11 @@ $runtimes = "exclude" = @() "include" = @("libcvextern.so") } - "linux-arm64" = @{ - "extraCmd" = "-p:PublishReadyToRun=true" - "exclude" = @() - "include" = @("libcvextern.so") - } + #"linux-arm64" = @{ + # "extraCmd" = "-p:PublishReadyToRun=true" + # "exclude" = @() + # "include" = @("libcvextern.so") + #} #"unix-x64" = @{ # "extraCmd" = "-p:PublishReadyToRun=true" # "exclude" = @("x86", "x64", "libcvextern.dylib") -- cgit v1.2.3