Esempio n. 1
0
 private void ExecuteDicomScriptInThread( ScriptInput scriptInput)
 {
     string scriptFileName = scriptInput.FileName.Replace(".", "_");
     string resultFileName = CreateResultFileName(scriptFileName);
     implementation.StartResultsGathering(resultFileName);
     AsyncCallback executeScriptAsyncCallback =
         new AsyncCallback(this.ResultsFromScriptAsyn);
     ((DvtkSession.ScriptSession)implementation).BeginExecuteScript(
         scriptInput.FileName,
         false,
         executeScriptAsyncCallback
         );
 }
Esempio n. 2
0
 private void ExecuteVisualBasicScriptInThread(ScriptInput scriptInput)
 {
     scriptThread = new Thread (new ThreadStart(ExecuteVisualBasicScript));
     scriptThread.Start();
 }
Esempio n. 3
0
        private static void ExecuteScript()
        {
            ScriptSession scriptSession = new ScriptSession();
            scriptSession.SessionFileName = (string)_NonOptions[0];
            scriptSession.OptionVerbose = _OptionVerbose;

            ScriptInput scriptInput = new ScriptInput();
            scriptInput.FileName = (string)_NonOptions[1];
            scriptInput.Arguments = _MainArgs;

            if((scriptSession.SessionFileName == "") || (scriptSession.SessionFileName == ""))
            {
                Console.WriteLine("Warning : Provide proper arguments.\n");
                return;
            }

            string scriptFullFileName = "";
            if (Path.GetDirectoryName(scriptInput.FileName )!= "") {
                    scriptFullFileName = scriptInput.FileName;
                 }
            else {
                scriptFullFileName = Path.Combine(scriptSession.DicomScriptRootDirectory ,scriptInput.FileName);
            }

            FileInfo fileInfoFirstArg = new FileInfo(scriptSession.SessionFileName);
            if(!fileInfoFirstArg.Exists) {
                    Console.WriteLine("Error : Session File does not exists.\n");
                return;
            }
            else {
                string fileExtension = Path.GetExtension(scriptInput.FileName);
                FileInfo fileInfoSecondArg = new FileInfo(scriptFullFileName);
                if (((fileExtension == ".ds") ||(fileExtension == ".dss")||(fileExtension == ".vbs")||(fileExtension == ".vb")) && (fileInfoSecondArg.Exists)){
                    Console.WriteLine("> Executing  Script {0}...", scriptFullFileName);
                    scriptSession.Execute(scriptInput);
                    if (scriptSession.Result) {
                        Console.WriteLine("> Execution succeeded.\n");
                        DisplayResultCounters(scriptSession);
                    }
                    else {
                        Console.WriteLine("> Execution failed.\n");
                        DisplayResultCounters(scriptSession);
                    }
                }
                else if (((fileExtension == ".ds") ||(fileExtension == ".dss")||(fileExtension == ".vbs")||(fileExtension == ".vb")) && (!fileInfoSecondArg.Exists))
                {
                    Console.WriteLine("Error : Script File does not exists.\n");
                }
                else
                {
                    Console.WriteLine("Error : Script File does not exists.\n");
                    ShowCommandLineArguments();
                }
            }
        }