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; } } }
private string LoadResource(HPages Page) { using (WebClientEx WC = new WebClientEx(Cookies)) { string Body = string.Empty; string URL = Page.Juice(Hotel) + (Page == HPages.Home ? PlayerName : string.Empty); WC.Headers["User-Agent"] = SKore.ChromeAgent; Body = WC.DownloadString(URL); HandleResource(Page, ref Body); return(Body); } }
public static string Juice(this HPages Page, HHotels Hotel) { switch (Page) { case HPages.Client: return(Hotel.ToURL() + "/client"); case HPages.Home: return(Hotel.ToURL() + "/home/"); case HPages.IDAvatars: return(Hotel.ToURL() + "/identity/avatars"); case HPages.IDSettings: return(Hotel.ToURL() + "/identity/settings"); case HPages.Me: return(Hotel.ToURL() + "/me"); case HPages.Profile: return(Hotel.ToURL() + "/profile"); default: return(string.Empty); } }
public string this[HPages Page] { get { return(LoadResource(Page)); } }