private byte[] BuildPubDirQuery(int GGNumber, string firstname, string lastname, string nickname, string birthYear, string city, GGGender gender, bool activeOnly, out string queryStr) { queryStr = string.Empty; if (GGNumber != 0) queryStr += string.Format("FmNumber.{0}.", GGNumber.ToString()); if (firstname != string.Empty) queryStr += string.Format("firstname.{0}.", firstname); if (lastname != string.Empty) queryStr += string.Format("lastname.{0}.", lastname); if (nickname != string.Empty) queryStr += string.Format("nickname.{0}.", nickname); if (birthYear != string.Empty) queryStr += string.Format("birthyear.{0}.", birthYear); if (city != string.Empty) queryStr += string.Format("city.{0}.", city); if (gender == GGGender.Male) queryStr += "gender.2."; if (gender == GGGender.Female) queryStr += "gender.1."; if (activeOnly) queryStr += "ActiveOnly.1."; if (string.IsNullOrEmpty(queryStr)) return new byte[] { }; queryStr = queryStr.TrimEnd(new char[] { '.' }); return Str2ByteArray(queryStr); }
private void PublicFolderSearch(int GGNumber, string firstname, string lastname, string nickname, string birthYear, string city, GGGender gender, bool activeOnly) { byte[] queryArray = BuildPubDirQuery(GGNumber, firstname, lastname, nickname, birthYear, city, gender, activeOnly, out queryStr); stPubDir OutPubDir = new stPubDir(); OutPubDir.Header.Type = OUT_PUBDIR_REQUEST; OutPubDir.Header.Size = 5 + (uint)queryArray.Length; OutPubDir.RequestType = OUT_PUBDIR_SEARCH; ForwardData(RawSerialize(OutPubDir), 0); ForwardData(queryArray, 0); }