/// <summary> /// <see cref="IMediaValidator.ValidateMediaFiles(System.String , /// MediaFileContentType , /// System.String , /// System.String , /// System.String )"/> /// </summary> public System.Boolean ValidateMediaFiles(System.String mediaFileName, MediaFileContentType fileContentType, System.String sopClassUid, System.String sopInstanceUid, System.String transferSyntaxUid) { bool success = false; try { // Wait until it is safe to enter. validateMediaFilesMutex.WaitOne(); // // Check argument mediaFileName // if (mediaFileName == null) throw new System.ArgumentNullException("mediaFileName"); System.IO.FileInfo fileInfo = new System.IO.FileInfo(mediaFileName); if (!fileInfo.Exists) throw new System.ArgumentException(); // // Begin validation // success = this.m_adaptee.BeginMediaValidation(); try { // Set the media content type Wrappers.FileContentType wrapperFileContentType = Wrappers.FileContentType.FileContentTypeMediaFile; switch (fileContentType) { case MediaFileContentType.MediaFile: wrapperFileContentType = Wrappers.FileContentType.FileContentTypeMediaFile; break; case MediaFileContentType.CommandSet: wrapperFileContentType = Wrappers.FileContentType.FileContentTypeCommandSet; break; case MediaFileContentType.DataSet: wrapperFileContentType = Wrappers.FileContentType.FileContentTypeDataSet; break; default: break; } // // Validate the media file. // success &= this.m_adaptee.ValidateMediaFile(mediaFileName, wrapperFileContentType, sopClassUid, sopInstanceUid, transferSyntaxUid); } catch (System.Exception e) { String msg = String.Format("System.Exception in MediaSession.cs: {0}", e.Message); this.WriteError(msg); } success &= this.m_adaptee.EndMediaValidation(); } catch (System.Exception e) { String msg = String.Format("System.Exception in MediaSession.cs: {0}", e.Message); this.WriteError(msg); } finally { // Release the Mutex. validateMediaFilesMutex.ReleaseMutex(); } return success; }
/// <summary> /// <see cref="IMediaValidator.ValidateMediaFiles(System.String , /// MediaFileContentType , /// System.String , /// System.String , /// System.String )"/> /// </summary> public System.Boolean ValidateMediaFiles(System.String mediaFileName, MediaFileContentType fileContentType, System.String sopClassUid, System.String sopInstanceUid, System.String transferSyntaxUid) { bool success = false; try { // Wait until it is safe to enter. validateMediaFilesMutex.WaitOne(); // // Check argument mediaFileName // if (mediaFileName == null) { throw new System.ArgumentNullException("mediaFileName"); } System.IO.FileInfo fileInfo = new System.IO.FileInfo(mediaFileName); if (!fileInfo.Exists) { throw new System.ArgumentException(); } // // Begin validation // success = this.m_adaptee.BeginMediaValidation(); try { // Set the media content type Wrappers.FileContentType wrapperFileContentType = Wrappers.FileContentType.FileContentTypeMediaFile; switch (fileContentType) { case MediaFileContentType.MediaFile: wrapperFileContentType = Wrappers.FileContentType.FileContentTypeMediaFile; break; case MediaFileContentType.CommandSet: wrapperFileContentType = Wrappers.FileContentType.FileContentTypeCommandSet; break; case MediaFileContentType.DataSet: wrapperFileContentType = Wrappers.FileContentType.FileContentTypeDataSet; break; default: break; } // // Validate the media file. // success &= this.m_adaptee.ValidateMediaFile(mediaFileName, wrapperFileContentType, sopClassUid, sopInstanceUid, transferSyntaxUid); } catch (System.Exception e) { String msg = String.Format("System.Exception in MediaSession.cs: {0}", e.Message); this.WriteError(msg); } success &= this.m_adaptee.EndMediaValidation(); } catch (System.Exception e) { String msg = String.Format("System.Exception in MediaSession.cs: {0}", e.Message); this.WriteError(msg); } finally { // Release the Mutex. validateMediaFilesMutex.ReleaseMutex(); } return(success); }