From 08c1e95baafc2ef07463c10f0cca4cedcc4ff819 Mon Sep 17 00:00:00 2001 From: MattNL Date: Sat, 19 Nov 2022 19:40:05 -0500 Subject: [PATCH] Fixed weird exception with the replace file dialog --- PCK-Studio/MainForm.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index 29b68aec..9f477ccf 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -591,7 +591,8 @@ namespace PckStudio if (treeViewMain.SelectedNode.Tag is PCKFile.FileData file) { using var ofd = new OpenFileDialog(); - ofd.Filter = Path.GetExtension(file.filepath); + // Suddenly, and randomly, this started throwing an exception because it wasn't formatted correctly? So now it's formatted correctly and now displays the file type name in the dialog. + ofd.Filter = file.filetype.ToString() + " (*" + Path.GetExtension(file.filepath) + ")|*" + Path.GetExtension(file.filepath); if (ofd.ShowDialog() == DialogResult.OK) { file.SetData(File.ReadAllBytes(ofd.FileName));