Files
UVtools/UVtools.Core/Extensions/PathExtensions.cs
T
Tiago Conceição 6d6be66ced v2.9.2
- (Upgrade) AvaloniaUI from 0.10 to 0.10.2
- (Remove) Unused assemblies
- **Issues**
  - Improve the performance when loading big lists of issues into the DataGrid
  - Auto refresh issues on the vertical highlight tracker once cath a modification on the Issues list
- **Layer preview - Difference:**
   - Layer difference will now only check the pixels inside the union of previous, current and next layer bounding rectangle, increasing the performance and speed
   - Previous and next layer pixels if both exists was not showing with the configured color and using the next layer color instead
   - Respect Anti-Aliasing pixels and fade colors accordingly
   - Unlock the possiblity of using the layer difference on first and last layer
   - Add a option to show similar pixels instead of the difference
   - Change previous default color from (255, 0, 255) to (81, 131, 82) for better depth preception
   - Change next default color from (0, 255, 255) to (81, 249, 252) for better depth preception
   - Change previous & next default color from (255, 0, 0) to (246, 240, 216) for better depth preception
- **(Fix) Pixel editor:**
   - Modification was append instead of prepend on the list
   - Modification was not updating the index number on the list
- (Fix) PrusaSlicer printer: Bene4 Mono screen, bed and height size
2021-04-30 18:20:58 +01:00

41 lines
1.4 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.IO;
namespace UVtools.Core.Extensions
{
public static class PathExtensions
{
public static string GetFileNameStripAllExtensions(string path)
{
path = Path.GetFileName(path);
if(string.IsNullOrEmpty(path)) return string.Empty;
var splitPath = path.Split('.', 2, StringSplitOptions.TrimEntries);
return splitPath.Length == 0 ? string.Empty : splitPath[0];
}
public static string GetFileNameStripExtensions(string path, List<string> extensions, out string strippedExtension)
{
strippedExtension = string.Empty;
path = Path.GetFileName(path);
if (string.IsNullOrEmpty(path)) return string.Empty;
foreach (var extension in extensions)
{
var dotExtension = $".{extension}";
if (!path.EndsWith(dotExtension)) continue;
strippedExtension = extension;
return path.Remove(path.Length - dotExtension.Length);
}
return path;
}
}
}