/// <summary> /// Execution Logic /// </summary> protected override void Execute(CodeActivityContext context) { try { MembersCount.Set(context, 0); MembersNames.Set(context, new Collection <string>() { }); string host = "https://api.meetup.com/2/rsvps?event_id={0}&sign=true&key={1}"; string url = string.Format(host, EventID.Get(context), ApiKey.Get(context)); string response = string.Empty; HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; if (null == request) { throw new ApplicationException("HttpWebRequest failed"); } using (StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream())) { response = sr.ReadToEnd(); } RawResponse.Set(context, response); Collection <string> names = new Collection <string>() { }; JObject o = JObject.Parse(response); JArray a = (JArray)o["results"]; foreach (JToken item in a) { names.Add(item["member"]["name"].ToString()); } MembersCount.Set(context, a.Count); MembersNames.Set(context, names); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public override global::System.Int32 GetHashCode() { unchecked { int hash = 5; hash ^= 397 * ClanId.GetHashCode(); hash ^= 397 * CreatedAt.GetHashCode(); hash ^= 397 * MembersCount.GetHashCode(); if (Name != null) { hash ^= 397 * Name.GetHashCode(); } if (Tag != null) { hash ^= 397 * Tag.GetHashCode(); } return(hash); } }
/// <summary> /// Execution Logic /// </summary> /// <param name="context"></param> protected override void Execute(CodeActivityContext context) { MembersCount.Set(context, 0); MembersNames.Set(context, new Collection <String>() { }); string host = "https://api.meetup.com/2/members?order=name&sign=true&group_urlname={0}&key={1}"; string url = String.Format(host, GroupUrlName.Get(context), ApiKey.Get(context)); string response = String.Empty; HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest; if (null == request) { throw new ApplicationException("HttpWebRequest failed"); } using (StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream())) { response = sr.ReadToEnd(); } RawResponse.Set(context, response); var names = new Collection <String>() { }; JObject o = JObject.Parse(response); JArray a = (JArray)o["results"]; foreach (var item in a) { names.Add(item["name"].ToString()); } MembersCount.Set(context, a.Count); MembersNames.Set(context, names); }
public void MemberScopeTest() { // Also tests both C-tors string path = System.IO.Path.GetFullPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\TestFiles\")); var gameMembers = new MembersCount[] { new MembersCount($@"{path}\gamePath\localisation\aow_l_english.yml", "3", "1"), new MembersCount($@"{path}\gamePath\localisation\manchu_l_english.yml", "43", "0"), new MembersCount($@"{path}\gamePath\localisation\EU4_l_english.yml", "1", "1"), new MembersCount($@"{path}\gamePath\localisation\emperor_map_l_english.yml", "91", "0") }; var modMembers = new MembersCount[] { new MembersCount() { Path = $@"modPath\localisation\mod_aow_l_english.yml" }, new MembersCount() { Path = $@"modPath\localisation\mod_manchu_l_english.yml" } }; foreach (var item in gameMembers) { item.MemberScope(path); Assert.IsTrue(item.Scope == Scope.Game); } foreach (var item in modMembers) { item.MemberScope(path); Assert.IsTrue(item.Scope == Scope.Mod); } }
public override int GetHashCode() { unchecked { return((Url != null ? Url.GetHashCode() : 0) ^ (Name != null ? Name.GetHashCode() : 0) ^ (Id != null ? Id.GetHashCode() : 0) ^ (Permission != null ? Permission.GetHashCode() : 0) ^ (MembersCount != null ? MembersCount.GetHashCode() : 0) ^ (ReposCount != null ? ReposCount.GetHashCode() : 0)); } }
public bool Contains(string filter) { return(ID.ToString().Contains(filter) || Name.Contains(filter) || Type.Contains(filter) || MembersCount.ToString().Contains(filter)); }
public void CheckMaxMemberCountAndThrowIfFailed(Character desiredCeoCharacter) { var desiredCEOMaxMembers = GetMaxmemberByCharacter(desiredCeoCharacter); MembersCount.ThrowIfGreater(desiredCEOMaxMembers, ErrorCodes.CorporationMaxMembersMismatch); }