예제 #1
0
        public virtual void Dispose()
        {
            // Dispose of the listener
            if (listener != null)
            {
                listener.Dispose();
                listener = null;
            }

            // Dispose of the process
            if (CurrentProcess != null)
            {
                CurrentProcess.Dispose();
                CurrentProcess = null;
            }
        }
예제 #2
0
        public virtual void Start()
        {
            // Check to see if process is already busy
            if (Running)
            {
                throw new Exception("Process is already running.");
            }

            Dispose();

            // Get the tool executable
            string toolPath = Tool;
            if (!Path.IsPathRooted(toolPath))
            {
                toolPath = XilinxHelper.GetXilinxToolPath(Tool);
                if (toolPath == null)
                {
                    throw new Exception(string.Format("Unable to location the executable for the tool '{0}'", Tool));
                }
            }

            // Create the process with special Xilinx Environment
            CurrentProcess = CreateXilinxEnvironmentProcess();
            CurrentProcess.StartInfo.FileName = toolPath;

            string args = "";
            foreach (string arg in Arguments)
            {
                if (!string.IsNullOrEmpty(args))
                {
                    args += " ";
                }
                args += arg;
            }
            CurrentProcess.StartInfo.Arguments = args;
            CurrentProcess.StartInfo.WorkingDirectory = WorkingDirectory;

            CurrentProcess.StartInfo.UseShellExecute = false;
            if (RedirectOutput)
            {
                CurrentProcess.StartInfo.RedirectStandardError = true;
                CurrentProcess.StartInfo.RedirectStandardOutput = true;

                listener = new ProcessHelper.ProcessListener(CurrentProcess);
                listener.StdOutNewLineReady += delegate(string line) { if (line != null) { ProcessLine(line); } };
                listener.StdErrNewLineReady += delegate(string line) { if (line != null) { ProcessErrorLine(line); } };
            }
            if (RedirectInput)
            {
                CurrentProcess.StartInfo.RedirectStandardInput = true;
            }

            // Start the process
            CurrentProcess.Start();

            if (RedirectOutput)
            {
                // Start the listener
                listener.Begin();
            }
        }
예제 #3
0
        public virtual void Start()
        {
            // Check to see if process is already busy
            if (Running)
            {
                throw new Exception("Process is already running.");
            }

            Dispose();

            // Get the tool executable
            string toolPath = Tool;

            if (!Path.IsPathRooted(toolPath))
            {
                toolPath = XilinxHelper.GetXilinxToolPath(Tool);
                if (toolPath == null)
                {
                    throw new Exception(string.Format("Unable to location the executable for the tool '{0}'", Tool));
                }
            }

            // Create the process with special Xilinx Environment
            CurrentProcess = CreateXilinxEnvironmentProcess();
            CurrentProcess.StartInfo.FileName = toolPath;

            string args = "";

            foreach (string arg in Arguments)
            {
                if (!string.IsNullOrEmpty(args))
                {
                    args += " ";
                }
                args += arg;
            }
            CurrentProcess.StartInfo.Arguments        = args;
            CurrentProcess.StartInfo.WorkingDirectory = WorkingDirectory;

            CurrentProcess.StartInfo.UseShellExecute = false;
            if (RedirectOutput)
            {
                CurrentProcess.StartInfo.RedirectStandardError  = true;
                CurrentProcess.StartInfo.RedirectStandardOutput = true;

                listener = new ProcessHelper.ProcessListener(CurrentProcess);
                listener.StdOutNewLineReady += delegate(string line) { if (line != null)
                                                                       {
                                                                           ProcessLine(line);
                                                                       }
                };
                listener.StdErrNewLineReady += delegate(string line) { if (line != null)
                                                                       {
                                                                           ProcessErrorLine(line);
                                                                       }
                };
            }
            if (RedirectInput)
            {
                CurrentProcess.StartInfo.RedirectStandardInput = true;
            }

            // Start the process
            CurrentProcess.Start();

            if (RedirectOutput)
            {
                // Start the listener
                listener.Begin();
            }
        }
예제 #4
0
        public virtual void Dispose()
        {
            // Dispose of the listener
            if (listener != null)
            {
                listener.Dispose();
                listener = null;
            }

            // Dispose of the process
            if (CurrentProcess != null)
            {
                CurrentProcess.Dispose();
                CurrentProcess = null;
            }
        }