Exemplo n.º 1
0
        private void LogProcess(LogProcessMessage message)
        {
            RCProcess rcprocess = this._processCollection[message.Name];

            if (rcprocess != null)
            {
                rcprocess.AddLogManual(message.Message);
            }
        }
Exemplo n.º 2
0
        private void RunExe(RCProcess process)
        {
            switch (ExeType)
            {
            case RCProcessScheduler.EExeType.StdInput:
                break;

            case RCProcessScheduler.EExeType.ExternalExe:
            {
                string[] commands = RCProcessScheduler.ParseExternalCommand(Command);
                if (commands == null || commands.Length <= 0)
                {
                    return;
                }
                string workDir  = Path.GetDirectoryName(commands[0]);
                string fileName = Path.GetFileName(commands[0]);
                if (!Path.IsPathRooted(workDir))
                {
                    workDir = BaseConfiguration.WorkingDirectory + "\\" + workDir;
                }
                if (string.IsNullOrEmpty(workDir))
                {
                    workDir = BaseConfiguration.WorkingDirectory;
                }
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.WorkingDirectory = workDir;
                StringBuilder sb = new StringBuilder();
                for (int i = 1; i < commands.Length; i++)
                {
                    sb.AppendFormat("\"{0}\" ", commands[i]);
                }
                RCProcess.MakeProcess(startInfo, fileName, sb.ToString());
                Process proc = new Process();
                proc.StartInfo = startInfo;
                try
                {
                    proc.Start();
                    return;
                }
                catch (Exception ex)
                {
                    Log <RCClient> .Logger.ErrorFormat("[{0}] - Exception in Start Schedule - {1}", process.Name, Name);

                    process.AddLogManual("Exception in Start() - " + ex.Message);
                    return;
                }
            }

            default:
                return;
            }
            process.StandardIn(Command);
        }