/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc.
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using Emgu.CV;
using Emgu.CV.CvEnum;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using UVtools.Core.Converters;
using UVtools.Core.Extensions;
using UVtools.Core.GCode;
using UVtools.Core.Layers;
using UVtools.Core.Operations;
namespace UVtools.Core.FileFormats;
public class JXSFile : FileFormat
{
#region Constants
public const string ConfigFileName = "config.ini";
public const string ControlFilename = "control.json";
#endregion
#region Sub Classes
public sealed class JXSConfig
{
public string Action { get; set; } = "print";
[DisplayName("FirstLayerTime")] public uint BottomExposureTimeMs { get; set; } = TimeConverter.SecondsToMillisecondsUint(DefaultBottomExposureTime);
[DisplayName("LayerTime")] public uint ExposureTimeMs { get; set; } = TimeConverter.SecondsToMillisecondsUint(DefaultExposureTime);
public uint NumFade { get; set; }
[DisplayName("NumLayers")] public uint LayerCount { get; set; }
[DisplayName("UsedMaterial")] public float MaterialMl { get; set; }
[DisplayName("layerHeight")] public float LayerHeight { get; set; }
[DisplayName("nJobName")] public string JobName { get; set; } = string.Empty;
[DisplayName("NumBottomLayers")] public ushort BottomLayerCount { get; set; } = DefaultBottomLayerCount;
[DisplayName("LiftDistance1")] public float LiftHeight1 { get; set; } = DefaultBottomLiftHeight;
[DisplayName("LiftFeedrate1")] public float LiftSpeed1 { get; set; } = DefaultLiftSpeed;
[DisplayName("LiftDistance2")] public float LiftHeight2 { get; set; } = DefaultLiftHeight2;
[DisplayName("LiftFeedrate2")] public float LiftSpeed2 { get; set; } = DefaultLiftSpeed2;
[DisplayName("BottomLiftFeedrate")] public float BottomLiftSpeed { get; set; } = DefaultBottomLiftSpeed;
[DisplayName("RetractFeedrate")] public float RetractSpeed { get; set; } = DefaultRetractSpeed;
[DisplayName("ZMoveTimeCompensation")] public uint WaitTimeBeforeCure { get; set; } = 1500;
[DisplayName("ZMoveTimeCompensationBottom")] public uint BottomWaitTimeBeforeCure { get; set; } = 8000;
public string OnLightCode { get; set; } = "M106 S255";
public string OffLightCode { get; set; } = "M106 S0";
public string GcodeHeader { get; set; } = "G21|G91|M17|M106 S0";
public string GcodeFooter { get; set; } = "G0 Z100 F150";
public string ApplicationName { get; set; } = "GKone-Slicer";
}
public sealed class JXSControl
{
[JsonPropertyName("total_time")] public float PrintTime { get; set; }
[JsonPropertyName("total_slices")] public uint LayerCount { get; set; }
[JsonPropertyName("used_material")] public float MaterialMl { get; set; }
[JsonPropertyName("action_list")] public List