Skip to content

Commit

Permalink
v3.6.0
Browse files Browse the repository at this point in the history
- **File formats:**
   - (Add) OSF (Vlare Open File Format)
   - (Fix) CTB Encrypted: Bottom Retract Height for TSMC was constraining incorrectly with the normal total retract height
   - (Fix) CWS: Only issue `;<Slice>` command when the exposure is about to happen (#514)
- **GCode:**
   - (Add) Command `CommandWaitSyncDelay` for movement wait sync delay instead of depending on G4 wait command
   - (Fix) Wrong parsing and set of wait times when using a wait after lift / wait before retract
- (Improvement) Auto update: Make sure the download url exists before attempt the download, if not, instead it will prompt for manual download and update
- (Improvement) MacOS: Remove `com.apple.quarantine` flag from the auto downloaded files
- (Upgrade) .NET from 6.0.7 to 6.0.8
- (Upgrade) AvaloniaUI from 0.10.17 to 0.10.18
  • Loading branch information
sn4k3 committed Aug 17, 2022
1 parent 247ed74 commit 57f077f
Show file tree
Hide file tree
Showing 29 changed files with 946 additions and 508 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# Changelog

## 17/08/2022 - v3.6.0

- **File formats:**
- (Add) OSF (Vlare Open File Format)
- (Fix) CTB Encrypted: Bottom Retract Height for TSMC was constraining incorrectly with the normal total retract height
- (Fix) CWS: Only issue `;<Slice>` command when the exposure is about to happen (#514)
- **GCode:**
- (Add) Command `CommandWaitSyncDelay` for movement wait sync delay instead of depending on G4 wait command
- (Fix) Wrong parsing and set of wait times when using a wait after lift / wait before retract
- (Improvement) Auto update: Make sure the download url exists before attempt the download, if not, instead it will prompt for manual download and update
- (Improvement) MacOS: Remove `com.apple.quarantine` flag from the auto downloaded files
- (Upgrade) .NET from 6.0.7 to 6.0.8
- (Upgrade) AvaloniaUI from 0.10.17 to 0.10.18

## 29/07/2022 - v3.5.6

- **Tools**
- **PCB Exposure:**
- (Add) Able to choose the size midpoint rounding method (#520)
- (Fix) Allow to flash alone D03 commands (#520)
- (Fix) Correct line thickness to have at least 1px error (#523)
- (Improvement) Layer arithmetic: Use ; to split and start a new arithmetic operation
- (Improvement) Layer arithmetic: Use ; to split and start a new arithmetic operation (#519)
- (Add) Cmd: Convert command now allow to pass 'auto' as target type to auto convert specific files, valid for SL1 files configured with FILEFORMAT_xxx (#522)
- (Add) GCode: Command to sync and wait for movement completion [Only enabled for cws format] (#514)
- (Add) VDT: Transition layer count
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# UVtools

[![License](https://img.shields.io/github/license/sn4k3/UVtools?style=flat-square)](https://github.com/sn4k3/UVtools/blob/master/LICENSE)
[![GitHub repo size](https://img.shields.io/github/repo-size/sn4k3/UVtools?style=flat-square)](#)
[![Code size](https://img.shields.io/github/languages/code-size/sn4k3/UVtools?style=flat-square)](#)
[![Total code](https://img.shields.io/tokei/lines/github/sn4k3/UVtools?style=flat-square)](#)
[![Nuget](https://img.shields.io/nuget/v/UVtools.Core?style=flat-square)](https://www.nuget.org/packages/UVtools.Core)
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/sn4k3/UVtools?include_prereleases&style=flat-square)](https://github.com/sn4k3/UVtools/releases)
[![Downloads](https://img.shields.io/github/downloads/sn4k3/UVtools/total?style=flat-square)](https://github.com/sn4k3/UVtools/releases)
[![Chocolatey](https://img.shields.io/chocolatey/dt/uvtools?color=brown&label=Chocolatey&style=flat-square)](https://community.chocolatey.org/packages/uvtools)
[![License](https://img.shields.io/github/license/sn4k3/UVtools?style=for-the-badge)](https://github.com/sn4k3/UVtools/blob/master/LICENSE)
[![GitHub repo size](https://img.shields.io/github/repo-size/sn4k3/UVtools?style=for-the-badge)](#)
[![Code size](https://img.shields.io/github/languages/code-size/sn4k3/UVtools?style=for-the-badge)](#)
[![Total code](https://img.shields.io/tokei/lines/github/sn4k3/UVtools?style=for-the-badge)](#)
[![Nuget](https://img.shields.io/nuget/v/UVtools.Core?style=for-the-badge)](https://www.nuget.org/packages/UVtools.Core)
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/sn4k3/UVtools?include_prereleases&style=for-the-badge)](https://github.com/sn4k3/UVtools/releases)
[![Downloads](https://img.shields.io/github/downloads/sn4k3/UVtools/total?style=for-the-badge)](https://github.com/sn4k3/UVtools/releases)
[![Chocolatey](https://img.shields.io/chocolatey/dt/uvtools?color=brown&label=Chocolatey&style=for-the-badge)](https://community.chocolatey.org/packages/uvtools)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/sn4k3?color=red&style=for-the-badge)](https://github.com/sponsors/sn4k3)

## Download the latest version at:
https://github.com/sn4k3/UVtools/releases/latest
Expand Down Expand Up @@ -106,6 +107,7 @@ But also, i need victims for test subject. Proceed at your own risk!
- ZIP (Generic / Phrozen Zip)
- VDA.ZIP (Voxeldance Additive)
- VDT (Voxeldance Tango)
- OSF (Vlare Open File Format)
- UVJ (Zip file format for manual manipulation)
- Image files (png, jpg, jpeg, jp2, tif, bmp, pbm, pgm, ras, sr)

Expand Down Expand Up @@ -339,7 +341,7 @@ Easy to use calls that allow you work with the formats. For more information nav
Nuget package: https://www.nuget.org/packages/UVtools.Core
[![Nuget](https://img.shields.io/nuget/v/UVtools.Core?style=flat-square)](https://www.nuget.org/packages/UVtools.Core)
[![Nuget](https://img.shields.io/nuget/v/UVtools.Core?style=for-the-badge)](https://www.nuget.org/packages/UVtools.Core)
```powershell
dotnet add package UVtools.Core
Expand Down Expand Up @@ -376,13 +378,12 @@ The fastest way to compile the project is by run the `build/compile.bat`, howeve
# Support my work / Donate
All my work here is given for free (OpenSource), it took some hours to build, test and polish the program.
If you're happy to contribute for a better program and for my work i will appreciate the tip.
- Sponsor: https://github.com/sponsors/sn4k3
- PayPal: https://paypal.me/SkillTournament
If you're happy to contribute for a better program and for my work i will appreciate the tip.
Use one of the following methods:
[![GitHub Sponsors](https://img.shields.io/badge/Donate-Sponsor-red?style=for-the-badge)](https://github.com/sponsors/sn4k3)
[![Donate PayPal](https://img.shields.io/badge/Donate-PayPal-blue?style=for-the-badge)](https://paypal.me/SkillTournament)
# Contributors
[![GitHub contributors](https://img.shields.io/github/contributors/sn4k3/UVtools?style=for-the-badge)](https://github.com/sn4k3/UVtools/graphs/contributors)
[![Contributors](https://contrib.rocks/image?repo=sn4k3/UVtools)](https://github.com/sn4k3/UVtools/graphs/contributors)
21 changes: 11 additions & 10 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
- **Tools**
- **PCB Exposure:**
- (Add) Able to choose the size midpoint rounding method (#520)
- (Fix) Allow to flash alone D03 commands (#520)
- (Fix) Correct line thickness to have at least 1px error (#523)
- (Improvement) Layer arithmetic: Use ; to split and start a new arithmetic operation
- (Add) Cmd: Convert command now allow to pass 'auto' as target type to auto convert specific files, valid for SL1 files configured with FILEFORMAT_xxx (#522)
- (Add) GCode: Command to sync and wait for movement completion [Only enabled for cws format] (#514)
- (Add) VDT: Transition layer count
- (Upgrade) AvaloniaUI from 0.10.16 to 0.10.17
- **File formats:**
- (Add) OSF (Vlare Open File Format)
- (Fix) CTB Encrypted: Bottom Retract Height for TSMC was constraining incorrectly with the normal total retract height
- (Fix) CWS: Only issue `;<Slice>` command when the exposure is about to happen (#514)
- **GCode:**
- (Add) Command `CommandWaitSyncDelay` for movement wait sync delay instead of depending on G4 wait command
- (Fix) Wrong parsing and set of wait times when using a wait after lift / wait before retract
- (Improvement) Auto update: Make sure the download url exists before attempt the download, if not, instead it will prompt for manual download and update
- (Improvement) MacOS: Remove `com.apple.quarantine` flag from the auto downloaded files
- (Upgrade) .NET from 6.0.7 to 6.0.8
- (Upgrade) AvaloniaUI from 0.10.17 to 0.10.18

6 changes: 5 additions & 1 deletion Scripts/010 Editor/osf.bt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ struct HEADER {
ushort RetractSpeedEnd <fgcolor=cBlack, bgcolor=cRed>; // 7
ubyte RetractDecelerationChange <fgcolor=cBlack, bgcolor=cRed>; // 5

ubyte Unknown[8] <fgcolor=cWhite, bgcolor=cBlack>;
ushort BottomWaitTimeAfterCureMagnified100Times <fgcolor=cBlack, bgcolor=cRed>; // s * 100
ushort BottomWaitTimeAfterLiftMagnified100Times <fgcolor=cBlack, bgcolor=cRed>; // s * 100
ushort BottomWaitTimeBeforeCureMagnified100Times <fgcolor=cBlack, bgcolor=cRed>; // s * 100

ushort Reserved <fgcolor=cWhite, bgcolor=cBlack>;

ubyte ProtocolType <fgcolor=cBlack, bgcolor=cRed>; // 0
} header;
Expand Down
2 changes: 1 addition & 1 deletion UVtools.AvaloniaControls/UVtools.AvaloniaControls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.17" />
<PackageReference Include="Avalonia" Version="0.10.18" />
</ItemGroup>

<ItemGroup>
Expand Down
181 changes: 90 additions & 91 deletions UVtools.Core/Extensions/CompressionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,123 +10,122 @@
using System.IO;
using System.IO.Compression;
using System.Runtime.CompilerServices;
using Microsoft.Toolkit.HighPerformance;
using CommunityToolkit.HighPerformance;

namespace UVtools.Core.Extensions
namespace UVtools.Core.Extensions;

public static class CompressionExtensions
{
public static class CompressionExtensions
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetGzipUncompressedLength(ReadOnlyMemory<byte> compressedData)
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetGzipUncompressedLength(ReadOnlyMemory<byte> compressedData)
{
return BitConverter.ToInt32(compressedData.Slice(compressedData.Length - 4, 4).Span);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetGzipUncompressedLength(Stream stream)
{
Span<byte> uncompressedLength = stackalloc byte[4];
stream.Position = stream.Length - 4;
stream.Read(uncompressedLength);
stream.Seek(0, SeekOrigin.Begin);
return BitConverter.ToInt32(uncompressedLength);
}
return BitConverter.ToInt32(compressedData.Slice(compressedData.Length - 4, 4).Span);
}

public static MemoryStream GZipCompress(Stream inputStream, CompressionLevel compressionLevel, bool leaveStreamOpen = false)
{
if (inputStream.Position == inputStream.Length) { inputStream.Seek(0, SeekOrigin.Begin); }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetGzipUncompressedLength(Stream stream)
{
Span<byte> uncompressedLength = stackalloc byte[4];
stream.Position = stream.Length - 4;
stream.Read(uncompressedLength);
stream.Seek(0, SeekOrigin.Begin);
return BitConverter.ToInt32(uncompressedLength);
}

var compressedStream = new MemoryStream();
using (var gzipStream = new GZipStream(compressedStream, compressionLevel, true))
{
inputStream.CopyTo(gzipStream);
}
if (!leaveStreamOpen) { inputStream.Close(); }
public static MemoryStream GZipCompress(Stream inputStream, CompressionLevel compressionLevel, bool leaveStreamOpen = false)
{
if (inputStream.Position == inputStream.Length) { inputStream.Seek(0, SeekOrigin.Begin); }

compressedStream.Seek(0, SeekOrigin.Begin);
return compressedStream;
var compressedStream = new MemoryStream();
using (var gzipStream = new GZipStream(compressedStream, compressionLevel, true))
{
inputStream.CopyTo(gzipStream);
}
if (!leaveStreamOpen) { inputStream.Close(); }

public static MemoryStream GZipCompress(byte[] inputStream, CompressionLevel compressionLevel) =>
GZipCompress(new ReadOnlyMemory<byte>(inputStream).AsStream(), compressionLevel);
compressedStream.Seek(0, SeekOrigin.Begin);
return compressedStream;
}

public static byte[] GZipCompressToBytes(byte[] inputStream, CompressionLevel compressionLevel)
{
using var ms = GZipCompress(new ReadOnlyMemory<byte>(inputStream).AsStream(), compressionLevel);
return ms.ToArray();
}
public static MemoryStream GZipCompress(byte[] inputStream, CompressionLevel compressionLevel) =>
GZipCompress(new ReadOnlyMemory<byte>(inputStream).AsStream(), compressionLevel);

public static byte[] GZipCompressToBytes(byte[] inputStream, CompressionLevel compressionLevel)
{
using var ms = GZipCompress(new ReadOnlyMemory<byte>(inputStream).AsStream(), compressionLevel);
return ms.ToArray();
}


public static MemoryStream GZipDecompress(Stream compressedStream, bool leaveStreamOpen = false)
{
if (compressedStream.Position == compressedStream.Length) { compressedStream.Seek(0, SeekOrigin.Begin); }
public static MemoryStream GZipDecompress(Stream compressedStream, bool leaveStreamOpen = false)
{
if (compressedStream.Position == compressedStream.Length) { compressedStream.Seek(0, SeekOrigin.Begin); }

var uncompressedStream = new MemoryStream(GetGzipUncompressedLength(compressedStream));
using var gzipStream = new GZipStream(compressedStream, CompressionMode.Decompress, leaveStreamOpen);
gzipStream.CopyTo(uncompressedStream);
var uncompressedStream = new MemoryStream(GetGzipUncompressedLength(compressedStream));
using var gzipStream = new GZipStream(compressedStream, CompressionMode.Decompress, leaveStreamOpen);
gzipStream.CopyTo(uncompressedStream);

return uncompressedStream;
}
return uncompressedStream;
}

public static ArraySegment<byte> GZipDecompress(ReadOnlyMemory<byte> compressedData)
public static ArraySegment<byte> GZipDecompress(ReadOnlyMemory<byte> compressedData)
{
using var uncompressedStream = new MemoryStream(GetGzipUncompressedLength(compressedData));
using (var gzipStream = new GZipStream(compressedData.AsStream(), CompressionMode.Decompress, false))
{
using var uncompressedStream = new MemoryStream(GetGzipUncompressedLength(compressedData));
using (var gzipStream = new GZipStream(compressedData.AsStream(), CompressionMode.Decompress, false))
{
gzipStream.CopyTo(uncompressedStream);
}

return uncompressedStream.TryGetBuffer(out var buffer)
? buffer
: uncompressedStream.ToArray();
gzipStream.CopyTo(uncompressedStream);
}

public static MemoryStream DeflateCompress(Stream inputStream, CompressionLevel compressionLevel, bool leaveStreamOpen = false)
{
if (inputStream.Position == inputStream.Length) { inputStream.Seek(0, SeekOrigin.Begin); }
return uncompressedStream.TryGetBuffer(out var buffer)
? buffer
: uncompressedStream.ToArray();
}

var compressedStream = new MemoryStream();
using (var gzipStream = new DeflateStream(compressedStream, compressionLevel, true))
{
inputStream.CopyTo(gzipStream);
}
if (!leaveStreamOpen) { inputStream.Close(); }
public static MemoryStream DeflateCompress(Stream inputStream, CompressionLevel compressionLevel, bool leaveStreamOpen = false)
{
if (inputStream.Position == inputStream.Length) { inputStream.Seek(0, SeekOrigin.Begin); }

compressedStream.Seek(0, SeekOrigin.Begin);
return compressedStream;
var compressedStream = new MemoryStream();
using (var gzipStream = new DeflateStream(compressedStream, compressionLevel, true))
{
inputStream.CopyTo(gzipStream);
}
if (!leaveStreamOpen) { inputStream.Close(); }

public static MemoryStream DeflateCompress(byte[] inputStream, CompressionLevel compressionLevel) =>
DeflateCompress(new ReadOnlyMemory<byte>(inputStream).AsStream(), compressionLevel);
compressedStream.Seek(0, SeekOrigin.Begin);
return compressedStream;
}

public static byte[] DeflateCompressToBytes(byte[] inputStream, CompressionLevel compressionLevel)
{
using var ms = DeflateCompress(new ReadOnlyMemory<byte>(inputStream).AsStream(), compressionLevel);
return ms.ToArray();
}
public static MemoryStream DeflateCompress(byte[] inputStream, CompressionLevel compressionLevel) =>
DeflateCompress(new ReadOnlyMemory<byte>(inputStream).AsStream(), compressionLevel);

public static MemoryStream DeflateDecompress(Stream compressedStream, bool leaveStreamOpen = false)
{
if (compressedStream.Position == compressedStream.Length) { compressedStream.Seek(0, SeekOrigin.Begin); }
public static byte[] DeflateCompressToBytes(byte[] inputStream, CompressionLevel compressionLevel)
{
using var ms = DeflateCompress(new ReadOnlyMemory<byte>(inputStream).AsStream(), compressionLevel);
return ms.ToArray();
}

var uncompressedStream = new MemoryStream();
using var gzipStream = new DeflateStream(compressedStream, CompressionMode.Decompress, leaveStreamOpen);
gzipStream.CopyTo(uncompressedStream);
public static MemoryStream DeflateDecompress(Stream compressedStream, bool leaveStreamOpen = false)
{
if (compressedStream.Position == compressedStream.Length) { compressedStream.Seek(0, SeekOrigin.Begin); }

return uncompressedStream;
}
var uncompressedStream = new MemoryStream();
using var gzipStream = new DeflateStream(compressedStream, CompressionMode.Decompress, leaveStreamOpen);
gzipStream.CopyTo(uncompressedStream);

public static ArraySegment<byte> DeflateDecompress(ReadOnlyMemory<byte> compressedData)
return uncompressedStream;
}

public static ArraySegment<byte> DeflateDecompress(ReadOnlyMemory<byte> compressedData)
{
using var uncompressedStream = new MemoryStream();
using (var gzipStream = new DeflateStream(compressedData.AsStream(), CompressionMode.Decompress, false))
{
using var uncompressedStream = new MemoryStream();
using (var gzipStream = new DeflateStream(compressedData.AsStream(), CompressionMode.Decompress, false))
{
gzipStream.CopyTo(uncompressedStream);
}

return uncompressedStream.TryGetBuffer(out var buffer)
? buffer
: uncompressedStream.ToArray();
gzipStream.CopyTo(uncompressedStream);
}

return uncompressedStream.TryGetBuffer(out var buffer)
? buffer
: uncompressedStream.ToArray();
}
}
}
2 changes: 1 addition & 1 deletion UVtools.Core/Extensions/EmguExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Toolkit.HighPerformance;
using CommunityToolkit.HighPerformance;
using UVtools.Core.EmguCV;
using UVtools.Core.Objects;

Expand Down
2 changes: 1 addition & 1 deletion UVtools.Core/FileFormats/CTBEncryptedFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ public override float BottomRetractHeight2
get => Settings.BottomRetractHeight2;
set
{
value = Math.Clamp((float)Math.Round(value, 2), 0, RetractHeightTotal);
value = Math.Clamp((float)Math.Round(value, 2), 0, BottomRetractHeightTotal);
base.BottomRetractHeight2 = Settings.BottomRetractHeight2 = value;
}
}
Expand Down
Loading

0 comments on commit 57f077f

Please sign in to comment.