示例#1
0
        private void method_12()
        {
            int num = int.Parse(GoldTree.GetConfig().data["client.ping.interval"]);

            if (num <= 100)
            {
                throw new ArgumentException("Invalid configuration value for ping interval! Must be above 100 miliseconds.");
            }
            while (true)
            {
                try
                {
                    ServerMessage     Message = new ServerMessage(50u);
                    List <GameClient> list    = new List <GameClient>();
                    List <GameClient> list2   = new List <GameClient>();
                    for (int i = 0; i < this.Session.Length; i++)
                    {
                        GameClient @class = this.Session[i];
                        if (@class != null)
                        {
                            if (@class.bool_0)
                            {
                                @class.bool_0 = false;
                                list2.Add(@class);
                            }
                            else
                            {
                                list.Add(@class);
                            }
                        }
                    }
                    foreach (GameClient @class in list)
                    {
                        try
                        {
                            @class.method_12();
                        }
                        catch
                        {
                        }
                    }
                    byte[] byte_ = Message.GetBytes();
                    foreach (GameClient @class in list2)
                    {
                        try
                        {
                            @class.GetConnection().SendData(byte_);
                        }
                        catch
                        {
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logging.LogThreadException(ex.ToString(), "Connection checker task");
                }
                Thread.Sleep(num);
            }
        }
示例#2
0
 public void method_25(uint uint_0)
 {
     for (int i = 0; i < this.Clients.Length; i++)
     {
         GameClient @class = this.Clients[i];
         if (@class != null && @class.GetHabbo() != null && @class.GetHabbo().Id == uint_0)
         {
             @class.method_12();
         }
     }
 }
 public void method_2(GameClient Session, string string_0, double double_0, string string_1, bool bool_0)
 {
     if (!Session.GetHabbo().isJuniori)
     {
         ModerationBanType enum4_ = ModerationBanType.USERNAME;
         string text = Session.GetHabbo().Username;
         string object_ = "user";
         double num = GoldTree.GetUnixTimestamp() + double_0;
         if (bool_0)
         {
             enum4_ = ModerationBanType.IP;
             if (!LicenseTools.bool_20)
             {
                 text = Session.GetConnection().String_0;
             }
             else
             {
                 using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                 {
                     text = @class.ReadString("SELECT ip_last FROM users WHERE Id = " + Session.GetHabbo().Id + " LIMIT 1;");
                 }
             }
             object_ = "ip";
         }
         this.list_0.Add(new ModerationBan(enum4_, text, string_1, num));
         using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
         {
             @class.AddParamWithValue("rawvar", object_);
             @class.AddParamWithValue("var", text);
             @class.AddParamWithValue("reason", string_1);
             @class.AddParamWithValue("mod", string_0);
             @class.ExecuteQuery(string.Concat(new object[]
             {
                 "INSERT INTO bans (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES (@rawvar,@var,@reason,'",
                 num,
                 "',@mod,'",
                 DateTime.Now.ToLongDateString(),
                 "', '1')"
             }));
         }
         if (bool_0)
         {
             DataTable dataTable = null;
             using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
             {
                 @class.AddParamWithValue("var", text);
                 dataTable = @class.ReadDataTable("SELECT Id FROM users WHERE ip_last = @var");
             }
             if (dataTable == null)
             {
                 goto IL_268;
             }
             IEnumerator enumerator = dataTable.Rows.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     DataRow dataRow = (DataRow)enumerator.Current;
                     using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                     {
                         @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + (uint)dataRow["Id"] + "' LIMIT 1");
                     }
                 }
                 goto IL_268;
             }
             finally
             {
                 IDisposable disposable = enumerator as IDisposable;
                 if (disposable != null)
                 {
                     disposable.Dispose();
                 }
             }
         }
         using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
         {
             @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1");
         }
         IL_268:
         Session.method_7("You have been banned: " + string_1);
         Session.method_12();
     }
 }