mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-11 19:12:31 +02:00
c94b5fb7f1
- **Windows MSI:** - (Fix) Use the folder programs x64 instead of x86 for new installation path (#254) - (Improvement) Mark program and all files as x64 - (Improvement) Add UVtools logo to side panel and top banner - (Improvement) Add open-source logo to side panel - (Improvement) License text aligment and bold title - (Add) File format: OSLA / ODLP / OMSLA - Universal binary file format - (Add) Calibration - Lift height: Generates test models with various strategies and increments to measure the optimal lift height or peel forces for layers given the printed area - (Add) Layer Actions - Export layers to images (PNG, JPG/JPEG, JP2, TIF/TIFF, BMP, PBM, PGM, SR/RAS and SVG) - (Add) About box: License with link - (Add) Include a copy of the LICENSE on the packages - (Improvement) File formats: Implement `Wait time before cure` properties on file formats with light-off delay, when used it will calculate the right light-off delay with that extra time and set to `LightOffDelay` property - (Improvement) Change all date times to Utc instead of local - (Fix) Tool - Flip: 'Both' were not working correctly - (Fix) Linux: File 'UVtools.sh' with incorrect line break type, changed to \n (#258)
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
/*
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE
|
|
* Version 3, 19 November 2007
|
|
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using UVtools.Core.Objects;
|
|
|
|
namespace UVtools.Core.Extensions
|
|
{
|
|
public static class EnumExtensions
|
|
{
|
|
public static string GetDescription(this Enum value)
|
|
{
|
|
var attributes = value.GetType().GetField(value.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
|
|
if (attributes.Any())
|
|
return (attributes.First() as DescriptionAttribute)?.Description;
|
|
|
|
// If no description is found, the least we can do is replace underscores with spaces
|
|
// You can add your own custom default formatting logic here
|
|
var ti = CultureInfo.CurrentCulture.TextInfo;
|
|
return ti.ToTitleCase(ti.ToLower(value.ToString().Replace("_", " ")));
|
|
}
|
|
|
|
public static IEnumerable<ValueDescription> GetAllValuesAndDescriptions(Type t)
|
|
{
|
|
if (!t.IsEnum)
|
|
throw new ArgumentException($"{nameof(t)} must be an enum type");
|
|
|
|
return Enum.GetValues(t).Cast<Enum>().OrderBy(e => e).Select(e => new ValueDescription(e, e.GetDescription())).ToList();
|
|
}
|
|
}
|
|
}
|