Beispiel #1
0
 public void Flush()
 {
     _firstTimeLoadProfile = true;
     _urlToken             = string.Empty;
     _csrfToken            = string.Empty;
     _playerName           = string.Empty;
     _lastSignIn           = string.Empty;
     _createdOn            = string.Empty;
     _userHash             = string.Empty;
     _motto                = string.Empty;
     _homepageVisible      = false;
     _friendRequestAllowed = false;
     _showOnlineStatus     = false;
     _offlineMessaging     = false;
     _friendsCanFollow     = false;
     _gender               = HGender.Unknown;
     _age              = 0;
     ClientStarting    = string.Empty;
     _gameData         = HGameData.Empty;
     _flashClientBuild = string.Empty;
     _flashClientUrl   = string.Empty;
     _port             = 0;
     _host             = string.Empty;
     _addresses        = null;
     _ssoTicket        = string.Empty;
 }
Beispiel #2
0
        private void HandleResource(HPages Page, ref string Body)
        {
            PlayerID    = int.Parse(Body.GetChild("var habboId = ", ';'));
            _PlayerName = Body.GetChild("var habboName = \"", '\"');
            _Age        = int.Parse(Body.GetChild("kvage=", ';'));
            _Gender     = (HGenders)Char.ToUpper(Body.GetChild("kvgender=", ';')[0]);
            _CSRFToken  = Body.GetChild("<meta name=\"csrf-token\" content=\"", '\"');

            switch (Page)
            {
            case HPages.Me:
            {
                string[] InfoBoxes = Body.GetChilds("<div class=\"content\">", '<');
                _Motto      = InfoBoxes[6].Split('>')[1];
                _LastSignIn = InfoBoxes[12].Split('>')[1];
                break;
            }

            case HPages.Home:
            {
                _CreatedOn = Body.GetChild("<div class=\"birthday date\">", '<');
                _Motto     = Body.GetChild("<div class=\"profile-motto\">", '<');
                break;
            }

            case HPages.Profile:
            {
                _URLToken = Body.GetChild("name=\"urlToken\" value=\"", '\"');
                break;
            }

            case HPages.Client:
            {
                _Host      = Body.GetChild("\"connection.info.host\" : \"", '\"');
                _Port      = int.Parse(Body.GetChild("\"connection.info.port\" : \"", '\"').Split(',')[0]);
                _Addresses = Dns.GetHostAddresses(_Host).Select(IP => IP.ToString()).ToArray();
                _SSOTicket = Body.GetChild("\"sso.ticket\" : \"", '\"');

                if (string.IsNullOrEmpty(ClientStarting))
                {
                    ClientStarting = Body.GetChild("\"client.starting\" : \"", '\"');
                }
                else
                {
                    Body = Body.Replace(Body.GetChild("\"client.starting\" : \"", '\"'), ClientStarting);
                }

                _UserHash = Body.GetChild("\"user.hash\" : \"", '\"');
                _GameData = HGameData.Parse(Body);

                _FlashClientURL      = "http://" + Body.GetChild("\"flash.client.url\" : \"", '\"').Substring(3) + "Habbo.swf";
                _FlashClientRevision = _FlashClientURL.Split('/')[4];
                break;
            }
            }
        }
Beispiel #3
0
 public void Flush()
 {
     _URLToken            = string.Empty;
     _CSRFToken           = string.Empty;
     _PlayerName          = string.Empty;
     _Motto               = string.Empty;
     _LastSignIn          = string.Empty;
     _CreatedOn           = string.Empty;
     _Gender              = HGenders.Unknown;
     _Age                 = 0;
     _UserHash            = string.Empty;
     ClientStarting       = string.Empty;
     _GameData            = HGameData.Empty;
     _FlashClientURL      = string.Empty;
     _FlashClientRevision = string.Empty;
     _Port                = 0;
     _Host                = string.Empty;
     _AddFriend           = null;
     _SSOTicket           = string.Empty;
 }
Beispiel #4
0
        private void HandleResource(HPage page, ref string body)
        {
            PlayerId    = int.Parse(body.GetChild("var habboId = ", ';'));
            _playerName = body.GetChild("var habboName = \"", '\"');
            _age        = int.Parse(body.GetChild("kvage=", ';'));
            _gender     = (HGender)Char.ToUpper(body.GetChild("kvgender=", ';')[0]);
            _csrfToken  = body.GetChild("<meta name=\"csrf-token\" content=\"", '\"');

            switch (page)
            {
            case HPage.Me:
            {
                string[] infoBoxes = body.GetChilds("<div class=\"content\">", '<');
                _motto      = infoBoxes[6].Split('>')[1];
                _lastSignIn = infoBoxes[12].Split('>')[1];
                break;
            }

            case HPage.Home:
            {
                _createdOn = body.GetChild("<div class=\"birthday date\">", '<');
                _motto     = body.GetChild("<div class=\"profile-motto\">", '<');
                break;
            }

            case HPage.Profile:
            {
                _firstTimeLoadProfile = false;
                _urlToken             = body.GetChild("name=\"urlToken\" value=\"", '\"');

                _homepageVisible      = body.GetChild("name=\"visibility\" value=\"EVERYONE\"", '/').Contains("checked");
                _friendRequestAllowed = body.GetChild("name=\"friendRequestsAllowed\"", '/').Contains("checked");
                _showOnlineStatus     = body.GetChild("name=\"showOnlineStatus\" value=\"true\"", '/').Contains("checked");
                _offlineMessaging     = body.GetChild("name=\"persistentMessagingAllowed\" checked=\"checked\"", '/').Contains("true");
                _friendsCanFollow     = body.GetChild("name=\"followFriendMode\" value=\"1\"").Contains("checked");
                break;
            }

            case HPage.Client:
            {
                _host      = body.GetChild("\"connection.info.host\" : \"", '\"');
                _port      = int.Parse(body.GetChild("\"connection.info.port\" : \"", '\"').Split(',')[0]);
                _addresses = Dns.GetHostAddresses(_host).Select(ip => ip.ToString()).ToArray();
                _ssoTicket = body.GetChild("\"sso.ticket\" : \"", '\"');

                if (string.IsNullOrEmpty(ClientStarting))
                {
                    ClientStarting = body.GetChild("\"client.starting\" : \"", '\"');
                }
                else
                {
                    body = body.Replace(body.GetChild("\"client.starting\" : \"", '\"'), ClientStarting);
                }

                _userHash = body.GetChild("\"user.hash\" : \"", '\"');
                _gameData = HGameData.Parse(body);

                _flashClientUrl   = "http://" + body.GetChild("\"flash.client.url\" : \"", '\"').Substring(3) + "Habbo.swf";
                _flashClientBuild = _flashClientUrl.Split('/')[4];

                body = body.Replace("\"\\//", "\"http://");
                break;
            }
            }
        }