本文整理汇总了C#中Essential.HabboHotel.GameClients.GameClient.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.Disconnect方法的具体用法?C# GameClient.Disconnect怎么用?C# GameClient.Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Essential.HabboHotel.GameClients.GameClient
的用法示例。
在下文中一共展示了GameClient.Disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BanUser
public void BanUser(GameClient Session, string string_0, double length, string reason, bool banIp)
{
if (!Session.GetHabbo().IsJuniori)
{
ModerationBanType enum4_ = ModerationBanType.USERNAME;
string text = Session.GetHabbo().Username;
string object_ = "user";
double timestamp = Essential.GetUnixTimestamp() + length;
if (banIp)
{
enum4_ = ModerationBanType.IP;
if (!ServerConfiguration.IPLastBan)
text = Session.GetConnection().String_0;
else
{
using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
{
text = dbClient.ReadString("SELECT ip_last FROM users WHERE Id = " + Session.GetHabbo().Id + " LIMIT 1;");
}
}
object_ = "ip";
}
this.Bans.Add(new ModerationBan(enum4_, text, reason, timestamp));
using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("rawvar", object_);
dbClient.AddParamWithValue("var", text);
dbClient.AddParamWithValue("reason", reason);
dbClient.AddParamWithValue("mod", string_0);
dbClient.ExecuteQuery(string.Concat(new object[]
{
"INSERT INTO bans (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES (@rawvar,@var,@reason,'",
timestamp,
"',@mod,'",
DateTime.Now.ToLongDateString(),
"', '1')"
}));
dbClient.ExecuteQuery(string.Concat(new object[]
{
"INSERT INTO banlog (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES (@rawvar,@var,@reason,'",
timestamp,
"',@mod,'",
DateTime.Now.ToLongDateString(),
"', '1')"
}));
}
if (banIp)
{
DataTable dataTable = null;
using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("var", text);
dataTable = dbClient.ReadDataTable("SELECT Id FROM users WHERE ip_last = @var");
}
if (dataTable != null)
{
IEnumerator enumerator = dataTable.Rows.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
DataRow dataRow = (DataRow)enumerator.Current;
using (DatabaseClient @class = Essential.GetDatabase().GetClient())
{
@class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + (uint)dataRow["Id"] + "' LIMIT 1");
}
}
}
finally
{
IDisposable disposable = enumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
}
}
using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1");
}
Session.NotifyBan(reason);
Session.Disconnect("Banned!");
}
}