private void HandleNewFile(string fileName) { EdataFileType type; using (var fs = new FileStream(fileName, FileMode.Open)) { var headerBuffer = new byte[12]; fs.Read(headerBuffer, 0, headerBuffer.Length); type = EdataManager.GetFileTypeFromHeaderData(headerBuffer); if (type == EdataFileType.Ndfbin) { var buffer = new byte[fs.Length]; fs.Seek(0, SeekOrigin.Begin); fs.Read(buffer, 0, buffer.Length); var detailsVm = new NdfEditorMainViewModel(buffer); var view = new NdfbinView { DataContext = detailsVm }; view.Show(); } } if (type == EdataFileType.Package) { AddFile(fileName); } }