コード例 #1
0
        private void DealWithErrorStuff(Telnet.Terminal telnetSwitch)
        {
            string infomationToWriteInfo = nowUsingItem.Name + "/" + nowUsingItem.IpAddress + "-" + nowUsingItem.FlushResult;
            if (telnetSwitch.VirtualScreen != null)
            {
                infomationToWriteInfo += telnetSwitch.VirtualScreen.Hardcopy().Trim();
            }
            else
            {
                infomationToWriteInfo += "=====NULL=====";
            }
            LogInToEvent.WriteInfo(infomationToWriteInfo);
            LogInToEvent.WriteDebug(nowUsingItem.Name + "/" + nowUsingItem.IpAddress + "-" + "失败,日志:\n" + telnetSwitch.GetHistory);

            RemoveFromDisableListForErrorOcour();

            AddsToErrorList();

            lock (nowUsingItem)
            {
                nowUsingItem.LastFlushLog = telnetSwitch.GetHistory;
            }
            nowUsingItem.LastFlushTime = DateTime.Now;

            if (telnetSwitch.IsOpenConnection())
            {
                if (telnetSwitch.SendLogout() == false)
                {
                    lock (nowUsingItem)
                    { nowUsingItem.FlushResult = "请求注销失败"; }
                }
                telnetSwitch.Close();
            }
        }
コード例 #2
0
        private void DealWithSuccessStuff(string nowProgressing, Telnet.Terminal telnetSwitch)
        {
            nowUsingItem.LastFlushTime = DateTime.Now;

            LogInToEvent.WriteDebug(nowUsingItem.Name + "/" + nowUsingItem.IpAddress + "-" + "成功,日志:\n" + telnetSwitch.GetHistory);
            lock (nowUsingItem)
            { nowUsingItem.LastFlushLog += "\n" + nowUsingItem.Name + "/" + nowUsingItem.IpAddress + "-" + "成功\n"; }
            //成功

            RemoveFromErrorList();

            if (nowProgressing == nowUsingItem.FlushResult)
            {
                lock (nowUsingItem)
                {
                    nowUsingItem.FlushResult = "";
                }

            }

            lock (nowUsingItem)
            {
                nowUsingItem.LastFlushLog += "\n\n SESSIONLOG:\n\n" + telnetSwitch.GetHistory;
            }

            if (telnetSwitch.IsOpenConnection())
            {
                if (telnetSwitch.SendLogout() == false)
                {
                    lock (nowUsingItem)
                    { nowUsingItem.FlushResult = "请求注销失败"; }
                    throw new Exception();
                }
                telnetSwitch.Close();
            }
        }
コード例 #3
0
        private void DealWithErrorStuff(Telnet.Terminal telnetSwitch)
        {
            string infomationToWriteInfo = nowUsingItem.Name + "/" + nowUsingItem.IpAddress + "-" + nowUsingItem.FlushResult;
            if (telnetSwitch.VirtualScreen != null)
            {
                infomationToWriteInfo += telnetSwitch.VirtualScreen.Hardcopy().Trim();
            }
            else
            {
                infomationToWriteInfo += "=====NULL=====";
            }
            LogInToEvent.WriteInfo(infomationToWriteInfo);
            LogInToEvent.WriteDebug(nowUsingItem.Name + "/" + nowUsingItem.IpAddress + "-" + "失败,日志:\n" + telnetSwitch.GetHistory);

            lock (nowUsingItem)
            {
                nowUsingItem.LastFlushLog += "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n===========================\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
                nowUsingItem.LastFlushLog += infomationToWriteInfo;
                nowUsingItem.LastFlushLog += telnetSwitch.GetHistory;
                nowUsingItem.LastFlushLog += "\r\n错误返回";
                nowUsingItem.FlushResult = "在恢复过程中出现错误";
            }
            nowUsingItem.LastFlushTime = DateTime.Now;

            if (telnetSwitch.IsOpenConnection())
            {
                if (telnetSwitch.SendLogout() == false)
                {
                    lock (nowUsingItem)
                    { nowUsingItem.FlushResult = "请求注销失败"; }
                }
                telnetSwitch.Close();
            }
            lock (nowUsingItem)
            {
                nowUsingItem.FlushResult = "在试图恢复时发生错误";
            }
        }