public static void CheckSimpleCommunity(IJEnumerable <JToken> expected, CommunityInfo actual) { if (CheckCommunity(expected, actual)) { Assert.AreEqual(0u, actual.UserCount); Assert.AreEqual(( ushort )0u, actual.Level); } }
public static void CheckDetailCommunity(IJEnumerable <JToken> expected, CommunityInfo actual) { if (CheckCommunity(expected, actual)) { Assert.AreEqual(expected["user_count"].Value <uint>(), actual.UserCount); Assert.AreEqual(expected["level"].Value <ushort>(), actual.Level); } }
public void Init() { try{ itemPanel1.Items.Clear(); itemPanel2.Items.Clear(); itemPanel3.Items.Clear(); itemPanel4.Items.Clear(); foreach (GIGNewsEntry news in GigSpace.Client.GetNews()) { LabelItem it = new LabelItem(); it.Name = news.Name; it.Text = news.Name + " : " + news.Content; itemPanel3.Items.Add(it); } GigSpace.SetSTAT("Recherche des informations..."); CommunityInfo ci = GigSpace.Client.GetCommunityInfo(); GigSpace.SetSTAT("Informations trouvé..."); GigSpace.Connected = ci.NumberPlayers; GigSpace.SetCON(ci.NumberPlayers); foreach (GigServer sv in ci.Servers) { LabelItem it = new LabelItem(); it.Name = sv.Name; it.Text = sv.Name + " : (" + sv.EP.ToString() + ")"; itemPanel4.Items.Add(it); } int i = 0; foreach (string s in ci.TopTenPlayers) { i++; LabelItem it = new LabelItem(); it.Name = s; it.Text = i.ToString() + ". " + s; itemPanel1.Items.Add(it); } i = 0; foreach (string s in ci.TopTenRich) { i++; LabelItem it = new LabelItem(); it.Name = s; it.Text = i.ToString() + ". " + s; itemPanel2.Items.Add(it); } } catch (Exception ex) { GigSpace.LogError(ex); } }
private static bool CheckCommunity(IJEnumerable <JToken> expected, CommunityInfo actual) { var expected2 = expected as JObject; if (expected2 != null) { Assert.AreEqual(expected["id"].Value <uint>(), actual.RawId); Assert.AreEqual(expected["channel_id"] != null ? expected["channel_id"].Value <string>() : null, actual.ChannelId); Assert.AreEqual(expected["global_id"].Value <string>(), actual.Id); Assert.AreEqual(expected["name"].Value <string>(), actual.Name); Assert.AreEqual(expected["thumbnail"].Value <string>().ToUri(), actual.ThumbnailUrl); Assert.AreEqual(expected["thumbnail_small"].Value <string>().ToUri(), actual.SmallThumbnailUrl); return(true); } else { Assert.IsNull(actual); return(false); } }
/// <summary> /// Get availiable themes in the Themes folder. /// </summary> /// <returns>Returns a string array of all themes availiable.</returns> private static string[] GetThemes(CommunityInfo community) { // community theme directory reference DirectoryInfo themeDirectory = new DirectoryInfo( Global.Path.GetAbsoluteDiskPath(Global.Path.GetCommunityThemeDirectory(community.ID)) ); ArrayList themes = new ArrayList(); // gets all the themes in the default directory foreach(DirectoryInfo dir in themeDirectory.GetDirectories()) themes.Add(dir.Name); // remove directories to be excluded foreach(string s in _excludedDirectories) themes.Remove(s); // returns the list of themes return (string[])themes.ToArray(typeof(string)); }