本文整理汇总了C#中ResultSet.Read方法的典型用法代码示例。如果您正苦于以下问题:C# ResultSet.Read方法的具体用法?C# ResultSet.Read怎么用?C# ResultSet.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultSet
的用法示例。
在下文中一共展示了ResultSet.Read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Item
/// <summary>
/// Create a new Item with a result set from the database
/// </summary>
/// <param name="set"></param>
public Item(ResultSet set)
{
this.Id = set.Read<Int32>("ItemId");
this.CreatorId = set.Read<Int32>("CreatorId");
this.Slot = (Byte)set.Read<Int32>("Slot");
this.Quantity = (UInt32)set.Read<Int32>("Quantity");
this.Equiped = set.Read<Boolean>("Equiped");
Attributes = new Byte[17];
Attributes[0] = 0x40;
}
示例2: 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();
}
}