Browse Source

Fixed filter and added name to jasc parser

flabbet 3 years ago
parent
commit
ae0835b675

+ 4 - 2
PixiEditor/Models/IO/JascPalFile/JascFileParser.cs

@@ -1,4 +1,5 @@
-using System.IO;
+using System;
+using System.IO;
 using System.Threading.Tasks;
 using SkiaSharp;
 
@@ -17,6 +18,7 @@ public class JascFileParser : PaletteFileParser
     {
         string fileContent = await File.ReadAllTextAsync(path);
         string[] lines = fileContent.Split('\n');
+        string name = Path.GetFileNameWithoutExtension(path);
         string fileType = lines[0];
         string magicBytes = lines[1];
         if (ValidateFile(fileType, magicBytes))
@@ -29,7 +31,7 @@ public class JascFileParser : PaletteFileParser
                 colors[i] = new SKColor(byte.Parse(colorData[0]), byte.Parse(colorData[1]), byte.Parse(colorData[2]));
             }
 
-            return new PaletteFileData(colors);
+            return new PaletteFileData(name, colors, Array.Empty<string>());
         }
 
         throw new JascFileException("Invalid JASC-PAL file.");

+ 1 - 1
PixiEditor/Views/UserControls/Palettes/PaletteViewer.xaml.cs

@@ -83,7 +83,7 @@ namespace PixiEditor.Views.UserControls.Palettes
 
                     foreach (var parser in FileParsers)
                     {
-                        string supportedFormats = string.Join(';', parser.SupportedFileExtensions);
+                        string supportedFormats = string.Join(';', parser.SupportedFileExtensions).Replace(".", "*.");
                         filter += $"{parser.FileName} ({supportedFormats})|{supportedFormats}|";
                     }