📄 winmode.cs
字号:
/*
<Aicaca Community Messenger Client>
Copyright (c) Aicaca.com, All rights reserved.
Writer : Byung-ku, Cho (Aicaca)
E-mail : aicaca@hanmail.net
Personal Homepage URL : http://www.aicaca.com
Last Updated Date : Feb. 27th, 2002
Programming Language : C#
Editor & Compiler : VisualStudio.NET
*/
using System;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
namespace TalkClient
{
public class WinMode
{
private WinCom WC = new WinCom();
private WinDialog xWinDialog;
private WinSend xWinSend;
private WinReceive xWinReceive;
private string clientID;
public WinMode(WinDialog tWinDialog, string tClientID)
{
xWinDialog = tWinDialog;
clientID = tClientID;
}
public WinMode(WinSend tWinSend, string tClientID)
{
xWinSend = tWinSend;
clientID = tClientID;
}
public WinMode(WinReceive tWinReceive, string tClientID)
{
xWinReceive = tWinReceive;
clientID = tClientID;
}
public void WinThread_Dialog()
{
string clientIP = WC.GetXML(clientID, "ci");
int clientPort = Convert.ToInt32(WC.GetXML(clientID, "cp"));
Socket ModeSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
IPAddress host_addr = Dns.GetHostByAddress(clientIP).AddressList[0];
IPEndPoint ep = new IPEndPoint(host_addr, clientPort);
try
{
ModeSocket.Connect(ep);
xWinDialog.pDirectMode = true;
}
catch (Exception e)
{
xWinDialog.pDirectMode = false;
}
if (ModeSocket != null)
{
ModeSocket.Close();
ModeSocket = null;
}
}
public void WinThread_Send()
{
string clientIP = WC.GetXML(clientID, "ci");
int clientPort = Convert.ToInt32(WC.GetXML(clientID, "cp"));
Socket ModeSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
IPAddress host_addr = Dns.GetHostByAddress(clientIP).AddressList[0];
IPEndPoint ep = new IPEndPoint(host_addr, clientPort);
try
{
ModeSocket.Connect(ep);
xWinSend.pDirectMode = true;
}
catch (Exception e)
{
xWinSend.pDirectMode = false;
}
if (ModeSocket != null)
{
ModeSocket.Close();
ModeSocket = null;
}
}
public void WinThread_Receive()
{
string clientIP = WC.GetXML(clientID, "ci");
int clientPort = Convert.ToInt32(WC.GetXML(clientID, "cp"));
Socket ModeSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
IPAddress host_addr = Dns.GetHostByAddress(clientIP).AddressList[0];
IPEndPoint ep = new IPEndPoint(host_addr, clientPort);
try
{
ModeSocket.Connect(ep);
xWinReceive.pDirectMode = true;
}
catch (Exception e)
{
xWinReceive.pDirectMode = false;
}
if (ModeSocket != null)
{
ModeSocket.Close();
ModeSocket = null;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -