本文整理汇总了C#中Emulator.Common.IO.BigEndianReader.Seek方法的典型用法代码示例。如果您正苦于以下问题:C# BigEndianReader.Seek方法的具体用法?C# BigEndianReader.Seek怎么用?C# BigEndianReader.Seek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Emulator.Common.IO.BigEndianReader
的用法示例。
在下文中一共展示了BigEndianReader.Seek方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckAccount
public void CheckAccount()
{
if (message == null)
{
Logger.Error("Trying to check an account without identification message.");
client.Stop();
return;
}
if (message.Version.ToString() != CURRENT_VERSION)
{
client.Send(
new IdentificationFailedForBadVersionMessage((sbyte) IdentificationFailureReasonEnum.BAD_VERSION,
new Common.Protocol.Net.Types.Version.Version(2,11,2,72101,1,0)));
client.Stop();
return;
}
byte[] credentials = RSA.Decrypt(message.Credentials);
BigEndianReader reader = new BigEndianReader(credentials);
reader.Seek(Encoding.UTF8.GetByteCount(salt));
int lenght = reader.ReadByte();
string username = Encoding.UTF8.GetString(reader.ReadBytes(lenght));
string password = Encoding.UTF8.GetString(reader.ReadBytes(reader.Available));
AccountModel account = AccountsTable.Load(username);
if (account == null || account.Password != password)
{
client.Send(new IdentificationFailedMessage((sbyte)IdentificationFailureReasonEnum.WRONG_CREDENTIALS));
client.Stop();
}
else if (account.Banned)
{
client.Send(new IdentificationFailedBannedMessage((sbyte)IdentificationFailureReasonEnum.BANNED, 0));
client.Stop();
}
else
{
ValidAccount(account, message.Autoconnect);
}
}