private static IHeaderFileContentVer1 LoadHeaderFile(string path, out string headerFilePath) { try { using IHeaderFile headerFile = HeaderFileFactory.OpenForRead(path); headerFilePath = path; return(headerFile.LoadVer1()); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) { throw new InvalidOperationException($"{Resources.FailedToLoadBrainVisionHeaderFileExceptionMessage} {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); } }