本文整理汇总了C#中ResultSet.Reading方法的典型用法代码示例。如果您正苦于以下问题:C# ResultSet.Reading方法的具体用法?C# ResultSet.Reading怎么用?C# ResultSet.Reading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultSet
的用法示例。
在下文中一共展示了ResultSet.Reading方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCertifyLogin
/// <summary>
/// Certify client login
/// </summary>
/// <param name="dp">Incoming packet</param>
public void OnCertifyLogin(DataPacket dp)
{
String _name = dp.Read<String>();
String _password = dp.Read<String>();
#region Account checking
ResultSet _set = new ResultSet(Query.SELECT_LOGIN, _name);
if (_set.Reading() == false)
{
Log.Write(LogType.Error, "Cannot find account '{0}'", _name);
this.SendLoginError(Error.ERR_CERT_BAD_USERNAME);
this.Disconnect();
_set.Free();
return;
}
String _dbPassword = _set.Read<String>("Password");
if (_password.ToLower() != _dbPassword.ToLower())
{
Log.Write(LogType.Error, "Bad password for '{0}'", _name);
this.SendLoginError(Error.ERR_CERT_BAD_PASSWORD);
this.Disconnect();
_set.Free();
return;
}
Int32 _accountId = _set.Read<Int32>("Id");
Int32 _accountAuthority = _set.Read<Int32>("Authority");
if (_accountAuthority <= 0)
{
// TODO: send error account banned
this.Disconnect();
_set.Free();
return;
}
_set.Free();
#endregion
if (this.CheckLoginClientConnected(_name) == true)
{
this.SendLoginError(Error.ERR_ACCOUNT_EXIST); // ??
this.Disconnect();
return;
}
//Verification de la version des fichiers
String hdsn = dp.Read<String>();
byte[] ipKey = dp.ReadBytes(21);
string varchar = "";
for (int i = 0; i < ipKey.Length; i++)
if (ipKey[i] != 0)
varchar += ipKey[i].ToString();
SQL.ExecuteQuery(string.Format(Query.UPDATE_LASTIP, varchar, _name));
var version = dp.Read<UInt32>();
var realVersion = dp.Read<UInt32>();
var opFlag = dp.Read<Byte>();
var otpPassword = dp.Read<String>();
if (realVersion == Configuration.CurrentVersion)
{
this.User.AccountId = _accountId;
this.User.Username = _name;
this.User.Password = _password;
this.User.Authority = _accountAuthority;
this.User.Connected = true;
this.SendLoginSuccess();
this.LoadCharacterList();
this.SendCharacterList();
}
else
{
Log.Write(LogType.Debug, "version incorrecte du client : {0} au lieu de {1}", realVersion, Configuration.CurrentVersion);
this.SendVersionError(realVersion);
Disconnect();
}
}