diff --git a/OpenKh.Tools.Kh2SystemEditor/ViewModels/SystemEditorViewModel.cs b/OpenKh.Tools.Kh2SystemEditor/ViewModels/SystemEditorViewModel.cs index d01c0d02d..4d32b06ed 100644 --- a/OpenKh.Tools.Kh2SystemEditor/ViewModels/SystemEditorViewModel.cs +++ b/OpenKh.Tools.Kh2SystemEditor/ViewModels/SystemEditorViewModel.cs @@ -25,7 +25,7 @@ public class SystemEditorViewModel : BaseNotifyPropertyChanged private static readonly List IdxFilter = FileDialogFilterComposer.Compose() .AddExtensions("KH2.IDX", "idx").AddAllFiles(); private static readonly List MsgFilter = FileDialogFilterComposer.Compose() - .AddExtensions("sys.msg", "msg", "bin").AddAllFiles(); + .AddExtensions("sys.bar", "bar", "msg", "bin").AddAllFiles(); private Window Window => Application.Current.Windows.OfType().FirstOrDefault(x => x.IsActive); private string _fileName; @@ -177,6 +177,14 @@ private void OpenIdx(string fileName) => File.OpenRead(fileName).Using(stream => var imgFileName = $"{Path.GetFileNameWithoutExtension(fileName)}.img"; var imgFilePath = Path.Combine(Path.GetDirectoryName(fileName), imgFileName); + + if (!File.Exists(imgFilePath)) + { + MessageBox.Show($"Unable to find {imgFileName} in the same directory of the IDX loaded.", + "Error", MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + File.OpenRead(imgFilePath).Using(imgStream => { var img = new Img(imgStream, Idx.Read(stream), false);