本文整理汇总了C#中PacketReader.UInt16方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.UInt16方法的具体用法?C# PacketReader.UInt16怎么用?C# PacketReader.UInt16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketReader
的用法示例。
在下文中一共展示了PacketReader.UInt16方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
public void Connect()
{
try
{
PacketReader Reader = new PacketReader(PacketInformation.buffer);
if (Reader.Byte() == 18)
{
string ID = Reader.Text();
string PW = Reader.Text();
byte ukn = Reader.Byte(); // 0xff
UInt16 ServerID = Reader.UInt16();
int lResult = 99;
//Console.WriteLine("Id:{0} Pass:{1} ServerID:{2}",ID,PW,ServerID);
SRX_Serverinfo SSI = GSList[ServerID];
if (SSI != null)
{
UInt16 myKey = 0;
string sReason = "";
lock (Program.IPCResultList)
{
myKey = Program.IPCNewId++;
}
byte[] rqp = Program.IPCServer.PacketRequestLogin(Program.IPCPort, ID, PW, myKey);
Servers.IPCenCode(ref rqp, SSI.code);
lock (Program.IPCResultList)
{
Program.IPCResultList.Add(myKey, new IPCItem());
Program.IPCResultList[myKey].resultCode = 0x8000;
}
Program.IPCServer.Send(SSI.ip, SSI.ipcport, rqp);
DateTime tOut = DateTime.Now.AddSeconds(30);
while ((tOut >= DateTime.Now) && (Program.IPCResultList[myKey].resultCode == 0x8000) && (client.clientSocket.Connected))
{
System.Threading.Thread.Sleep(10);
}
lResult = Program.IPCResultList[myKey].resultCode;
sReason = Program.IPCResultList[myKey].banReason;
lock (Program.IPCResultList)
{
Program.IPCResultList[myKey] = null;
Program.IPCResultList.Remove(myKey);
}
rqp = null;
//Console.WriteLine("Resultado de login: {0}",lResult);
switch (lResult)
{
case 0:
if (SSI.lan_wan)
{
client.Send(ConnectSucces(SSI.wan, SSI.port, 1));
}
else
{
client.Send(ConnectSucces(SSI.ip, SSI.port, 1));
}
return;
case 1:
if (WrongPassword < 3)
{
client.Send(WrongInformation());
WrongPassword++;
return;
}
else
{
client.Disconnect(PacketInformation.Client);
return;
}
case 2:
client.Send(ServerIsFull());
client.Disconnect(PacketInformation.Client);
return;
case 3:
client.Send(AllreadyConnected());
client.Disconnect(PacketInformation.Client);
return;
case 4:
client.Send(BannedUser(sReason));
client.Disconnect(PacketInformation.Client);
return;
default:
if (lResult == 0x8000)
{
Console.WriteLine("[IPC] Timeout");
}
else
{
Console.WriteLine("[IPC] Result unknown {0}", lResult);
}
return;
}
}
else
{
Console.WriteLine("Fuck No fun.. SSI");
}
}
//.........这里部分代码省略.........