コード例 #1
0
ファイル: Session.cs プロジェクト: ewcasas/DVTK
 /// <summary>
 /// Method for executing a session in an Asynchronous manner.
 /// </summary>
 /// <param name="baseInput">baseInput Object</param>
 public abstract void BeginExecute(BaseInput baseInput );
コード例 #2
0
ファイル: Session.cs プロジェクト: ewcasas/DVTK
 /// <summary>
 /// Method for executing a session in a synchronous manner.
 /// </summary>
 /// <param name="baseInput">baseInput Object </param>
 /// <returns></returns>
 public abstract Result Execute(BaseInput baseInput);
コード例 #3
0
ファイル: ScriptSession.cs プロジェクト: ewcasas/DVTK
        // <summary>
        /// Method for executing a session in an Asynchronous manner.
        /// </summary>
        /// <param name="baseInput">baseInput Object</param>
        /// <param name="cb">Asynchronous CallBack delegate name.,</param>
        public override void BeginExecute(BaseInput baseInput )
        {
            CreateSessionInstance(sessionFileName);
            ScriptInput scriptInput = (ScriptInput)baseInput;
            string extension = Path.GetExtension(scriptInput.FileName);
            // Remove the current results files for this script file.
            // If results files exists that will be removed, ask the user what to do with them.
            ArrayList resultsFilesToRemove = DvtkApplicationLayer.Result.GetAllNamesForSession(this);
            resultsFilesToRemove = DvtkApplicationLayer.Result.GetNamesForScriptFile(scriptInput.FileName, resultsFilesToRemove);
            resultsFilesToRemove = DvtkApplicationLayer.Result.GetNamesForCurrentSessionId(this, resultsFilesToRemove);
            if (backUpResults == true) {
                DvtkApplicationLayer.Result.BackupFiles(this , resultsFilesToRemove);
                DvtkApplicationLayer.Result.Remove(this , resultsFilesToRemove);
            }else{
                DvtkApplicationLayer.Result.Remove( this , resultsFilesToRemove);
            }

            if(
                (string.Compare(extension, ".dss", true) == 0) ||
                (string.Compare(extension, ".ds", true) == 0)
                ) {
                ExecuteDicomScriptInThread(scriptInput);
            } else if (string.Compare(extension, ".vbs", true) == 0) {
                scriptFileName = scriptInput.FileName;
                ExecuteVisualBasicScriptInThread(scriptInput);
            }
            Script script = new Script(this ,scriptFileName );
            script.CreateScriptResult(script);
        }
コード例 #4
0
ファイル: ScriptSession.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// /// <summary>
        /// Method for executing a session in a synchronous manner.
        /// </summary>
        /// <param name="baseInput">baseInput Object (in this case ScriptInput Object) </param>
        /// <returns></returns>
        public override Result Execute(BaseInput baseInput)
        {
            CreateSessionInstance(sessionFileName);
            ScriptInput scriptInput = (ScriptInput)baseInput;
            string scriptFileName = scriptInput.FileName.Replace(".", "_");
            string extension = Path.GetExtension(scriptInput.FileName);
            string tempName = Path.GetFileName(scriptFileName);
            string name = CreateResultFileName(tempName);
            string fileName = Path.GetFileName(scriptInput.FileName);
            string scriptFullFileName = "";
            if (Path.GetDirectoryName(scriptInput.FileName )!= "") {
                scriptFullFileName = scriptInput.FileName;
            }
            else {
                scriptFullFileName = Path.Combine(((DvtkSession.ScriptSession)implementation).DicomScriptRootDirectory ,scriptInput.FileName);
            }
            //scriptInput.Arguments[2] = fileName;
            if (optionVerbose) {
                implementation.ActivityReportEvent +=new Dvtk.Events.ActivityReportEventHandler(ActivityReportEventHandler);
            }
            if(
                (string.Compare(extension, ".dss", true) == 0) ||
                (string.Compare(extension, ".ds", true) == 0)
                ) {
                if ((Path.GetDirectoryName(scriptInput.FileName)!= "") && (Path.GetDirectoryName(scriptInput.FileName)!= null)) {
                    ((DvtkSession.ScriptSession)implementation).DicomScriptRootDirectory = Path.GetDirectoryName(scriptInput.FileName);
                }
                implementation.StartResultsGathering(name);
                result = ((DvtkSession.ScriptSession)implementation).ExecuteScript(
                    fileName,
                    scriptInput.ContinueOnError
                    );
                implementation.EndResultsGathering();

            } else if (string.Compare(extension, ".vbs", true) == 0) {
                VisualBasicScript Vbs = new VisualBasicScript(
                    (DvtkSession.ScriptSession)implementation, Path.GetDirectoryName(scriptFullFileName), Path.GetFileName(scriptFullFileName));

                // An array of an array is needed!! Otherwise it won't work.
                ArrayList arraylist = new ArrayList();
                arraylist.Add(scriptInput.Arguments);
                Vbs.Execute(arraylist.ToArray());
                // Won't work.Vbs.Execute(scriptInput.Arguments);
            }else {
                Console.WriteLine(" Not a valid Script File");
            }
            return CreateResults(name);
        }
コード例 #5
0
ファイル: EmulatorSession.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Method for executing a session in a synchronous manner.
        /// </summary>
        /// <param name="baseInput">baseInput Object (in this case EmulatorInput Object) </param>
        /// <returns></returns>
        public override Result Execute(BaseInput baseInput)
        {
            CreateSessionInstance(SessionFileName);
            string filename ;
            EmulatorInput  emulatorInput = (EmulatorInput)baseInput;
            string resultFileName = "";
            if (OptionVerbose)
            {
                Implementation.ActivityReportEvent +=new Dvtk.Events.ActivityReportEventHandler(ActivityReportEventHandler);
            }

            if(scpEmulator == ScpEmulatorType.Storage)
            {
                filename = "St_Scp_Em";
                ((DvtkSession.EmulatorSession)Implementation).ScpEmulatorType = DvtkData.Results.ScpEmulatorType.Storage;
                resultFileName = CreateResultFileName(filename);
                Implementation.StartResultsGathering(resultFileName);
                Result = ((DvtkSession.EmulatorSession)Implementation).EmulateSCP();
            }
            else if (scpEmulator == ScpEmulatorType.Printing){
                filename = "Pr_Scp_Em";
                ((DvtkSession.EmulatorSession)Implementation).ScpEmulatorType = DvtkData.Results.ScpEmulatorType.Printing;
                resultFileName = CreateResultFileName(filename);
                Implementation.StartResultsGathering(resultFileName);
                Result = ((DvtkSession.EmulatorSession)Implementation).EmulateSCP();
            }
            else
            {
            }

            if(scuEmulator == ScuEmulatorType.Storage)
            {
                string[] theEmulatorFileAsArray =
                    (string[]) emulatorInput.FileNames.ToArray(typeof(string));
                filename = "St_Scu_Em";
                ((DvtkSession.EmulatorSession)Implementation).ScuEmulatorType = DvtkData.Results.ScuEmulatorType.Storage;
                resultFileName = CreateResultFileName(filename);
                Implementation.StartResultsGathering(resultFileName);
                Result = ((DvtkSession.EmulatorSession)Implementation).EmulateStorageSCU(
                    theEmulatorFileAsArray,
                    emulatorInput.ModeOfAssociation,
                    emulatorInput.ValidateOnImport,
                    emulatorInput.DataUnderNewStudy,
                    emulatorInput.NosOfRepetitions
                    );
                Implementation.EndResultsGathering();
            }
            else
            {
            }
            return CreateResults(resultFileName);
        }
コード例 #6
0
ファイル: EmulatorSession.cs プロジェクト: ewcasas/DVTK
 /// <summary>
 /// Method for executing a session in an Asynchronous manner.
 /// </summary>
 /// <param name="baseInput">baseInput Object</param>
 public override void BeginExecute(BaseInput baseInput )
 {
     CreateSessionInstance(SessionFileName);
     string filename ;
     EmulatorInput  emulatorInput = (EmulatorInput)baseInput;
     if(
         (scpEmulator == ScpEmulatorType.Printing) ||
         (scpEmulator == ScpEmulatorType.Storage)
         )
     {
         if(scpEmulator == ScpEmulatorType.Printing )
         {
             filename = "Pr_Scp_Em";
         }
         else
         {
             filename = "St_Scp_Em";
         }
         Implementation.StartResultsGathering(CreateResultFileName(filename));
         // Perform the actual execution of the script.
         AsyncCallback asyncCallback = new AsyncCallback(this.ResultEmulatorScpAsyn);
         ((DvtkSession.EmulatorSession)Implementation).BeginEmulateSCP(asyncCallback);
     }
     // If this is the storage SCU emulator...
     if (scuEmulator == ScuEmulatorType.Storage )
     {
         string[] theEmulatorFileAsArray =
             (string[]) emulatorInput.FileNames.ToArray(typeof(string));
         filename = "St_Scu_Em";
         Implementation.StartResultsGathering(CreateResultFileName(filename));
         AsyncCallback StorageScuAsyncCallback =
             new AsyncCallback(this.ResultEmulatorStorageScuAsyn);
         ((DvtkSession.EmulatorSession)Implementation).BeginEmulateStorageSCU(
             theEmulatorFileAsArray,
             emulatorInput.ModeOfAssociation,
             emulatorInput.ValidateOnImport,
             emulatorInput.DataUnderNewStudy,
             emulatorInput.NosOfRepetitions ,
             StorageScuAsyncCallback
         );
     }
 }
コード例 #7
0
ファイル: MediaSession.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Method for executing a session in a synchronous manner.
        /// </summary>
        /// <param name="baseInput">baseInput Object (in this case mediaInput Object) </param>
        /// <returns></returns>
        public int ExecuteDir(BaseInput baseInput )
        {
            CreateSessionInstance(SessionFileName);
            MediaInput mediaInput = (MediaInput)baseInput;
            long TotalNrOfValidationErrors = 0 ;
            long TotalNrOfGeneralErrors = 0 ;
            long TotalNrOfUserErrors = 0 ;
            long TotalNrOfValidationWarnings = 0;
            long TotalNrOfGeneralWarnings = 0;
            long TotalNrOfUserWarnings = 0;

            string[] mediaFileAsArray =
                (string[])mediaInput.FileNames.ToArray(typeof(string));
            string baseName = "";
            if (OptionVerbose)
            {
                Implementation.ActivityReportEvent +=new Dvtk.Events.ActivityReportEventHandler(ActivityReportEventHandler);
            }
            for (int i =0 ; i < mediaInput.FileNames.Count ; i++)
                {
                string fullFileName = (string)mediaInput.FileNames[i];
                string fileName = Path.GetFileName(fullFileName);
                if (fileName.ToLower() == "dicomdir")
                {
                    baseName = fileName;
                }
                else
                {
                    baseName = fileName + "_DCM";
                    baseName.Replace(".", "_");
                }
                Implementation.StartResultsGathering(CreateResultFileName(baseName));
                string[] mediaFilesToValidate = new string[] {fullFileName};
                Result =
                    ((DvtkSession.MediaSession)Implementation).ValidateMediaFiles(mediaFilesToValidate);
                Implementation.EndResultsGathering();
                TotalNrOfValidationErrors = TotalNrOfValidationErrors + Implementation.CountingTarget.TotalNrOfValidationErrors ;
                TotalNrOfUserErrors = TotalNrOfValidationErrors + Implementation.CountingTarget.TotalNrOfUserErrors ;
                TotalNrOfGeneralErrors = TotalNrOfValidationErrors + Implementation.CountingTarget.TotalNrOfGeneralErrors ;
                TotalNrOfValidationWarnings = TotalNrOfValidationWarnings + Implementation.CountingTarget.TotalNrOfValidationWarnings ;
                TotalNrOfGeneralWarnings = TotalNrOfValidationErrors + Implementation.CountingTarget.TotalNrOfGeneralWarnings ;
                TotalNrOfUserWarnings = TotalNrOfUserWarnings + Implementation.CountingTarget.TotalNrOfUserWarnings ;
            }
            DisplayResultCounters(TotalNrOfValidationErrors , TotalNrOfGeneralErrors , TotalNrOfUserErrors ,TotalNrOfValidationWarnings , TotalNrOfGeneralWarnings ,TotalNrOfUserWarnings) ;
            return DetermineExitCode(TotalNrOfValidationErrors , TotalNrOfGeneralErrors , TotalNrOfUserErrors ,TotalNrOfValidationWarnings , TotalNrOfGeneralWarnings ,TotalNrOfUserWarnings) ;
        }
コード例 #8
0
ファイル: MediaSession.cs プロジェクト: ewcasas/DVTK
 /// <summary>
 /// Method for executing a session in a synchronous manner.
 /// </summary>
 /// <param name="baseInput">baseInput Object (in this case mediaInput Object) </param>
 /// <returns></returns>
 public override Result Execute(BaseInput baseInput )
 {
     CreateSessionInstance(SessionFileName);
     MediaInput mediaInput = (MediaInput)baseInput;
     string baseName = "";
     string[] mediaFileAsArray =
         (string[])mediaInput.FileNames.ToArray(typeof(string));
     if (OptionVerbose)
     {
         Implementation.ActivityReportEvent +=new Dvtk.Events.ActivityReportEventHandler(ActivityReportEventHandler);
     }
     string fileName = Path.GetFileName((string)mediaInput.FileNames[0]);
     if (fileName.ToLower() == "dicomdir")
     {
         baseName = fileName;
     }
     else
     {
         baseName = fileName + "_DCM";
         baseName.Replace(".", "_");
     }
     string resultName = CreateResultFileName(baseName);
     Implementation.StartResultsGathering(resultName);
     Result =
         ((DvtkSession.MediaSession)Implementation).ValidateMediaFiles(mediaFileAsArray);
     Implementation.EndResultsGathering();
     return CreateResults(resultName);
 }
コード例 #9
0
ファイル: MediaSession.cs プロジェクト: ewcasas/DVTK
 /// <summary>
 /// Method for executing a session in an Asynchronous manner.
 /// </summary>
 /// <param name="baseInput">baseInput Object</param>
 public override void BeginExecute(BaseInput baseInput )
 {
     CreateSessionInstance(SessionFileName);
     MediaInput mediaInput = (MediaInput)baseInput;
     string[] mediaFileAsArray =
         (string[])mediaInput.FileNames.ToArray(typeof(string));
     foreach(string fileName in mediaFileAsArray)
     {
         mediaFilesToBeValidated.Enqueue(fileName);
     }
     ValidateMediaFiles();
 }