Ejemplo n.º 1
0
        private static void ExecuteSCP()
        {
            EmulatorSession emulatorSession = new EmulatorSession();
            emulatorSession.OptionVerbose = _OptionVerbose;

            string sessionFileName = (string)_NonOptions[0];
            if(sessionFileName == "")
            {
                Console.WriteLine("Warning : Provide proper arguments.\n");
                return;
            }
            else
            {
                emulatorSession.SessionFileName = sessionFileName;
            }

            SCPEmulator = emulatorSession;

            emulatorSession.scpEmulatorType = DvtkApplicationLayer.EmulatorSession.ScpEmulatorType.Storage;
            if (_OptionEmulatorPrintSCP) {
                emulatorSession.scpEmulatorType = DvtkApplicationLayer.EmulatorSession.ScpEmulatorType.Printing;
            }
            EmulatorInput emulatorInput = new EmulatorInput();
            emulatorSession.Execute(emulatorInput);
        }
Ejemplo n.º 2
0
        private static void EmulateStorageSCU()
        {
            EmulatorSession emulatorSession = new EmulatorSession();
            emulatorSession.OptionVerbose = _OptionVerbose;
            string sessionFileName = (string)_NonOptions[0];
            FileInfo sessionFileInfo = null;
            if(sessionFileName == "")
            {
                Console.WriteLine("Warning : Provide proper arguments.\n");
                return;
            }
            else
            {
                sessionFileInfo = new FileInfo(sessionFileName);
            }

            if (!sessionFileInfo.Exists){
                Console.WriteLine("Error : Session File does not exists.\n");
            }else {
                emulatorSession.SessionFileName = sessionFileName;

                emulatorSession.scuEmulatorType = DvtkApplicationLayer.EmulatorSession.ScuEmulatorType.Storage;
                EmulatorInput emulatorInput = new EmulatorInput();
                //
                // Determine all media file names by parsing the string.
                //
                string mediaFiles = (string)_NonOptions[1];
                string[] mediaFileNames = null;
                if(mediaFiles != "")
                {
                    mediaFileNames = mediaFiles.Split(new char[] {','});
                }
                else
                {
                    Console.WriteLine("Warning : Provide proper arguments.\n");
                    return;
                }

                //
                // Trim whitespaces from both ends of the Media File Names
                //
                for (int i = 0; i < mediaFileNames.Length; i++){
                    emulatorInput.FileNames.Add(mediaFileNames[i].Trim());}
                //
                // Determine Association option.
                //
                if(_NonOptions.Count == 3) {
                    emulatorInput.ModeOfAssociation = (bool)_NonOptions[2];
                }
                //
                // Determine Validate on import option.
                //
                if(_NonOptions.Count == 4) {
                    emulatorInput.ValidateOnImport = (bool)_NonOptions[3];
                }
                //
                // Determine send data under new study option.
                //
                if(_NonOptions.Count == 5) {
                    emulatorInput.DataUnderNewStudy = (bool)_NonOptions[4];
                }
                //
                // Determine Nr. of Repetiitons.
                //
                if(_NonOptions.Count == 6) {
                    emulatorInput.NosOfRepetitions = (UInt16)_NonOptions[5];
                }
                emulatorSession.Execute(emulatorInput);
                if (emulatorSession.Result) {
                    Console.WriteLine("> Started Storage SCU Emulator successfully.");
                    DisplayResultCounters(emulatorSession);
                }
                else {
                    Console.WriteLine("> Error in starting Storage SCU Emulator.");
                }
                Console.WriteLine("> Sent the Data through Storage SCU Emulator successfully.");
            }
        }