Skip to content

Commit

Permalink
Merge pull request #76 from Xeeynamo/hotfix/issue-75
Browse files Browse the repository at this point in the history
Fix various small issues with KH2 System Editor
  • Loading branch information
Rikux3 authored Feb 7, 2020
2 parents f40b3e8 + 4981e92 commit 8c13d9c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class SystemEditorViewModel : BaseNotifyPropertyChanged
private static readonly List<FileDialogFilter> IdxFilter = FileDialogFilterComposer.Compose()
.AddExtensions("KH2.IDX", "idx").AddAllFiles();
private static readonly List<FileDialogFilter> MsgFilter = FileDialogFilterComposer.Compose()
.AddExtensions("sys.msg", "msg", "bin").AddAllFiles();
.AddExtensions("sys.bar", "bar", "msg", "bin").AddAllFiles();

private Window Window => Application.Current.Windows.OfType<Window>().FirstOrDefault(x => x.IsActive);
private string _fileName;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8c13d9c

Please sign in to comment.