654 lines
28 KiB
C#
654 lines
28 KiB
C#
using DevExpress.Data.Helpers;
|
|
using DevExpress.XtraBars;
|
|
using DevExpress.XtraBars.Navigation;
|
|
|
|
using System;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
using System.Runtime.InteropServices;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Xml.Linq;
|
|
using System.IO;
|
|
using System.Diagnostics;
|
|
|
|
using SystemX.Net;
|
|
using SystemX.Common;
|
|
using SystemX.Net.BaseProtocol;
|
|
using SystemX.Net.Comm;
|
|
using SystemX.Net.Schedule;
|
|
using SystemX.Net.DB;
|
|
using SystemX.Common.Serialization;
|
|
using SystemX.Common.Archive;
|
|
using System.Threading.Tasks;
|
|
|
|
using SystemX.Common.Protocol.SIA;
|
|
|
|
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
|
using System.Threading;
|
|
using SystemX.Net.Platform.Common.Util;
|
|
using SystemX.Net.Platform.Common.ExtensionMethods;
|
|
using SystemX.Net.Middleware.Commons;
|
|
using static SystemX.Net.DB.XDBConnManager;
|
|
|
|
namespace SystemX.Net.MiddlewareUI
|
|
{
|
|
public partial class MainForm : DevExpress.XtraBars.FluentDesignSystem.FluentDesignForm
|
|
{
|
|
private void Chktimer_Tick(object sender, EventArgs e)
|
|
{
|
|
Chktimer.Enabled = false;
|
|
|
|
if (MIDDLEWARE_START_STATE == false)
|
|
{
|
|
ConsoleUtil.ConsoleVisibleControl();
|
|
|
|
//The program is automatically terminated.
|
|
MessageBox.Show("Server information could not be retrieved. Check the console error text.", "Middleware for Line Bridge", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
//this.Close();
|
|
}
|
|
}
|
|
|
|
private void buttonUserQueryRead_Click(object sender, EventArgs e)
|
|
{
|
|
xCallQuery.Load();
|
|
}
|
|
|
|
|
|
private void buttonListenReset_Click(object sender, EventArgs e)
|
|
{
|
|
dataGridViewListen.Rows.Clear();
|
|
|
|
ListenServerReset();
|
|
}
|
|
|
|
private void WritePortSendRecvInfo(int nGetPos, int iRowPos)
|
|
{
|
|
if (thisConnInfo[nGetPos].m_ucSendCommandToken == 0x1)
|
|
{
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor != Color.Yellow)
|
|
dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor = Color.Yellow;
|
|
}
|
|
else if (thisConnInfo[nGetPos].m_ucSendCommandToken == 0x2)
|
|
{
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor != Color.LightYellow)
|
|
dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor = Color.LightYellow;
|
|
}
|
|
//
|
|
if (thisConnInfo[nGetPos].m_ucRecvCommandToken == 0x1)
|
|
{
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor != Color.DeepSkyBlue)
|
|
dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor = Color.DeepSkyBlue;
|
|
}
|
|
else if (thisConnInfo[nGetPos].m_ucRecvCommandToken == 0x2)
|
|
{
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor != Color.LightSkyBlue)
|
|
dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor = Color.LightSkyBlue;
|
|
}
|
|
//
|
|
if (thisConnInfo[nGetPos].m_ucSendStreamToken == 0x1)
|
|
{
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor != Color.Yellow)
|
|
dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor = Color.Yellow;
|
|
}
|
|
else if (thisConnInfo[nGetPos].m_ucSendStreamToken == 0x2)
|
|
{
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor != Color.LightYellow)
|
|
dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor = Color.LightYellow;
|
|
}
|
|
//
|
|
if (thisConnInfo[nGetPos].m_ucRecvStreamToken == 0x1)
|
|
{
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor != Color.DeepSkyBlue)
|
|
dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor = Color.DeepSkyBlue;
|
|
}
|
|
else if (thisConnInfo[nGetPos].m_ucRecvStreamToken == 0x2)
|
|
{
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor != Color.LightSkyBlue)
|
|
dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor = Color.LightSkyBlue;
|
|
}
|
|
|
|
dataGridViewPort.Rows[iRowPos].Cells[3].Value = thisConnInfo[nGetPos].m_iSendCommandCnt;
|
|
dataGridViewPort.Rows[iRowPos].Cells[4].Value = thisConnInfo[nGetPos].m_iRecvCommandCnt;
|
|
dataGridViewPort.Rows[iRowPos].Cells[5].Value = thisConnInfo[nGetPos].m_iSendStreamCnt;
|
|
dataGridViewPort.Rows[iRowPos].Cells[6].Value = thisConnInfo[nGetPos].m_iRecvStreamCnt;
|
|
}
|
|
|
|
private void PortInfoGridInitialize(int iRowPos)
|
|
{
|
|
/*
|
|
if (strGetText.CompareTo(strSetProcessInfo[nGetPos]) != 0)
|
|
dataGridViewPort.Rows[i].Cells[2].Value = strSetProcessInfo[nGetPos];
|
|
*/
|
|
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor != Color.White)
|
|
dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor = Color.White;
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor != Color.White)
|
|
dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor = Color.White;
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor != Color.White)
|
|
dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor = Color.White;
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor != Color.White)
|
|
dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor = Color.White;
|
|
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[3].Value.ToString().Length > 0)
|
|
dataGridViewPort.Rows[iRowPos].Cells[3].Value = string.Empty;
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[4].Value.ToString().Length > 0)
|
|
dataGridViewPort.Rows[iRowPos].Cells[4].Value = string.Empty;
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[5].Value.ToString().Length > 0)
|
|
dataGridViewPort.Rows[iRowPos].Cells[5].Value = string.Empty;
|
|
if (dataGridViewPort.Rows[iRowPos].Cells[6].Value.ToString().Length > 0)
|
|
dataGridViewPort.Rows[iRowPos].Cells[6].Value = string.Empty;
|
|
}
|
|
|
|
private void UItimer_Tick(object sender, EventArgs e)
|
|
{
|
|
if (m_bTimerLock[(int)TIMER_LOCK.UI_TIMER] == false)
|
|
{
|
|
m_bTimerLock[(int)TIMER_LOCK.UI_TIMER] = true;
|
|
|
|
if (TimeControl.SyncServerTimeResult)
|
|
{
|
|
if (barStaticItemSyncTime.Visibility == BarItemVisibility.Never)
|
|
{
|
|
barStaticItemSyncTime.Caption = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] Server time synchronization progressed successfully.";
|
|
barStaticItemSyncTime.Visibility = BarItemVisibility.Always;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (barStaticItemSyncTime.Visibility == BarItemVisibility.Always)
|
|
barStaticItemSyncTime.Visibility = BarItemVisibility.Never;
|
|
}
|
|
//
|
|
if (progressBarProgram.Value + 20 <= 100)
|
|
progressBarProgram.Value += 20;
|
|
else
|
|
progressBarProgram.Value = 0;
|
|
|
|
//Disconnect Listen Server Reset
|
|
for (int i = 0; i < PORT_DISTRIBUTION_NUM; i++)
|
|
{
|
|
if (ConnPool[i].bRequiredPortReset == false)
|
|
{
|
|
//Listen Server Auto Reset 5 Minute
|
|
if (ConnPool[i].stPortTimer.ElapsedMilliseconds >= 300000)
|
|
ConnPool[i].bRequiredPortReset = true;
|
|
else
|
|
continue;
|
|
}
|
|
|
|
if (ConnPool[i].bRequiredPortResetReady == false)
|
|
{
|
|
ListenServerOnState[i] = false;
|
|
|
|
ClearListenElement(i);
|
|
|
|
ClearListenServerInstance(i);
|
|
|
|
ConnPool[i].bRequiredPortResetReady = true;
|
|
}
|
|
else
|
|
{
|
|
StartListenServer(i, ConnPool[i].nUseCommandPort, ConnPool[i].nUseStreamPort);
|
|
|
|
DisplayListenElement(i);
|
|
|
|
ListenServerOnState[i] = true;
|
|
|
|
ConnPool[i].PortTImerRestart();
|
|
|
|
ConnPool[i].bRequiredPortResetReady = false;
|
|
ConnPool[i].bRequiredPortReset = false;
|
|
}
|
|
|
|
/*
|
|
ListenServerOnState[i] = false;
|
|
|
|
ClearListenElement(i);
|
|
|
|
ClearListenServerInstance(i);
|
|
|
|
StartListenServer(i, ConnPool[i].nUseCommandPort, ConnPool[i].nUseStreamPort);
|
|
|
|
DisplayListenElement(i);
|
|
|
|
ListenServerOnState[i] = true;
|
|
|
|
ConnPool[i].bRequiredPortReset = false;
|
|
*/
|
|
}
|
|
|
|
//Listen
|
|
dataGridViewListen.SuspendLayout();
|
|
for (int i = 0; i < dataGridViewListen.RowCount; i++)
|
|
{
|
|
if (dataGridViewListen.Rows[i].Cells[0].Value == null)
|
|
continue;
|
|
|
|
string strSetText = string.Empty;
|
|
|
|
string strGetNumText = dataGridViewListen.Rows[i].Cells[0].Value.ToString();
|
|
string strGetText = dataGridViewListen.Rows[i].Cells[1].Value.ToString();
|
|
|
|
int nGetPos = int.MaxValue;
|
|
|
|
if (int.TryParse(strGetNumText, out nGetPos) == false)
|
|
continue;
|
|
|
|
if (thisConnInfo[nGetPos].ClientConnectState)
|
|
strSetText = "CONNECT - Assigning port";
|
|
else
|
|
strSetText = "WAIT";
|
|
|
|
if (strGetText.CompareTo(strSetText) != 0)
|
|
dataGridViewListen.Rows[i].Cells[1].Value = strSetText;
|
|
}
|
|
dataGridViewListen.ResumeLayout();
|
|
|
|
//Distribution
|
|
dataGridViewPort.SuspendLayout();
|
|
for (int i = 0; i < dataGridViewPort.RowCount; i++)
|
|
{
|
|
if (dataGridViewPort.Rows[i].Cells[0].Value == null)
|
|
continue;
|
|
|
|
string strGetText = dataGridViewPort.Rows[i].Cells[2].Value.ToString();
|
|
string strGetName = dataGridViewPort.Rows[i].Cells[0].Value.ToString();
|
|
string strConnState = dataGridViewPort.Rows[i].Cells[1].Value.ToString();
|
|
int nGetPos = Convert.ToInt32(strGetName);
|
|
|
|
if (thisConnInfo[nGetPos].ClientConnectState && thisConnInfo[nGetPos].StreamConnectState)
|
|
{
|
|
if (thisConnInfo[nGetPos].bHostLoginState)
|
|
{
|
|
string strSetText = string.Empty;
|
|
|
|
strSetText = strSetProcessInfo[nGetPos] + ("@" + thisConnInfo[nGetPos].strConnectHostID +
|
|
":" + thisConnInfo[nGetPos].strConnectSection +
|
|
"@" + thisConnInfo[nGetPos].strCommandEndPointInfo);
|
|
|
|
if (strGetText.CompareTo(strSetText) != 0)
|
|
dataGridViewPort.Rows[i].Cells[2].Value = strSetText;
|
|
if (strConnState.CompareTo("CONNECT") != 0)
|
|
dataGridViewPort.Rows[i].Cells[1].Value = "CONNECT";
|
|
}
|
|
|
|
WritePortSendRecvInfo(nGetPos, i);
|
|
}
|
|
else
|
|
{
|
|
PortInfoGridInitialize(i);
|
|
|
|
if (ConnPool[nGetPos].bUseState == false)
|
|
{
|
|
if (strGetText.CompareTo("-") != 0)
|
|
dataGridViewPort.Rows[i].Cells[2].Value = "-";
|
|
if (strConnState.CompareTo("-") != 0)
|
|
dataGridViewPort.Rows[i].Cells[1].Value = "-";
|
|
}
|
|
}
|
|
}
|
|
dataGridViewListen.ResumeLayout();
|
|
|
|
/*
|
|
if (m_iLastGetIndex != -1)
|
|
DisplayConnectInfo(m_iLastGetIndex);
|
|
*/
|
|
|
|
//DisplayConnectInfoDetect();
|
|
|
|
DriveInfo df = new DriveInfo(@LoadInfo.DISK_MONITOR_POS1);
|
|
string strTip = string.Empty;
|
|
int nPositionValue = int.MaxValue;
|
|
|
|
if (df.IsReady)
|
|
{
|
|
strTip = "Drive Name " + df.Name + " Available space " + ((double)df.AvailableFreeSpace / (double)df.TotalSize * 100).ToString("F2") + "%";
|
|
|
|
nPositionValue = (int)((double)df.AvailableFreeSpace / (double)df.TotalSize * 100);
|
|
|
|
if (progressBarControlC.ToolTip.CompareTo(strTip) != 0)
|
|
progressBarControlC.ToolTip = strTip;
|
|
|
|
if (progressBarControlC.Position != nPositionValue)
|
|
progressBarControlC.Position = (int)((double)df.AvailableFreeSpace / (double)df.TotalSize * 100);
|
|
}
|
|
df = new DriveInfo(@LoadInfo.DISK_MONITOR_POS2);
|
|
if (df.IsReady)
|
|
{
|
|
strTip = "Drive Name " + df.Name + " Available space " + ((double)df.AvailableFreeSpace / (double)df.TotalSize * 100).ToString("F2") + "%";
|
|
|
|
nPositionValue = (int)((double)df.AvailableFreeSpace / (double)df.TotalSize * 100);
|
|
|
|
if (progressBarControlD.ToolTip.CompareTo(strTip) != 0)
|
|
progressBarControlD.ToolTip = strTip;
|
|
|
|
if (progressBarControlC.Position != nPositionValue)
|
|
progressBarControlD.Position = (int)((double)df.AvailableFreeSpace / (double)df.TotalSize * 100);
|
|
}
|
|
|
|
m_bTimerLock[(int)TIMER_LOCK.UI_TIMER] = false;
|
|
}
|
|
}
|
|
|
|
private string MakeInfoConnectProcessText(int nPos, int nCommandPort, int nStreamPort)
|
|
{
|
|
string strSetProcessInfo = nPos.ToString("D2") + ":" +
|
|
nCommandPort.ToString("D4") + ":" +
|
|
nStreamPort.ToString("D4");
|
|
|
|
return strSetProcessInfo;
|
|
}
|
|
|
|
private void DisplayListenElement()
|
|
{
|
|
dataGridViewListen.SuspendLayout();
|
|
for (int i = 0; i < PORT_DISTRIBUTION_NUM; i++)
|
|
{
|
|
dataGridViewListen.Rows.Add();
|
|
|
|
strSetProcessInfo[i] = MakeInfoConnectProcessText(i, LoadInfo.nListenCommandPort[i], LoadInfo.nListenStreamPort[i]);
|
|
|
|
dataGridViewListen.Rows[i].Cells[0].Value = i.ToString();
|
|
dataGridViewListen.Rows[i].Cells[1].Value = "WAIT";
|
|
dataGridViewListen.Rows[i].Cells[2].Value = strSetProcessInfo[i];
|
|
}
|
|
dataGridViewListen.ResumeLayout();
|
|
}
|
|
|
|
private void DisplayListenElement(int nPos)
|
|
{
|
|
dataGridViewListen.SuspendLayout();
|
|
strSetProcessInfo[nPos] = MakeInfoConnectProcessText(nPos, LoadInfo.nListenCommandPort[nPos], LoadInfo.nListenStreamPort[nPos]);
|
|
|
|
dataGridViewListen.Rows[nPos].Cells[0].Value = nPos.ToString();
|
|
dataGridViewListen.Rows[nPos].Cells[1].Value = "WAIT";
|
|
dataGridViewListen.Rows[nPos].Cells[2].Value = strSetProcessInfo[nPos];
|
|
dataGridViewListen.ResumeLayout();
|
|
}
|
|
|
|
private void ClearListenElement(int nPos)
|
|
{
|
|
dataGridViewListen.SuspendLayout();
|
|
strSetProcessInfo[nPos] = string.Empty;
|
|
|
|
dataGridViewListen.Rows[nPos].Cells[0].Value = "-";
|
|
dataGridViewListen.Rows[nPos].Cells[1].Value = "-";
|
|
dataGridViewListen.Rows[nPos].Cells[2].Value = strSetProcessInfo[nPos];
|
|
|
|
dataGridViewListen.ResumeLayout();
|
|
}
|
|
|
|
private void DisplayPortElement()
|
|
{
|
|
dataGridViewPort.SuspendLayout();
|
|
for (int i = PORT_DISTRIBUTION_NUM; i < ALL_MANAGE_NUM; i++)
|
|
{
|
|
dataGridViewPort.Rows.Add();
|
|
|
|
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[0].Value = i.ToString();
|
|
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[1].Value = "-";
|
|
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[2].Value = "-";
|
|
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[3].Value = string.Empty;
|
|
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[4].Value = string.Empty;
|
|
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[5].Value = string.Empty;
|
|
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[6].Value = string.Empty;
|
|
}
|
|
dataGridViewPort.ResumeLayout();
|
|
}
|
|
|
|
private void MakeElement(int nPos, int nCommandPort, int nStreamPort)
|
|
{
|
|
strSetProcessInfo[nPos] = MakeInfoConnectProcessText(nPos, nCommandPort, nStreamPort);
|
|
|
|
dataGridViewPort.Rows[nPos - PORT_DISTRIBUTION_NUM].Cells[1].Value = "WAIT";
|
|
dataGridViewPort.Rows[nPos - PORT_DISTRIBUTION_NUM].Cells[2].Value = strSetProcessInfo[nPos];
|
|
}
|
|
|
|
private void AddElement(int nPos, int nCommandPort, int nStreamPort)
|
|
{
|
|
if (this.InvokeRequired)
|
|
{
|
|
this.Invoke(new MethodInvoker(delegate ()
|
|
{
|
|
MakeElement(nPos, nCommandPort, nStreamPort);
|
|
}));
|
|
}
|
|
else
|
|
MakeElement(nPos, nCommandPort, nStreamPort);
|
|
}
|
|
|
|
private void DeleteElement(int nPos)
|
|
{
|
|
try
|
|
{
|
|
try
|
|
{
|
|
;//
|
|
}
|
|
catch {
|
|
throw new Exception(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"RemoveElement-DeleteElement " + nPos.ToString("D3") + " [SystemX.Net.MiddlewareUI : MainForm.DeleteElement]\r\n");
|
|
}
|
|
}
|
|
catch (Exception e) {
|
|
MessageOutput.ConsoleWrite(e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
|
}
|
|
}
|
|
|
|
private void RemoveElement(int nPos)
|
|
{
|
|
if (this.InvokeRequired)
|
|
{
|
|
this.Invoke(new MethodInvoker(delegate ()
|
|
{
|
|
DeleteElement(nPos);
|
|
}));
|
|
}
|
|
else
|
|
DeleteElement(nPos);
|
|
}
|
|
|
|
private void DisplayConnectInfo(int iGetIndex)
|
|
{
|
|
if (thisConnInfo[iGetIndex].ClientConnectState &&
|
|
thisConnInfo[iGetIndex].StreamConnectState)
|
|
{
|
|
/*
|
|
string strRemoteInfo = string.Empty, strLocalInfo = string.Empty;
|
|
|
|
try
|
|
{
|
|
if (thisConnInfo[iGetIndex].ClientConnectSocket != null)
|
|
{
|
|
strLocalInfo = thisConnInfo[iGetIndex]?.ClientConnectSocket?.LocalEndPoint?.ToString();
|
|
strRemoteInfo = thisConnInfo[iGetIndex]?.ClientConnectSocket?.RemoteEndPoint?.ToString();
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"DisplayConnectInfo exception state detect[1]. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfo]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
|
|
|
m_iLastGetIndex = -1;
|
|
|
|
strRemoteInfo = "";
|
|
strLocalInfo = "";
|
|
}
|
|
finally
|
|
{
|
|
if (strRemoteInfo.IsNullOrEmpty())
|
|
strRemoteInfo = "";
|
|
if (strLocalInfo.IsNullOrEmpty())
|
|
strLocalInfo = "";
|
|
}
|
|
*/
|
|
//
|
|
try
|
|
{
|
|
/* MODIFY
|
|
dataGridViewState.Rows[0].Cells[0].Value = strLocalInfo;
|
|
dataGridViewState.Rows[0].Cells[1].Value = "-";
|
|
dataGridViewState.Rows[0].Cells[2].Value = "ON";
|
|
dataGridViewState.Rows[0].Cells[3].Value = strRemoteInfo;
|
|
|
|
dataGridViewState.Rows[0].Cells[4].Value = thisConnInfo[iGetIndex].m_iSendCommandCnt.ToString("D6") + "," + thisConnInfo[iGetIndex].m_iSendStreamCnt.ToString("D6");
|
|
dataGridViewState.Rows[0].Cells[5].Value = thisConnInfo[iGetIndex].m_iRecvCommandCnt.ToString("D6") + "," + thisConnInfo[iGetIndex].m_iRecvStreamCnt.ToString("D6");
|
|
|
|
dataGridViewState.Rows[0].Cells[6].Value = thisConnInfo[iGetIndex].m_iSendCommandQueueSize.ToString("D6") + "," + thisConnInfo[iGetIndex].m_iSendStreamQueueSize.ToString("D6");
|
|
dataGridViewState.Rows[0].Cells[7].Value = thisConnInfo[iGetIndex].m_iRecvCommandQueueSize.ToString("D6") + "," + thisConnInfo[iGetIndex].m_iRecvStreamQueueSize.ToString("D6");
|
|
|
|
dataGridViewTime.Rows[0].Cells[0].Value = thisConnInfo[iGetIndex].lCommandTime.ToString();
|
|
dataGridViewTime.Rows[0].Cells[1].Value = thisConnInfo[iGetIndex].lStreamTime.ToString();
|
|
|
|
dataGridViewTime.Rows[0].Cells[2].Value = ServerCommandSock[iGetIndex].ServerTokenPosCheck(0);
|
|
dataGridViewTime.Rows[0].Cells[3].Value = ServerStreamSock[iGetIndex].ServerTokenPosCheck(1);
|
|
*/
|
|
}
|
|
catch (Exception e) {
|
|
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"DisplayConnectInfo exception state detect[2]. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfo]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
|
|
|
m_iLastGetIndex = -1;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
/* MODIFY
|
|
dataGridViewState.Rows[0].Cells[0].Value = string.Empty;
|
|
dataGridViewState.Rows[0].Cells[1].Value = "-";
|
|
dataGridViewState.Rows[0].Cells[2].Value = "OFF";
|
|
dataGridViewState.Rows[0].Cells[3].Value = string.Empty;
|
|
|
|
dataGridViewState.Rows[0].Cells[4].Value = string.Empty;
|
|
dataGridViewState.Rows[0].Cells[5].Value = string.Empty;
|
|
|
|
dataGridViewState.Rows[0].Cells[6].Value = string.Empty;
|
|
dataGridViewState.Rows[0].Cells[7].Value = string.Empty;
|
|
|
|
try
|
|
{
|
|
if (ServerCommandSock[iGetIndex] != null)
|
|
dataGridViewTime.Rows[0].Cells[2].Value = ServerCommandSock[iGetIndex].ServerTokenPosCheck(0);
|
|
if (ServerStreamSock[iGetIndex] != null)
|
|
dataGridViewTime.Rows[0].Cells[3].Value = ServerStreamSock[iGetIndex].ServerTokenPosCheck(1);
|
|
}
|
|
catch (Exception e) {
|
|
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"Server socket status check failed. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfo]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
|
|
|
m_iLastGetIndex = -1;
|
|
}
|
|
*/
|
|
}
|
|
}
|
|
|
|
private void DisplayConnectInfoDetect()
|
|
{
|
|
for (int i = PORT_DISTRIBUTION_NUM; i < ALL_MANAGE_NUM; i++)
|
|
{
|
|
if (thisConnInfo[i].ClientConnectState == false)
|
|
continue;
|
|
|
|
//
|
|
if (thisConnInfo[i].ConnectStreamCheck)
|
|
{
|
|
if (thisConnInfo[i].stStreamCheckTime.ElapsedMilliseconds >= 20000)
|
|
{
|
|
thisConnInfo[i].stStreamCheckTime.Restart();
|
|
thisConnInfo[i].ConnectStreamCheck = false;
|
|
|
|
if (thisConnInfo[i].StreamConnectState == false)
|
|
{
|
|
ResetStreamConnectSetCheck(i);
|
|
}
|
|
}
|
|
}
|
|
//
|
|
/*
|
|
string strRemoteInfo = string.Empty, strLocalInfo = string.Empty;
|
|
|
|
bool bGetSocketInfo = true;
|
|
try
|
|
{
|
|
if (thisConnInfo[i].ClientConnectSocket != null)
|
|
{
|
|
strLocalInfo = thisConnInfo[i]?.ClientConnectSocket?.LocalEndPoint?.ToString();
|
|
strRemoteInfo = thisConnInfo[i]?.ClientConnectSocket?.RemoteEndPoint?.ToString();
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
ServerStreamSock[i].ServerSocketUnknownError(false);
|
|
ServerCommandSock[i].ServerSocketUnknownError(false);
|
|
|
|
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" " + i.ToString("D2") + " ConnectInfo exception state detect. - Socket clear[1]. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfoDetect]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
|
|
|
strRemoteInfo = "";
|
|
strLocalInfo = "";
|
|
|
|
bGetSocketInfo = false;
|
|
}
|
|
finally
|
|
{
|
|
if (strRemoteInfo.IsNullOrEmpty())
|
|
strRemoteInfo = "";
|
|
if (strLocalInfo.IsNullOrEmpty())
|
|
strLocalInfo = "";
|
|
}
|
|
*/
|
|
|
|
/*
|
|
if (bGetSocketInfo == false)
|
|
continue;
|
|
//
|
|
try
|
|
{
|
|
;//
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" " + i.ToString("D2") + " ConnectInfo exception state detect. - Socket clear[2]. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfoDetect]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
|
|
|
ResetConnectSetCheck(i);
|
|
}
|
|
*/
|
|
}
|
|
}
|
|
|
|
private void GridRowCellClick(object sender, EventArgs e)
|
|
{
|
|
string[] strGetEleInfo = ((AccordionControlElement)sender).Text.Split(':');
|
|
|
|
if (strGetEleInfo.Count() > 0)
|
|
{
|
|
int iGetIndex = Convert.ToInt32(strGetEleInfo[0]);
|
|
|
|
m_iLastGetIndex = iGetIndex;
|
|
|
|
DisplayConnectInfo(iGetIndex);
|
|
|
|
if (thisConnInfo[iGetIndex].stCheckTime.ElapsedMilliseconds <= 400)
|
|
{
|
|
string strTextMsg = ((AccordionControlElement)sender).Text;
|
|
if (MessageBox.Show("You want to [" + strTextMsg + "] server point initialize?", "Middleware for Line Bridge - Middleware UI", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
{
|
|
try
|
|
{
|
|
ResetConnectSetCheck(iGetIndex);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"[" + strTextMsg + "] initialize failed. [SystemX.Net.MiddlewareUI : MainForm.accordionControlElement_Click]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
|
}
|
|
}
|
|
}
|
|
thisConnInfo[iGetIndex].stCheckTime.Restart();
|
|
}
|
|
}
|
|
}
|
|
}
|