当前位置: 首页>>代码示例>>C#>>正文


C# GameClient.Disconnect方法代码示例

本文整理汇总了C#中Mercury.HabboHotel.GameClients.GameClient.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.Disconnect方法的具体用法?C# GameClient.Disconnect怎么用?C# GameClient.Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mercury.HabboHotel.GameClients.GameClient的用法示例。


在下文中一共展示了GameClient.Disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BanUser


//.........这里部分代码省略.........
			string text = Client.GetHabbo().Username;
			string query = "user";
			double num = (double)MercuryEnvironment.GetUnixTimestamp() + LengthSeconds;
			if (IpBan)
			{
				type = ModerationBanType.IP;
				using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
				{
					queryreactor.setQuery("SELECT ip_last FROM users WHERE username='" + text + "' LIMIT 1");
					text = queryreactor.getString();
				}
				query = "ip";
			}
			if (Machine)
			{
				type = ModerationBanType.MACHINE;
				query = "machine";
				text = Client.MachineId;
			}
			ModerationBan moderationBan = new ModerationBan(type, text, Reason, num);
			if (moderationBan.Type == ModerationBanType.IP)
			{
                if (this.bannedIPs.Contains(text))
				{
					this.bannedIPs[text] = moderationBan;
				}
				else
				{
					this.bannedIPs.Add(text, moderationBan);
				}
			}
			else
			{
				if (moderationBan.Type == ModerationBanType.MACHINE)
				{
					if (this.bannedMachines.ContainsKey(text))
					{
						this.bannedMachines[text] = moderationBan;
					}
					else
					{
						this.bannedMachines.Add(text, moderationBan);
					}
				}
				else
				{
                    if (this.bannedUsernames.Contains(text))
					{
						this.bannedUsernames[text] = moderationBan;
					}
					else
					{
						this.bannedUsernames.Add(text, moderationBan);
					}
				}
			}
			using (IQueryAdapter queryreactor2 = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
			{
				queryreactor2.setQuery(string.Concat(new object[]
				{
					"INSERT INTO bans (bantype,value,reason,expire,added_by,added_date) VALUES (@rawvar,@var,@reason,'",
					num,
					"',@mod,'",
					DateTime.Now.ToLongDateString(),
					"')"
				}));
				queryreactor2.addParameter("rawvar", query);
				queryreactor2.addParameter("var", text);
				queryreactor2.addParameter("reason", Reason);
				queryreactor2.addParameter("mod", Moderator);
				queryreactor2.runQuery();
			}
			if (IpBan)
			{
				DataTable dataTable = null;
				using (IQueryAdapter queryreactor3 = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
				{
					queryreactor3.setQuery("SELECT id FROM users WHERE ip_last = @var");
					queryreactor3.addParameter("var", text);
					dataTable = queryreactor3.getTable();
				}
				if (dataTable != null)
				{
					using (IQueryAdapter queryreactor4 = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
					{
						foreach (DataRow dataRow in dataTable.Rows)
						{
							queryreactor4.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Convert.ToUInt32(dataRow["id"]));
						}
					}
				}
				this.BanUser(Client, Moderator, LengthSeconds, Reason, false, false);
				return;
			}
			using (IQueryAdapter queryreactor5 = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
			{
				queryreactor5.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Client.GetHabbo().Id);
			}
			Client.Disconnect();
		}
开发者ID:BjkGkh,项目名称:Mercury,代码行数:101,代码来源:ModerationBanManager.cs


注:本文中的Mercury.HabboHotel.GameClients.GameClient.Disconnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。