2
0
flabbet 3 жил өмнө
parent
commit
23b943c8c8

+ 2 - 2
PixiEditor/PixiEditor.csproj

@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
 
 	<PropertyGroup>
 		<OutputType>WinExe</OutputType>
@@ -211,7 +211,7 @@
 		<PackageReference Include="PixiEditor.ColorPicker" Version="3.3.1" />
 		<PackageReference Include="PixiEditor.Parser" Version="2.1.0.3" />
 		<PackageReference Include="PixiEditor.Parser.Skia" Version="2.1.0" />
-		<PackageReference Include="SkiaSharp" Version="2.80.3" />
+		<PackageReference Include="SkiaSharp" Version="2.88.0" />
 		<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
 		<PackageReference Include="WpfAnimatedGif" Version="2.0.2" />
 		<PackageReference Include="WriteableBitmapEx">

+ 13 - 3
PixiEditor/Views/Dialogs/PalettesBrowser.xaml.cs

@@ -1,4 +1,4 @@
-using PixiEditor.Models.DataHolders;
+using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.DataHolders.Palettes;
 using PixiEditor.Models.DataProviders;
 using PixiEditor.Models.Enums;
@@ -159,6 +159,9 @@ namespace PixiEditor.Views.Dialogs
 
         private LocalPalettesFetcher _localPalettesFetcher;
 
+        private string[] _stopItTexts = new[] { "That's enough. Tidy up your file names.", 
+            "Can you stop copying these names please?", "No, really, stop it.", "Don't you have anything better to do?" };
+
         public PalettesBrowser()
         {
             InitializeComponent();
@@ -472,6 +475,15 @@ namespace PixiEditor.Views.Dialogs
 
             string oldPath = Path.Join(LocalPalettesFetcher.PathToPalettesFolder, oldFileName);
 
+            string finalNewName = $"{Palette.ReplaceInvalidChars(e.NewText)}.pal";
+            string newPath = Path.Join(LocalPalettesFetcher.PathToPalettesFolder, LocalPalettesFetcher.GetNonExistingName(finalNewName, true));
+
+            if (newPath.Length > 250)
+            {
+                NoticeDialog.Show(_stopItTexts[Random.Shared.Next(_stopItTexts.Length - 1)], "The name is too long.");
+                return;
+            }
+
             if (!File.Exists(oldPath))
             {
                 item.Palette.FileName = oldFileName;
@@ -480,8 +492,6 @@ namespace PixiEditor.Views.Dialogs
                 return;
             }
 
-            string finalNewName = $"{Palette.ReplaceInvalidChars(e.NewText)}.pal";
-            string newPath = Path.Join(LocalPalettesFetcher.PathToPalettesFolder, LocalPalettesFetcher.GetNonExistingName(finalNewName, true));
 
             File.Move(oldPath, newPath);