本文整理汇总了C#中IAuthClient.Send方法的典型用法代码示例。如果您正苦于以下问题:C# IAuthClient.Send方法的具体用法?C# IAuthClient.Send怎么用?C# IAuthClient.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAuthClient
的用法示例。
在下文中一共展示了IAuthClient.Send方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendAuthChallengeErrorReply
/// <summary>
/// Sends an authentication challenge error to the client.
/// </summary>
/// <param name="client">the client</param>
/// <param name="error">the authentication challenge error to send</param>
public static void SendAuthChallengeErrorReply(IAuthClient client, AccountStatus error)
{
using (var packet = new AuthPacketOut(AuthServerOpCode.AUTH_LOGON_CHALLENGE))
{
packet.Write((byte)0x00);
packet.Write((byte)error);
client.Send(packet);
}
}
示例2: SendAuthChallengeSuccessReply
/// <summary>
/// Sends an authentication challenge success reply to the client.
/// </summary>
/// <param name="client">the client</param>
public static void SendAuthChallengeSuccessReply(IAuthClient client)
{
using (var packet = new AuthPacketOut(AuthServerOpCode.AUTH_LOGON_CHALLENGE))
{
packet.Write((byte)AccountStatus.Success);
// Grunt command
packet.Write((byte)0x00);
client.Authenticator.WriteServerChallenge(packet);
//var rand = new BigInteger(new Random(Environment.TickCount), 128);
//packet.WriteBigInt(rand, 16);
Random rand = new Random(Environment.TickCount);
byte[] randbytes = new byte[16];
rand.NextBytes(randbytes);
packet.Write(randbytes);
const byte securityFlag = 0x0;
packet.Write(securityFlag);
// Require PIN input
//if ((securityFlag & 0x1) == 0x1)
//{
// packet.WriteInt(0);
// packet.Write(new byte[16]);
//}
// Matrix input
//if ((securityFlag & 0x2) == 0x2)
//{
// packet.Write((byte)0);
// packet.Write((byte)0);
// packet.Write((byte)0);
// packet.Write((byte)0);
// packet.Write(0UL);
//}
// Require Security Token input
//if ((securityFlag & 0x4) == 0x4)
//{
// packet.Write((byte)1);
//}
client.Send(packet);
}
}
示例3: SendAuthProofSuccessReply
/// <summary>
/// Sends an authentication proof success reply to the client.
/// </summary>
/// <param name="client">the client</param>
public static void SendAuthProofSuccessReply(IAuthClient client)
{
using (var packet = new AuthPacketOut(AuthServerOpCode.AUTH_LOGON_PROOF))
{
packet.Write((byte)AccountStatus.Success);
client.Authenticator.WriteServerProof(packet);
packet.WriteInt(0);
packet.WriteInt(0);
packet.WriteShort(0);
client.Send(packet);
}
}
示例4: SendAuthReconnectProof
public static void SendAuthReconnectProof(IAuthClient client)
{
using (var packet = new AuthPacketOut(AuthServerOpCode.AUTH_RECONNECT_PROOF))
{
packet.Write((byte)0);// error
packet.Write((short)0);
client.Send(packet);
}
}
示例5: SendRealmList
/// <summary>
/// Sends the realm list to the client.
/// </summary>
/// <param name="client">the Session the incoming packet belongs to</param>
public static void SendRealmList(IAuthClient client)
{
if (client.Account == null)
{
AuthenticationHandler.OnLoginError(client, AccountStatus.Failure);
return;
}
using (var packet = new AuthPacketOut(AuthServerOpCode.REALM_LIST))
{
packet.Position += 2; // Packet length
packet.Write(0); // Unknown Value (0x0000)
//var cpos = packet.Position;
//packet.Position = cpos + 2;
packet.Write((short)AuthenticationServer.RealmCount);
//var count = 0;
foreach (var realm in AuthenticationServer.Realms)
{
// check for client version
//if (realm.ClientVersion.IsSupported(client.Info.Version))
realm.WriteRealm(client, packet);
}
//packet.Write((byte)0x15);
packet.Write((byte)0x10);
packet.Write((byte)0x00);
//packet.Position = cpos;
//packet.WriteShort(count);
packet.Position = 1;
packet.Write((short)packet.TotalLength - 3);
client.Send(packet);
}
}