private static IMarkerFileContentVer1 LoadMarkerFile(string path, out string markerFilePath) { try { using IMarkerFile markerFile = MarkerFileFactory.OpenForRead(path); markerFilePath = path; return(markerFile.LoadVer1()); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) { throw new InvalidOperationException($"{Resources.FailedToLoadBrainVisionMarkerFileExceptionMessage} {e.Message}", e); } #pragma warning restore CA1031 // Do not catch general exception types }
public void Save(string brainVisionHeaderFilePath) { string headerFullPath = Path.GetFullPath(brainVisionHeaderFilePath); using (IHeaderFile headerFile = HeaderFileFactory.OpenForReadWrite(headerFullPath)) { headerFile.SaveVer1(HeaderFileContent); } if (MarkerFileContent != null) { string markerFullPath = GetMarkerFileFullPath(headerFullPath, HeaderFileContent.MarkerFile !); using IMarkerFile markerFile = MarkerFileFactory.OpenForReadWrite(markerFullPath); markerFile.SaveVer1(MarkerFileContent); } }