Files
UVtools/UVtools.WPF/Program.cs
T
Tiago Conceição 80a9adbcd0 v2.18.0
- **Command line arguments:**
   - (Add) Convert files: UVtools.exe -c \<inputfile\> \<outputfile1/ext1\> [outputfile2/ext2]
   - (Add) Extract files: UVtools.exe -e \<inputfile\> [output_folder]
   - https://github.com/sn4k3/UVtools#command-line-arguments
- **File formats:**
   - (Add) Implement TSMC (Two Stage Motor Control) for the supported formats
   - (Add) Implement 'Bottom retract speed' for the supported formats
   - (Add) LGS: Support for lgs120 and lg4k (#218)
   - (Add) CTB: Special/virtual file extensions .v2.ctb, .v3.ctb, .v4.ctb to force a convertion to the set version (2 to 4). The .ctb is Version 3 by default when creating/converting files
   - (Improvement) Better performance for file formats that decode images in sequential pixels groups
- **GCode:**
  - (Improvement) Better parsing of the movements / lifts
  - (Improvement) Better handling of lifts performed after cure the layer
  - (Improvement) More fail-safe checks and sanitize of gcode while parsing
- (Improvement) CTBv3: Enable per layer settings if disabled when fast save without reencode
- (Upgrade) .NET from 5.0.8 to 5.0.9
- (Fix) PrusaSlicer printer: Longer Orange 4k with correct resolution and display size
- (Fix) Odd error when changing properties too fast in multi-thread
2021-08-12 23:19:47 +01:00

87 lines
3.3 KiB
C#

using System;
using System.Diagnostics;
using System.Runtime.ExceptionServices;
using Avalonia;
using UVtools.WPF.Extensions;
namespace UVtools.WPF
{
public static class Program
{
public static string[] Args;
public static Stopwatch ProgramStartupTime;
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args)
{
ProgramStartupTime = Stopwatch.StartNew();
Args = args;
try
{
if (ConsoleArguments.ParseArgs(args)) return;
}
catch (Exception e)
{
Console.WriteLine(e);
return;
}
/*Slicer slicer = new(Size.Empty, SizeF.Empty, "D:\\Cube100x100x100.stl");
var slices = slicer.SliceModel(0.05f);
foreach (var slice in slices)
{
using var mat = EmguExtensions.InitMat(new Size(1000, 1000));
var contour = slice.Value.ToContour();
using var vec = new VectorOfPoint(contour);
CvInvoke.FillPoly(mat, vec, EmguExtensions.WhiteColor, LineType.AntiAlias);
mat.Save(@$"D:\SLICE\{slice.Key}.png");
}*/
// Add the event handler for handling non-UI thread exceptions to the event.
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
//AppDomain.CurrentDomain.FirstChanceException += CurrentDomainOnFirstChanceException;
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
private static void CurrentDomainOnFirstChanceException(object? sender, FirstChanceExceptionEventArgs e)
{
ErrorLog.AppendLine("First chance exception", e.Exception.ToString());
}
private static async void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = (Exception)e.ExceptionObject;
ErrorLog.AppendLine("Fatal Non-UI Error", ex.ToString());
try
{
string errorMsg = "An application error occurred. Please contact the administrator with the following information:\n\n" +
$"{ex}";
await App.MainWindow.MessageBoxError(errorMsg, "Fatal Non-UI Error");
}
catch (Exception exception)
{
Debug.WriteLine(exception);
}
}
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new Win32PlatformOptions { AllowEglInitialization = true/*, UseWgl = true*/})
.With(new X11PlatformOptions { UseGpu = true/*, UseEGL = true*/ })
.With(new MacOSPlatformOptions { ShowInDock = true })
.With(new AvaloniaNativePlatformOptions { UseGpu = true })
.UseSkia()
.LogToTrace();
}
}