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/ChituboxZipFile.cs')
-rw-r--r--UVtools.Core/FileFormats/ChituboxZipFile.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/UVtools.Core/FileFormats/ChituboxZipFile.cs b/UVtools.Core/FileFormats/ChituboxZipFile.cs
index f2ec085..afddf40 100644
--- a/UVtools.Core/FileFormats/ChituboxZipFile.cs
+++ b/UVtools.Core/FileFormats/ChituboxZipFile.cs
@@ -241,6 +241,17 @@ namespace UVtools.Core.FileFormats
tr.Close();
}
+ if (HeaderSettings.LayerCount == 0)
+ {
+ foreach (var zipEntry in inputFile.Entries)
+ {
+ if(!zipEntry.Name.EndsWith(".png")) continue;
+ var filename = Path.GetFileNameWithoutExtension(zipEntry.Name);
+ if (!filename.All(char.IsDigit)) continue;
+ if (!uint.TryParse(filename, out var layerIndex)) continue;
+ HeaderSettings.LayerCount = Math.Max(HeaderSettings.LayerCount, layerIndex);
+ }
+ }
LayerManager = new LayerManager(HeaderSettings.LayerCount);
@@ -282,6 +293,15 @@ namespace UVtools.Core.FileFormats
progress++;
}
+ if (HeaderSettings.LayerCount > 0 && ResolutionX == 0)
+ {
+ using (var mat = this[0].LayerMat)
+ {
+ HeaderSettings.ResolutionX = (uint)mat.Width;
+ HeaderSettings.ResolutionY = (uint)mat.Height;
+ }
+ }
+
entry = inputFile.GetEntry("preview.png");
if (!ReferenceEquals(entry, null))
{