Fixed weird exception with the replace file dialog

This commit is contained in:
MattNL
2022-11-19 19:40:05 -05:00
parent 03bde4abde
commit 08c1e95baa

View File

@@ -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));