📄 winclient.cs
字号:
MessageBox.Show(this, WC.lineStr1);
}
}
}
public void SendRootStream(byte[] b)
{
lock(this)
{
if (RootSocket != null && RootSocket.Connected)
{
RootSocket.Send(b, b.Length, 0);
}
}
}
public void AcceptILOVEAICACAMSG(Socket sk, string str)
{
lock(this)
{
string otherRemoteName = WC.GetXML(str, "en");
string otherRemoteIP = WC.GetXML(str, "ei");
string otherRemotePort = WC.GetXML(str, "ep");
string threadID = WC.MakeThreadID("WinDialog", otherRemoteName, otherRemoteIP, otherRemotePort);
string clientID = WC.MakeClientID("WinClient", otherRemoteName, otherRemoteIP, otherRemotePort);
if (FormHash.Contains(threadID))
{
WinDialog tWinDialog = (WinDialog)FormHash[threadID];
tWinDialog.SetSocket(sk, true);
tWinDialog.OnILOVEAICACAMSG(str);
}
else
{
this.StartWinDialog_Accept(sk, clientID, str);
}
}
}
//////////Sending Type//////////
public void AcceptILOVEAICACAFAC(Socket sk, string str)
{
lock(this)
{
string threadID = WC.RemoteToThread(WC.GetXML(str, "eid"));
string remoteID = WC.ThreadToRemote(WC.GetXML(str, "tid"));
if (FormHash.Contains(threadID))
{
WinSend tWinSend = (WinSend)FormHash[threadID];
tWinSend.SetSocket(sk, true);
tWinSend.OnILOVEAICACAFAC(str);
}
else
{
string sendStr = WC.MakeXML("ms", "ILOVEAICACAERR") + threadID + remoteID + WC.MakeXML("er", WC.lineStr10);
this.SendSocketMsg(sk, sendStr);
}
}
}
//////////Sending Type//////////
public void AcceptILOVEAICACAFRE(string str)
{
lock(this)
{
string threadID = WC.RemoteToThread(WC.GetXML(str, "eid"));
if (FormHash.Contains(threadID))
{
WinSend tWinSend = (WinSend)FormHash[threadID];
tWinSend.OnILOVEAICACAFRE();
}
}
}
//////////Receivinging Type//////////
public void AcceptILOVEAICACAFNO(Socket sk, string str)
{
lock(this)
{
string otherRemoteName = WC.GetXML(str, "en");
string otherRemoteIP = WC.GetXML(str, "ei");
string otherRemotePort = WC.GetXML(str, "ep");
string clientID = WC.MakeClientID("WinClient", otherRemoteName, otherRemoteIP, otherRemotePort);
this.StartWinReceive_Accept(sk, clientID, str);
}
}
public void RootILOVEAICACACFG(string str)
{
configData = WC.MakeXML("Config", WC.GetXML(str, "Config"));
this.SetConfigData();
}
public void RootILOVEAICACACAS(string str)
{
lock(this)
{
string preAddr = WC.GetXML(str, "car");
string compareID = WC.LocalToClient(localID);
clientAddr = WC.RemoveStr(preAddr, compareID);
this.UpdateListBox();
}
}
public void RootILOVEAICACAMSG(string str)
{
lock(this)
{
string otherRemoteName = WC.GetXML(str, "en");
string otherRemoteIP = WC.GetXML(str, "ei");
string otherRemotePort = WC.GetXML(str, "ep");
string threadID = WC.MakeThreadID("WinDialog", otherRemoteName, otherRemoteIP, otherRemotePort);
string clientID = WC.MakeClientID("WinClient", otherRemoteName, otherRemoteIP, otherRemotePort);
if (FormHash.Contains(threadID))
{
((WinDialog)FormHash[threadID]).OnILOVEAICACAMSG(str);
}
else
{
this.StartWinDialog_RoundMsg(clientID, str);
}
}
}
//////////Sending Type//////////
public void RootILOVEAICACAFAC(string str)
{
lock(this)
{
string threadID = WC.RemoteToThread(WC.GetXML(str, "eid"));
string remoteID = WC.ThreadToRemote(WC.GetXML(str, "tid"));
if (FormHash.Contains(threadID))
{
((WinSend)FormHash[threadID]).OnILOVEAICACAFAC(str);
}
else
{
string sendStr = WC.MakeXML("ms", "ILOVEAICACAERR") + threadID + remoteID + WC.MakeXML("er", WC.lineStr10);
this.SendRootMsg(sendStr);
}
}
}
//////////Sending Type//////////
public void RootILOVEAICACAFRE(string str)
{
lock(this)
{
string threadID = WC.RemoteToThread(WC.GetXML(str, "eid"));
if (FormHash.Contains(threadID))
{
((WinSend)FormHash[threadID]).OnILOVEAICACAFRE();
}
}
}
//////////Receivinging Type//////////
public void RootILOVEAICACAFNO(string str)
{
lock(this)
{
string otherRemoteName = WC.GetXML(str, "en");
string otherRemoteIP = WC.GetXML(str, "ei");
string otherRemotePort = WC.GetXML(str, "ep");
string threadID = WC.MakeThreadID("WinReceive", otherRemoteName, otherRemoteIP, otherRemotePort);
string clientID = WC.MakeClientID("WinClient", otherRemoteName, otherRemoteIP, otherRemotePort);
if (FormHash.Contains(threadID))
{
((WinReceive)FormHash[threadID]).OnILOVEAICACAFNO(str);
}
else
{
this.StartWinReceive_RoundMsg(clientID, str);
}
}
}
//////////Receivinging Type//////////
public void RootILOVEAICACAFCA(string str)
{
lock(this)
{
string threadID = WC.RemoteToThread(WC.GetXML(str, "eid"));
if (FormHash.Contains(threadID))
{
((WinReceive)FormHash[threadID]).OnILOVEAICACAFCA();
}
}
}
//////////Receivinging Type//////////
public void RootILOVEAICACAFIL(string str)
{
lock(this)
{
string threadID = WC.RemoteToThread(WC.GetXML(str, "eid"));
string remoteID = WC.ThreadToRemote(WC.GetXML(str, "tid"));
int fileLen = Convert.ToInt32(WC.GetXML(str, "fl"));
byte[] fileStream = new byte[fileLen];
int idx = 0;
while (fileLen > idx)
{
idx = idx + RootSocket.Receive(fileStream, idx, fileLen-idx, 0);
}
if (FormHash.Contains(threadID))
{
((WinReceive)FormHash[threadID]).OnILOVEAICACAFIL(str, fileStream);
}
else
{
string sendStr = WC.MakeXML("ms", "ILOVEAICACAERR") + threadID + remoteID + WC.MakeXML("er", WC.lineStr10);
this.SendRootMsg(sendStr);
}
}
}
public void RootILOVEAICACAXLI(string str)
{
lock(this)
{
string sort = WC.GetXML(str, "xs");
int len = Convert.ToInt32(WC.GetXML(str, "xl"));
byte[] getStream = null;
int idx = 0;
if (len > 0)
{
getStream = new byte[len];
while (len > idx)
{
idx = idx + RootSocket.Receive(getStream, idx, len-idx, 0);
}
}
if (FormHash.Contains(WC.MakeXML("WinBoard", sort)))
{
((WinBoard)FormHash[WC.MakeXML("WinBoard", sort)]).OnILOVEAICACAXLI(sort, getStream);
}
}
}
public void RootILOVEAICACAXME(string str)
{
lock(this)
{
string sort = WC.GetXML(str, "xs");
int len = Convert.ToInt32(WC.GetXML(str, "xl"));
byte[] getStream = new byte[len];
int idx = 0;
while (len > idx)
{
idx = idx + RootSocket.Receive(getStream, idx, len-idx, 0);
}
if (FormHash.Contains(WC.MakeXML("WinBoard", sort)))
{
((WinBoard)FormHash[WC.MakeXML("WinBoard", sort)]).OnILOVEAICACAXME(sort, getStream);
}
}
}
public void RootILOVEAICACAXFI(string str)
{
lock(this)
{
string changeFileName = WC.GetXML(str, "xc");
int fileLen = Convert.ToInt32(WC.GetXML(str, "xl"));
byte[] fileStream = new byte[fileLen];
int idx = 0;
while (fileLen > idx)
{
idx = idx + RootSocket.Receive(fileStream, idx, fileLen-idx, 0);
}
FileStream fs = new FileStream(changeFileName, FileMode.Create);
fs.Write(fileStream,0,fileLen);
fs.Close();
string fileName = new FileInfo(changeFileName).Name;
MessageBox.Show("File Name : " + fileName + " Received successfully.");
}
}
public void RootILOVEAICACAERR(string str)
{
lock(this)
{
string threadID = WC.RemoteToThread(WC.GetXML(str, "eid"));
if (threadID != null && FormHash.Contains(threadID))
{
((WinReceive)FormHash[threadID]).OnILOVEAICACAERR(str);
}
else
{
MessageBox.Show(this, WC.GetXML(str, "er"));
}
}
}
public void RootILOVEAICACACHA(string str)
{
lock(this)
{
this.AddChatText(WC.GetXML(str, "ln"), WC.GetNextXML(str, "body"));
}
}
public WinRoot pWinRoot
{
set
{
this.xWinRoot = value;
}
}
public Socket pRootSocket
{
set
{
this.RootSocket = value;
NetworkStream stream = new NetworkStream(RootSocket);
this.SocketWriter = new StreamWriter(stream);
}
}
public string pMainStatus
{
set
{
this.statusBar.Panels[0].Text = value;
}
}
public string pProcessStatus
{
set
{
this.statusBar.Panels[1].Text = value;
}
}
public string pLocalID
{
set
{
this.localID = value;
}
}
public static void Main(string[] args)
{
Application.Run(new WinClient());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -