public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("sesskey")) { throw new GPParseException("sesskey is missing"); } SessionKey = RequestKeyValues["sesskey"]; if (!RequestKeyValues.ContainsKey("uniquenick")) { throw new GPParseException("uniquenick is missing"); } UniqueNick = RequestKeyValues["uniquenick"]; // PartnerId is optional if (RequestKeyValues.ContainsKey("partnerid")) { int partnerID; if (!int.TryParse(RequestKeyValues["partnerid"], out partnerID)) { throw new GPParseException("partnerid is missing"); } PartnerId = partnerID; } }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("opids") || !RequestKeyValues.ContainsKey("namespaceid")) { throw new GPParseException("opids or namespaceid is missing."); } try { ProfileIDs = RequestKeyValues["opids"].TrimStart('|').Split('|').Select(int.Parse).ToList(); } catch (System.Exception e) { throw new GPParseException("opids is incorrect", e); } if (RequestKeyValues.ContainsKey("namespaceid")) { int namespaceID; if (!int.TryParse(RequestKeyValues["namespaceid"], out namespaceID)) { throw new GPParseException("namespaceid is incorrect."); } NamespaceID = namespaceID; } }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("sesskey")) { throw new GPParseException("sesskey is missing"); } SessionKey = RequestKeyValues["sesskey"]; if (RequestKeyValues.ContainsKey("replace")) { if (!RequestKeyValues.ContainsKey("oldnick") && !RequestKeyValues.ContainsKey("nick")) { throw new GPParseException("oldnick or nick is missing."); } OldNick = RequestKeyValues["oldnick"]; NewNick = RequestKeyValues["nick"]; IsReplaceNickName = true; } else { if (!RequestKeyValues.ContainsKey("nick")) { throw new GPParseException("nick is missing."); } NewNick = RequestKeyValues["nick"]; IsReplaceNickName = false; } }
public override void Parse() { base.Parse(); Password = PasswordEncoder.ProcessPassword(RequestKeyValues); if (!RequestKeyValues.ContainsKey("nick")) { throw new GPParseException("nickname is missing."); } if (!RequestKeyValues.ContainsKey("email")) { throw new GPParseException("email is missing."); } if (!GameSpyUtils.IsEmailFormatCorrect(RequestKeyValues["email"])) { throw new GPParseException("email format is incorrect."); } Nick = RequestKeyValues["nick"]; Email = RequestKeyValues["email"]; if (RequestKeyValues.ContainsKey("uniquenick") && RequestKeyValues.ContainsKey("namespaceid")) { if (RequestKeyValues.ContainsKey("namespaceid")) { int namespaceID; if (!int.TryParse(RequestKeyValues["namespaceid"], out namespaceID)) { throw new GPParseException("namespaceid is incorrect."); } NamespaceID = namespaceID; } Uniquenick = RequestKeyValues["uniquenick"]; } ParseOtherInfo(); }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("status")) { throw new GPParseException("status is missing."); } if (!RequestKeyValues.ContainsKey("statstring")) { throw new GPParseException("statstring is missing."); } if (!RequestKeyValues.ContainsKey("locstring")) { throw new GPParseException("locstring is missing."); } int statusCode; if (!int.TryParse(RequestKeyValues["status"], out statusCode)) { throw new GPParseException("status format is incorrect."); } Status.CurrentStatus = (GPStatusCode)statusCode; Status.LocationString = RequestKeyValues["locstring"]; Status.StatusString = RequestKeyValues["statstring"]; }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("uniquenick") || !RequestKeyValues.ContainsKey("namespaces")) { throw new GPParseException("searchunique request is incomplete."); } try { Uniquenick = RequestKeyValues["uniquenick"]; } catch { throw new GPParseException("uniquenick is missing."); } try { Namespaces = RequestKeyValues["namespaces"].TrimStart(',').Split(',').Select(int.Parse).ToList(); } catch { throw new GPParseException("namespaces is incorrect."); } }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("productid")) { throw new GPParseException("productid is missing."); } if (!RequestKeyValues.ContainsKey("sesskey")) { throw new GPParseException("sesskey is missing."); } int productID; if (!int.TryParse(RequestKeyValues["productid"], out productID)) { throw new GPParseException("productid format is incorrect."); } ProductID = productID; int profileID; if (!int.TryParse(RequestKeyValues["profileid"], out profileID)) { throw new GPParseException("profileid format is incorrect."); } ProfileId = profileID; }
public override void Parse() { base.Parse(); Password = PasswordEncoder.ProcessPassword(RequestKeyValues); if (!RequestKeyValues.ContainsKey("email")) { throw new GPParseException("email is missing."); } IsRequireUniqueNicks = true; if (RequestKeyValues.ContainsKey("pass")) { // Old games might send an error is unique nicknames are sent (like GSA 1.0) IsRequireUniqueNicks = false; } Email = RequestKeyValues["email"]; if (RequestKeyValues.ContainsKey("namespaceid")) { int namespaceID; if (!int.TryParse(RequestKeyValues["namespaceid"], out namespaceID)) { throw new GPParseException("namespaceid is incorrect."); } NamespaceID = namespaceID; } }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("preferrednick")) { throw new GPParseException("preferrednick is missing."); } PreferredNick = RequestKeyValues["preferrednick"]; if (!RequestKeyValues.ContainsKey("gamename")) { throw new GPParseException("gamename is missing."); } GameName = RequestKeyValues["gamename"]; if (!RequestKeyValues.ContainsKey("namespaceid")) { throw new GPParseException("namespaceid is missing."); } int namespaceID; if (!int.TryParse(RequestKeyValues["namespaceid"], out namespaceID)) { throw new GPParseException("namespaceid is incorrect."); } NamespaceID = namespaceID; }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("state") || !RequestKeyValues.ContainsKey("hostIp") || !RequestKeyValues.ContainsKey("hprivIp") || !RequestKeyValues.ContainsKey("qport") || !RequestKeyValues.ContainsKey("hport") || !RequestKeyValues.ContainsKey("sessflags") || !RequestKeyValues.ContainsKey("rechStatus") || !RequestKeyValues.ContainsKey("gameType") || !RequestKeyValues.ContainsKey("gameVariant") || !RequestKeyValues.ContainsKey("gameMapName")) { throw new GPParseException("StatusInfo request is invalid."); } StatusInfo.StatusState = RequestKeyValues["state"]; StatusInfo.HostIP = RequestKeyValues["hostIp"]; StatusInfo.HostPrivateIP = RequestKeyValues["hprivIp"]; int qport; if (!int.TryParse(RequestKeyValues["qport"], out qport)) { throw new GPParseException("qport format is incorrect."); } StatusInfo.QueryReportPort = qport; int hport; if (int.TryParse(RequestKeyValues["hport"], out hport)) { throw new GPParseException("hport format is incorrect."); } StatusInfo.HostPort = hport; int sessflags; if (!int.TryParse(RequestKeyValues["sessflags"], out sessflags)) { throw new GPParseException("sessflags format is incorrect."); } StatusInfo.SessionFlags = sessflags; StatusInfo.RichStatus = RequestKeyValues["rechStatus"]; StatusInfo.GameType = RequestKeyValues["gameType"]; StatusInfo.GameVariant = RequestKeyValues["gameVariant"]; StatusInfo.GameMapName = RequestKeyValues["gameMapName"]; }
private void ParseOtherInfo() { //parse other info if (RequestKeyValues.ContainsKey("partnerid")) { int partnerid; if (!int.TryParse(RequestKeyValues["partnerid"], out partnerid)) { throw new GPParseException("partnerid is incorrect."); } HasPartnerIDFlag = true; PartnerID = partnerid; } if (RequestKeyValues.ContainsKey("productid")) { int productid; if (!int.TryParse(RequestKeyValues["productid"], out productid)) { throw new GPParseException("productid is incorrect."); } HasProductIDFlag = true; ProductID = productid; } if (RequestKeyValues.ContainsKey("gamename")) { HasGameNameFlag = true; GameName = RequestKeyValues["gamename"]; } if (RequestKeyValues.ContainsKey("port")) { int port; if (!int.TryParse(RequestKeyValues["port"], out port)) { throw new GPParseException("port is incorrect."); } HasGamePortFlag = true; GamePort = port; } if (RequestKeyValues.ContainsKey("cdkeyenc")) { HasCDKeyEncFlag = true; CDKeyEnc = RequestKeyValues["cdkeyenc"]; } }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("sesskey")) { throw new GPParseException("sesskey is missing"); } SessionKey = RequestKeyValues["sesskey"]; if (!RequestKeyValues.ContainsKey("cdkeyenc")) { throw new GPParseException("cdkeyenc is missing"); } CDKeyEnc = RequestKeyValues["cdkeyenc"]; }
public override void Parse() { base.Parse(); if (RequestKeyValues.ContainsKey("")) { } //cpubrandid //cpuspeed //memory //videocard1ram //videocard2ram //connectionid //connectionspeed //hasnetwork //pic }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("delprofileid")) { throw new GPParseException("delprofileid is missing."); } int deleteProfileID; if (!int.TryParse(RequestKeyValues["delprofileid"], out deleteProfileID)) { throw new GPParseException("delprofileid format is incorrect."); } DeleteProfileID = deleteProfileID; }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("sesskey") || !RequestKeyValues.ContainsKey("newprofileid") || !RequestKeyValues.ContainsKey("reason")) { throw new GPParseException("addbuddy request is invalid."); } int friendPID; if (!int.TryParse(RequestKeyValues["newprofileid"], out friendPID)) { throw new GPParseException("newprofileid format is incorrect."); } FriendProfileID = friendPID; Reason = RequestKeyValues["reason"]; }
public override void Parse() { base.Parse(); Password = PasswordEncoder.ProcessPassword(RequestKeyValues); if (!RequestKeyValues.ContainsKey("nick") || !RequestKeyValues.ContainsKey("email") || Password is null) { throw new GPParseException("check request is incompelete."); } if (!GameSpyUtils.IsEmailFormatCorrect(RequestKeyValues["email"])) { throw new GPParseException("email format is incorrect"); } Nick = RequestKeyValues["nick"]; Email = RequestKeyValues["email"]; if (RequestKeyValues.ContainsKey("partnerid")) { PartnerId = int.Parse(RequestKeyValues["partnerid"]); } }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("email") && !GameSpyUtils.IsEmailFormatCorrect(RequestKeyValues["email"])) { throw new GPParseException("valid request is incomplete."); } Email = RequestKeyValues["email"]; if (RequestKeyValues.ContainsKey("namespaceid")) { int namespaceID; if (!int.TryParse(RequestKeyValues["namespaceid"], out namespaceID)) { throw new GPParseException("namespaceid is incorrect."); } NamespaceID = namespaceID; } }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("gamename")) { throw new GPParseException("gamename is missing."); } if (!RequestKeyValues.ContainsKey("profileid") || !RequestKeyValues.ContainsKey("namespaceid")) { throw new GPParseException("profileid or namespaceid is missing."); } int profileID = 0; if (!RequestKeyValues.ContainsKey("profileid") && !int.TryParse(RequestKeyValues["profileid"], out profileID)) { throw new GPParseException("profileid is incorrect."); } if (RequestKeyValues.ContainsKey("namespaceid")) { int namespaceID; if (!int.TryParse(RequestKeyValues["namespaceid"], out namespaceID)) { throw new GPParseException("namespaceid is incorrect."); } NamespaceID = namespaceID; } ProfileId = profileID; GameName = RequestKeyValues["gamename"]; }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("profileid") && !RequestKeyValues.ContainsKey("nick") && !RequestKeyValues.ContainsKey("email") && !RequestKeyValues.ContainsKey("namespaceid") && !RequestKeyValues.ContainsKey("gamename")) { throw new GPParseException(" Search request is incomplete."); } if (RequestKeyValues.ContainsKey("gamename")) { GameName = RequestKeyValues["gamename"]; } if (RequestKeyValues.ContainsKey("profileid")) { int profileID; if (!int.TryParse(RequestKeyValues["profileid"], out profileID)) { throw new GPParseException("profileid is incorrect."); } ProfileId = profileID; } if (RequestKeyValues.ContainsKey("partnerid")) { int partnerID; if (!int.TryParse(RequestKeyValues["partnerid"], out partnerID)) { throw new GPParseException("partnerid is incorrect."); } PartnerID = partnerID; } if (RequestKeyValues.ContainsKey("skip")) { int skip; if (!int.TryParse(RequestKeyValues["skip"], out skip)) { throw new GPParseException("skip number is incorrect."); } SkipNum = skip; } if (RequestKeyValues.ContainsKey("uniquenick") && RequestKeyValues.ContainsKey("namespaceid")) { if (RequestKeyValues.ContainsKey("namespaceid")) { int namespaceID; if (!int.TryParse(RequestKeyValues["namespaceid"], out namespaceID)) { throw new GPParseException("namespaceid is incorrect."); } NamespaceID = namespaceID; } RequestType = SearchRequestType.UniquenickNamespaceIDSearch; Uniquenick = RequestKeyValues["uniquenick"]; } else if (RequestKeyValues.ContainsKey("nick") && RequestKeyValues.ContainsKey("email")) { RequestType = SearchRequestType.NickEmailSearch; Nick = RequestKeyValues["nick"]; Email = RequestKeyValues["email"]; } else if (RequestKeyValues.ContainsKey("nick")) { RequestType = SearchRequestType.NickSearch; Nick = RequestKeyValues["nick"]; } else if (RequestKeyValues.ContainsKey("email")) { //\search\\sesskey\0\profileid\0\namespaceid\1\email\[email protected]\gamename\conflictsopc\final\ Email = RequestKeyValues["email"]; RequestType = SearchRequestType.EmailSearch; } else { throw new GPParseException("unknown search request type."); } }
private void ParseOtherData() { if (RequestKeyValues.ContainsKey("userid")) { int userID; if (!int.TryParse(RequestKeyValues["userid"], out userID)) { throw new GPParseException("partnerid format is incorrect"); } UserID = userID; } if (RequestKeyValues.ContainsKey("profileid")) { int profileID; if (!int.TryParse(RequestKeyValues["profileid"], out profileID)) { throw new GPParseException("profileid format is incorrect"); } ProfileId = profileID; } if (RequestKeyValues.ContainsKey("partnerid")) { int partnerID; if (!int.TryParse(RequestKeyValues["partnerid"], out partnerID)) { throw new GPParseException("partnerid format is incorrect"); } PartnerID = partnerID; } //store sdkrevision if (RequestKeyValues.ContainsKey("sdkrevision")) { int sdkRevisionType; if (!int.TryParse(RequestKeyValues["sdkrevision"], out sdkRevisionType)) { throw new GPParseException("sdkrevision format is incorrect"); } SdkRevisionType = (SdkRevisionType)sdkRevisionType; } if (RequestKeyValues.ContainsKey("gamename")) { GameName = RequestKeyValues["gamename"]; } if (RequestKeyValues.ContainsKey("port")) { int htonGamePort; if (!int.TryParse(RequestKeyValues["port"], out htonGamePort)) { throw new GPParseException("port format is incorrect"); } GamePort = htonGamePort; } if (RequestKeyValues.ContainsKey("productid")) { int productID; if (!int.TryParse(RequestKeyValues["productid"], out productID)) { throw new GPParseException("productid format is incorrect"); } ProductID = productID; } if (RequestKeyValues.ContainsKey("firewall")) { Firewall = RequestKeyValues["firewall"]; } if (RequestKeyValues.ContainsKey("quiet")) { int quiet; if (!int.TryParse(RequestKeyValues["quiet"], out quiet)) { throw new GPParseException("quiet format is incorrect"); } QuietModeFlags = (QuietModeType)quiet; } }
public override void Parse() { base.Parse(); if (!RequestKeyValues.ContainsKey("challenge")) { throw new GPParseException("challenge is missing"); } if (!RequestKeyValues.ContainsKey("response")) { throw new GPParseException("response is missing"); } UserChallenge = RequestKeyValues["challenge"]; Response = RequestKeyValues["response"]; if (RequestKeyValues.ContainsKey("uniquenick") && RequestKeyValues.ContainsKey("namespaceid")) { int namespaceID; if (!int.TryParse(RequestKeyValues["namespaceid"], out namespaceID)) { throw new GPParseException("namespaceid format is incorrect"); } Type = LoginType.UniquenickNamespaceID; UniqueNick = RequestKeyValues["uniquenick"]; UserData = UniqueNick; NamespaceID = namespaceID; } else if (RequestKeyValues.ContainsKey("authtoken")) { Type = LoginType.AuthToken; AuthToken = RequestKeyValues["authtoken"]; UserData = AuthToken; } else if (RequestKeyValues.ContainsKey("user")) { Type = LoginType.NickEmail; UserData = RequestKeyValues["user"]; int Pos = UserData.IndexOf('@'); if (Pos == -1 || Pos < 1 || (Pos + 1) >= UserData.Length) { throw new GPParseException("user format is incorrect"); } Nick = UserData.Substring(0, Pos); Email = UserData.Substring(Pos + 1); // we need to get namespaceid for email login if (RequestKeyValues.ContainsKey("namespaceid")) { int namespaceID; if (!int.TryParse(RequestKeyValues["namespaceid"], out namespaceID)) { throw new GPParseException("namespaceid format is incorrect"); } NamespaceID = namespaceID; } } else { throw new GPParseException("Unknown login method detected."); } ParseOtherData(); }
public override void Parse() { base.Parse(); if (RequestKeyValues.ContainsKey("publicmask")) { PublicMasks mask; if (!Enum.TryParse(RequestKeyValues["publicmask"], out mask)) { throw new GPParseException("publicmask format is incorrect"); } HasPublicMaskFlag = true; PublicMask = mask; } if (!RequestKeyValues.ContainsKey("sesskey")) { throw new GPParseException("sesskey is missing"); } SessionKey = RequestKeyValues["sesskey"]; if (RequestKeyValues.ContainsKey("firstname")) { FirstName = RequestKeyValues["firstname"]; HasFirstNameFlag = true; } if (RequestKeyValues.ContainsKey("lastname")) { LastName = RequestKeyValues["lastname"]; HasLastNameFlag = true; } if (RequestKeyValues.ContainsKey("icquin")) { int icq; if (!int.TryParse(RequestKeyValues["icquin"], out icq)) { throw new GPParseException("icquin format is incorrect"); } HasICQFlag = true; ICQUIN = icq; } if (RequestKeyValues.ContainsKey("homepage")) { HasHomePageFlag = true; HomePage = RequestKeyValues["homepage"]; } if (RequestKeyValues.ContainsKey("birthday")) { int date; if (int.TryParse(RequestKeyValues["birthday"], out date)) { int d = ((date >> 24) & 0xFF); ushort m = (ushort)((date >> 16) & 0xFF); ushort y = (ushort)(date & 0xFFFF); if (GameSpyUtils.IsValidDate(d, m, y)) { BirthDay = d; BirthMonth = m; BirthYear = y; } } } if (RequestKeyValues.ContainsKey("sex")) { byte sex; if (!byte.TryParse(RequestKeyValues["sex"], out sex)) { throw new GPParseException("sex format is incorrect"); } HasSexFlag = true; Sex = sex; } if (RequestKeyValues.ContainsKey("zipcode")) { HasZipCode = true; ZipCode = RequestKeyValues["zipcode"]; } if (RequestKeyValues.ContainsKey("countrycode")) { HasCountryCode = true; CountryCode = RequestKeyValues["countrycode"]; } if (RequestKeyValues.ContainsKey("partnerid")) { int partnerid; if (!int.TryParse(RequestKeyValues["partnerid"], out partnerid)) { throw new GPParseException("partnerid is incorrect"); } PartnerID = partnerid; } if (!RequestKeyValues.ContainsKey("nick")) { throw new GPParseException("nickname is missing."); } Nick = RequestKeyValues["nick"]; if (!RequestKeyValues.ContainsKey("uniquenick")) { throw new GPParseException("uniquenick is missing."); } Uniquenick = RequestKeyValues["uniquenick"]; }