diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2020-09-14 23:55:04 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2020-09-14 23:55:04 +0300 |
commit | 8bec024315d74b0b426c4918137bda0eda31bcc6 (patch) | |
tree | f61fc09bb4d365832388a124f7520cc4d31331fb | |
parent | 4cf6be8c97647e07670c250e548c26f7e05f85c9 (diff) |
Fix ctb and pws
* (Fix) ctb and pws: Renders a bad file after save, this was introduced with cancelled saves feature
* (Fix) When cancel a file convertion, it now deletes the target file
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | UVtools.Core/FileFormats/ChituboxFile.cs | 6 | ||||
-rw-r--r-- | UVtools.Core/FileFormats/FileFormat.cs | 1 | ||||
-rw-r--r-- | UVtools.Core/FileFormats/PWSFile.cs | 2 | ||||
-rw-r--r-- | UVtools.GUI/FrmMain.cs | 7 |
5 files changed, 14 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bb1244..0084dcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,12 @@ # Changelog -## ?/09/2020 - v0.8.2.1 +## 14/09/2020 - v0.8.2.1 -* (Improvement) When unable to convert a format from SL1 to other, advice users to check used printer on PrusaSlicer +* (Improvement) When unable to convert a format from SL1 to other, advice users to check used printer on PrusaSlicer (#60) * (Improvement) Information on "Install profiles on PrusaSlicer" (#60) * (Fix) LGS: Change resolution tool was defining wrong Y +* (Fix) ctb and pws: Renders a bad file after save, this was introduced with cancelled saves feature +* (Fix) When cancel a file convertion, it now deletes the target file ## 13/09/2020 - v0.8.2.0 diff --git a/UVtools.Core/FileFormats/ChituboxFile.cs b/UVtools.Core/FileFormats/ChituboxFile.cs index 0bc1044..0b12ba2 100644 --- a/UVtools.Core/FileFormats/ChituboxFile.cs +++ b/UVtools.Core/FileFormats/ChituboxFile.cs @@ -26,8 +26,8 @@ namespace UVtools.Core.FileFormats public class ChituboxFile : FileFormat { #region Constants - private const uint MAGIC_CBDDLP = 0x12FD0019; - private const uint MAGIC_CBT = 0x12FD0086; + private const uint MAGIC_CBDDLP = 0x12FD0019; // 318570521 + private const uint MAGIC_CBT = 0x12FD0086; // 318570630 private const ushort REPEATRGB15MASK = 0x20; private const byte RLE8EncodingLimit = 0x7d; // 125; @@ -1139,7 +1139,7 @@ namespace UVtools.Core.FileFormats base.Encode(fileFullPath, progress); LayersHash.Clear(); - HeaderSettings.Magic = fileFullPath.EndsWith(".ctb") ? MAGIC_CBT : MAGIC_CBDDLP; + HeaderSettings.Magic = fileFullPath.EndsWith(".ctb") || fileFullPath.EndsWith($".ctb{TemporaryFileAppend}") ? MAGIC_CBT : MAGIC_CBDDLP; HeaderSettings.PrintParametersSize = (uint)Helpers.Serializer.SizeOf(PrintParametersSettings); diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs index ea4d18a..b93eb2b 100644 --- a/UVtools.Core/FileFormats/FileFormat.cs +++ b/UVtools.Core/FileFormats/FileFormat.cs @@ -26,6 +26,7 @@ namespace UVtools.Core.FileFormats /// </summary> public abstract class FileFormat : IFileFormat, IDisposable, IEquatable<FileFormat>, IEnumerable<Layer> { + public const string TemporaryFileAppend = ".tmp"; #region Enums /// <summary> diff --git a/UVtools.Core/FileFormats/PWSFile.cs b/UVtools.Core/FileFormats/PWSFile.cs index 85104cb..56a1a7b 100644 --- a/UVtools.Core/FileFormats/PWSFile.cs +++ b/UVtools.Core/FileFormats/PWSFile.cs @@ -876,7 +876,7 @@ namespace UVtools.Core.FileFormats public override object[] Configs => new object[] { FileMarkSettings, HeaderSettings, PreviewSettings, LayersDefinition }; - public LayerRleFormat LayerFormat => FileFullPath.EndsWith(".pws") ? LayerRleFormat.PWS : LayerRleFormat.PW0; + public LayerRleFormat LayerFormat => FileFullPath.EndsWith(".pws") || FileFullPath.EndsWith($".pws{TemporaryFileAppend}") ? LayerRleFormat.PWS : LayerRleFormat.PW0; #endregion diff --git a/UVtools.GUI/FrmMain.cs b/UVtools.GUI/FrmMain.cs index bb76ccf..e989c36 100644 --- a/UVtools.GUI/FrmMain.cs +++ b/UVtools.GUI/FrmMain.cs @@ -1424,7 +1424,10 @@ namespace UVtools.GUI } catch (OperationCanceledException) { - + if (File.Exists(dialog.FileName)) + { + File.Delete(dialog.FileName); + } } catch (Exception ex) { @@ -2013,7 +2016,7 @@ namespace UVtools.GUI } var oldFile = SlicerFile.FileFullPath; - var tempFile = filepath + ".tmp"; + var tempFile = filepath + FileFormat.TemporaryFileAppend; DisableGUI(); FrmLoading.SetDescription($"Saving {Path.GetFileName(filepath)}"); |