mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
c800f887d2
- **Core:** - (Add) Getter `FileFormat.DisplayPixelCount` Gets the display total number of pixels (ResolutionX * ResolutionY) - (Add) Getter `Layer.NonZeroPixelRatio` Gets the ratio between non zero pixels and display number of pixels - (Add) Getter `Layer.NonZeroPixelPercentage` Gets the percentage of non zero pixels relative to the display number of pixels - (Add) Getter `Layer.PreviousHeightLayer()` Gets the previous layer with a different height from the current, returns null if no previous layer - (Add) Getter `Layer.NextHeightLayer()` Gets the next layer with a different height from the current, returns null if no next layer - (Add) Method `Layer.GetPreviousLayerWithAtLeastPixelCountOf()` Gets the previous layer matching at least a number of pixels, returns null if no previous layer - (Add) Method `Layer.GetNextLayerWithAtLeastPixelCountOf()` Gets the next layer matching at least a number of pixels, returns null if no next layer - (Add) Method `Operation.GetRoiOrVolumeBounds()` returns the selected ROI rectangle or model volume bounds rectangle - (Add) Documentation around `Operation` methods - (Fix) Open files in partial mode when the resolution is not defined would cause a `NullPointerException` (#474) - **Suggestion: Wait time before cure** - (Add) Proportional maximum time change: Sets the maximum allowed time difference relative to the previous layer (#471) - (Add) Proportional mass get modes: Previous, Average and Maximum relative to a defined height (#471) - (Change) Proportional set type sets fallback time to the first layer - (Fix) Proportional set type was taking current layer mass instead of looking to the previous cured layer (#471) - **Tools:** - **Edit print parameters:** - (Change) Incorporate the unit label into the numeric input box - (Change) Allow TSMC speeds to be 0 as minimum value (#472) - (Fix) PCB Exposure: The thumbnail has random noise around the image - **Settings:** - (Add) Tools: "Always prompt for confirmation before execute the operation" - (Fix) Changing layer compression method when no file is loaded would cause a error - **UI:** - (Add) Holding Shift key while drag and drop a .uvtop file will try to execute the operation without showing the window or prompt - (Add) Drag and drop a .cs or .csx file into UVtools will load and show the scripting dialog with the file selected - (Add) Errors that crash application will now show an report window with the crash information and able to fast report them - (Add) "Version" key and value on registry to tell the current installed version (Windows MSI only) - (Upgrade) AvaloniaUI from 0.10.13 to 0.10.14 - (Upgrade) .NET from 6.0.4 to 6.0.5
199 lines
7.0 KiB
C#
199 lines
7.0 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using Avalonia;
|
|
using Avalonia.Markup.Xaml;
|
|
using Emgu.CV;
|
|
using UVtools.Core;
|
|
using UVtools.Core.SystemOS;
|
|
using UVtools.WPF.Controls;
|
|
|
|
namespace UVtools.WPF.Windows;
|
|
|
|
public class AboutWindow : WindowEx
|
|
{
|
|
public static string OpenCVBuildInformation
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return CvInvoke.BuildInformation;
|
|
}
|
|
catch
|
|
{
|
|
// ignored
|
|
}
|
|
|
|
return "Error: Unable to load the library.";
|
|
}
|
|
}
|
|
|
|
public static string LoadedAssemblies
|
|
{
|
|
get
|
|
{
|
|
var sb = new StringBuilder();
|
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
for (var i = 0; i < assemblies.Length; i++)
|
|
{
|
|
var assembly = assemblies[i].GetName();
|
|
sb.AppendLine($"{(i + 1).ToString().PadLeft(assemblies.Length.ToString().Length, '0')}: {assembly.Name}, Version={assembly.Version}");
|
|
}
|
|
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
|
|
public static string OSDescription => $"{RuntimeInformation.OSDescription} {RuntimeInformation.OSArchitecture}";
|
|
|
|
public static string RuntimeDescription => RuntimeInformation.RuntimeIdentifier;
|
|
|
|
public static string FrameworkDescription => RuntimeInformation.FrameworkDescription;
|
|
public static string AvaloniaUIDescription => typeof(AvaloniaObject).Assembly.GetName().Version!.ToString(3);
|
|
|
|
public static string OpenCVVersion
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
var match = Regex.Match(CvInvoke.BuildInformation, @"(?:Version control:\s*)(\S*)");
|
|
if (!match.Success) return "Not found!";
|
|
var index = match.Groups[1].Value.LastIndexOf('-');
|
|
if (index < 0) return match.Groups[1].Value;
|
|
return match.Groups[1].Value[..index];
|
|
}
|
|
catch
|
|
{
|
|
// ignored
|
|
}
|
|
|
|
return "???";
|
|
}
|
|
}
|
|
|
|
public static string ProcessorName => SystemAware.GetProcessorName();
|
|
|
|
public static int ProcessorCount => Environment.ProcessorCount;
|
|
|
|
public static string MemoryRAMDescription
|
|
{
|
|
get
|
|
{
|
|
var memory = SystemAware.GetMemoryStatus();
|
|
if (memory.ullTotalPhys == 0)
|
|
{
|
|
return "Unknown";
|
|
}
|
|
|
|
var factor = Math.Pow(1024, 3);
|
|
return $"{(memory.ullTotalPhys-memory.ullAvailPhys) / factor:F2} / {memory.ullTotalPhys / factor:F2} GB";
|
|
}
|
|
}
|
|
|
|
public int ScreenCount => Screens.ScreenCount;
|
|
//public string ScreenResolution => $"{Screens.Primary.Bounds.Width} x {Screens.Primary.Bounds.Height} @ {Screens.Primary.PixelDensity*100}%";
|
|
//public string WorkingArea => $"{Screens.Primary.WorkingArea.Width} x {Screens.Primary.WorkingArea.Height}";
|
|
//public string RealWorkingArea => $"{App.MaxWindowSize.Width} x {App.MaxWindowSize.Height}";
|
|
|
|
public string ScreensDescription
|
|
{
|
|
get
|
|
{
|
|
var result = new StringBuilder();
|
|
for (var i = 0; i < Screens.All.Count; i++)
|
|
{
|
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
var onScreen = Screens.ScreenFromVisual(App.MainWindow is not null ? App.MainWindow : this);
|
|
var screen = Screens.All[i];
|
|
result.AppendLine($"{i+1}: {screen.Bounds.Width} x {screen.Bounds.Height} @ {screen.PixelDensity * 100}%" +
|
|
(screen.Primary ? " (Primary)" : string.Empty) +
|
|
(onScreen == screen ? " (On this)" : string.Empty)
|
|
);
|
|
result.AppendLine($" WA: {screen.WorkingArea.Width} x {screen.WorkingArea.Height} UA: {Math.Round(screen.WorkingArea.Width / screen.PixelDensity)} x {Math.Round(screen.WorkingArea.Height / screen.PixelDensity)}");
|
|
}
|
|
return result.ToString().TrimEnd();
|
|
}
|
|
}
|
|
|
|
public AboutWindow()
|
|
{
|
|
InitializeComponent();
|
|
DataContext = this;
|
|
Title = $"About {About.SoftwareWithVersion}";
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
|
|
public void OpenLicense() => SystemAware.OpenBrowser(About.LicenseUrl);
|
|
|
|
public static string GetEssentialInformationStatic()
|
|
{
|
|
var message = new StringBuilder();
|
|
message.AppendLine($"{About.SoftwareWithVersionArch}");
|
|
message.AppendLine($"Operative system: {OSDescription}");
|
|
message.AppendLine($"Processor: {ProcessorName}");
|
|
message.AppendLine($"Processor cores: {ProcessorCount}");
|
|
message.AppendLine($"Memory RAM: {MemoryRAMDescription}");
|
|
message.AppendLine($"Runtime: {RuntimeDescription}");
|
|
message.AppendLine($"Framework: {FrameworkDescription}");
|
|
message.AppendLine($"AvaloniaUI: {AvaloniaUIDescription}");
|
|
message.AppendLine($"OpenCV: {OpenCVVersion}");
|
|
message.AppendLine();
|
|
message.AppendLine($"Path: {App.ApplicationPath}");
|
|
message.AppendLine($"Executable: {App.AppExecutable}");
|
|
return message.ToString();
|
|
}
|
|
|
|
private string GetEssentialInformation()
|
|
{
|
|
var message = new StringBuilder();
|
|
message.AppendLine($"{About.SoftwareWithVersionArch}");
|
|
message.AppendLine($"Operative system: {OSDescription}");
|
|
message.AppendLine($"Processor: {ProcessorName}");
|
|
message.AppendLine($"Processor cores: {ProcessorCount}");
|
|
message.AppendLine($"Memory RAM: {MemoryRAMDescription}");
|
|
message.AppendLine($"Runtime: {RuntimeDescription}");
|
|
message.AppendLine($"Framework: {FrameworkDescription}");
|
|
message.AppendLine($"AvaloniaUI: {AvaloniaUIDescription}");
|
|
message.AppendLine($"OpenCV: {OpenCVVersion}");
|
|
message.AppendLine();
|
|
message.AppendLine("Sreens, resolution, working area, usable area:");
|
|
message.AppendLine(ScreensDescription);
|
|
message.AppendLine();
|
|
message.AppendLine($"Path: {App.ApplicationPath}");
|
|
message.AppendLine($"Executable: {App.AppExecutable}");
|
|
return message.ToString();
|
|
}
|
|
|
|
public void CopyEssentialInformation()
|
|
{
|
|
Application.Current?.Clipboard?.SetTextAsync(GetEssentialInformation());
|
|
}
|
|
|
|
|
|
public void CopyOpenCVInformationToClipboard()
|
|
{
|
|
Application.Current?.Clipboard?.SetTextAsync(CvInvoke.BuildInformation);
|
|
}
|
|
|
|
public void CopyLoadedAssembliesToClipboard()
|
|
{
|
|
Application.Current?.Clipboard?.SetTextAsync(LoadedAssemblies);
|
|
}
|
|
|
|
public async void CopyInformationToClipboard()
|
|
{
|
|
var message = new StringBuilder();
|
|
message.Append(GetEssentialInformation());
|
|
message.AppendLine(CvInvoke.BuildInformation);
|
|
message.AppendLine("Loaded Assemblies:");
|
|
message.AppendLine(LoadedAssemblies);
|
|
await Application.Current?.Clipboard?.SetTextAsync(message.ToString())!;
|
|
}
|
|
} |