/// <summary> /// Method to create the instance of a MediaSession. /// </summary> protected override void CreateSessionInstance() { if (Implementation == null) { Implementation = new DvtkSession.MediaSession(); } }
/// <summary> /// Method to create the instance of a session. /// </summary> /// <param name="sessionFileName"> FileName of the MediaSession.</param> protected override void CreateSessionInstance(string sessionFileName) { if (Implementation == null) { Implementation = new DvtkSession.MediaSession(); LoadSession(); } }
/// <summary> /// Load a session from file. /// </summary> /// <param name="fileName">file with extension <c>.SES</c></param> /// <returns> /// Returns a session of type; /// <list type="bullet"> /// <item>Dvtk.Sessions.ScriptSession</item> /// <item>Dvtk.Sessions.EmulatorSession</item> /// <item>Dvtk.Sessions.MediaSession</item> /// </list> /// </returns> /// <remarks> /// The type of session is dynamically determined. /// </remarks> public Session Load(FileName fileName) { if (fileName == null) { throw new ArgumentNullException(); } System.IO.FileInfo fileInfo = new System.IO.FileInfo(fileName); if (!fileInfo.Exists) { throw new ArgumentException(); } // // Transform fileName to fully qualified file name. // fileName = fileInfo.FullName; Session session = null; Wrappers.MBaseSession adaptee = Wrappers.MSessionFactory.Load(fileName); switch (adaptee.SessionType) { case Wrappers.SessionType.SessionTypeEmulator: session = new EmulatorSession(adaptee); break; case Wrappers.SessionType.SessionTypeMedia: session = new MediaSession(adaptee); break; case Wrappers.SessionType.SessionTypeScript: session = new ScriptSession(adaptee); break; case Wrappers.SessionType.SessionTypeUnknown: // Unknown Wrappers.SessionType throw new System.NotImplementedException(); } return(session); }
/// <summary> /// Load a session from file. /// </summary> /// <param name="fileName">file with extension <c>.SES</c></param> /// <returns> /// Returns a session of type; /// <list type="bullet"> /// <item>Dvtk.Sessions.ScriptSession</item> /// <item>Dvtk.Sessions.EmulatorSession</item> /// <item>Dvtk.Sessions.MediaSession</item> /// </list> /// </returns> /// <remarks> /// The type of session is dynamically determined. /// </remarks> public Session Load(FileName fileName) { if (fileName == null) throw new ArgumentNullException(); System.IO.FileInfo fileInfo = new System.IO.FileInfo(fileName); if (!fileInfo.Exists) throw new ArgumentException(); // // Transform fileName to fully qualified file name. // fileName = fileInfo.FullName; Session session = null; Wrappers.MBaseSession adaptee = Wrappers.MSessionFactory.Load(fileName); switch (adaptee.SessionType) { case Wrappers.SessionType.SessionTypeEmulator: session = new EmulatorSession(adaptee); break; case Wrappers.SessionType.SessionTypeMedia: session = new MediaSession(adaptee); break; case Wrappers.SessionType.SessionTypeScript: session = new ScriptSession(adaptee); break; case Wrappers.SessionType.SessionTypeUnknown: // Unknown Wrappers.SessionType throw new System.NotImplementedException(); } return session; }
private void Initialize() { String baseDirectory = System.AppDomain.CurrentDomain.BaseDirectory; // set up the logfile _evsServiceLogger.Filename = baseDirectory + "DvtkDicomEvsLogFile.txt"; // load the fixed configuration filename from the base directory _dvtkDicomEvsConfig.LoadConfig(); // define the log level _evsServiceLogger.LogLevel = _dvtkDicomEvsConfig.EvsLogLevel; try { // check all the required directories / files are present CheckDirectoryPresence(baseDirectory); // create the DVTK media session - using the default session file _mediaSession = MediaSession.LoadFromFile(baseDirectory + _dvtkDicomEvsConfig.ConfigurationSubDirectory + @"\" + "DvtkDicomEvs.ses"); // set the remaining session parameters _mediaSession.ResultsRootDirectory = _dvtkDicomEvsConfig.BaseCacheDirectory + @"\" + _dvtkDicomEvsConfig.MessageSubDirectory + @"\results"; _mediaSession.DefinitionManagement.DefinitionFileRootDirectory = baseDirectory + @"\" + _dvtkDicomEvsConfig.DefinitionSubDirectory; // load the definition files LoadDefinitionFiles(baseDirectory); // set the validation service status _dvtkValidationServiceStatus.Status = "OK"; } catch (System.Exception e) { _evsServiceLogger.LogError("Initialize Exception: {0}", e.Message); _evsServiceLogger.LogError("with Inner Exception: {0}", e.InnerException.Message); throw e; } }