Пример #1
0
        public virtual void EntryPoint()
        {
            try
            {
                using (this)
                {
                    using (ReadBuffer readBuf = new ReadBuffer())
                    {
                        // store the readBuf as a property so the ThreadSupervisor has access.
                        ReadBuffer = readBuf;

                        Supervisor.AssignCurrentReadBuffer(ReadBuffer);

                        Supervisor.AssureReceiveThread(Conn, mRunLog);

                        // run the actual command on the telnet server.
                        string[] respLines = null;
                        if (CommandMethod != null)
                        {
                            respLines = CommandMethod(this, ReadBuffer, WriteEventLog, CommandText);
                        }
                        else
                        {
                            respLines = this.CommandRoute.RunCommand(
                                this, ReadBuffer, WriteEventLog, CommandText);
                        }

                        this.RunLog.Write(respLines);

                        RunLog.Write(respLines);
                    }
                    RunLog.Write("Exit.");
                }
            }
            finally
            {
                // call the thread ended callback method.
                if (ThreadEndedCallback != null)
                {
                    ThreadEndedCallback();
                }

                // in case anyone waiting for this thread to end. Signal the ended event.
                ThreadEndedEvent.Set();
            }
        }