From 30e91bfff13555279e6fd69dd0de82961936a1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benito=20Palacios=20S=C3=A1nchez?= Date: Sat, 21 Mar 2015 19:26:51 +0100 Subject: [PATCH] Fix palette importer --- Ekona/Images/PaletteControl.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Ekona/Images/PaletteControl.cs b/Ekona/Images/PaletteControl.cs index 22a91e42..1fa85823 100644 --- a/Ekona/Images/PaletteControl.cs +++ b/Ekona/Images/PaletteControl.cs @@ -220,7 +220,7 @@ private void btnExport_Click(object sender, EventArgs e) } private void btnImport_Click(object sender, EventArgs e) { - SaveFileDialog o = new SaveFileDialog(); + OpenFileDialog o = new OpenFileDialog(); o.CheckFileExists = true; o.Filter = "All supported formats|*.pal;*.aco;*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif;*.ico;*.icon|" + "Windows Palette (*.pal)|*.pal|" + @@ -230,6 +230,14 @@ private void btnImport_Click(object sender, EventArgs e) return; string ext = Path.GetExtension(o.FileName).ToLower(); + if (string.IsNullOrEmpty(ext) || ext.Length == 0) { + MessageBox.Show("File without extension... Aborting"); + return; + } + + if (ext.Contains(".")) + ext = ext.Substring(ext.LastIndexOf(".") + 1); + Console.WriteLine("File extension:" + ext); PaletteBase newpal; if (ext == "pal")