public static bool Remove(string strName) { if (!FavouriteList.Contains(strName)) { return(false); } return(FavouriteList.faveList.Remove(strName)); }
public static void Add(string strName) { if (FavouriteList.Contains(strName)) { return; } if (strName.Length < 8) { return; } FavouriteList.faveList.Add(strName); }
private void Add_Server(int iMaxPlayers, int iCurrentPlayers, int iPing, uint iLastPlayed, [In, MarshalAs(UnmanagedType.LPStr)] string strHostname, [In, MarshalAs(UnmanagedType.LPStr)] string strAddress, int iPort, int iQueryPort, [In, MarshalAs(UnmanagedType.LPStr)] string tags, bool bPassworded, int iType) { string strName = strAddress + ":" + iPort.ToString(); Server item = new Server { name = strHostname, address = strAddress, maxplayers = iMaxPlayers, currentplayers = iCurrentPlayers, ping = iPing, lastplayed = iLastPlayed, port = iPort, queryport = iQueryPort, fave = FavouriteList.Contains(strName) }; if (item.name.Length > 0x40) { item.name = item.name.Substring(0, 0x40); } if (!this.ShouldIgnoreServer(item)) { this.playerCount += iCurrentPlayers; this.serverCount++; this.slotCount += iMaxPlayers; this.needsServerListUpdate = true; int num = (int)((((float)this.playerCount) / ((float)this.slotCount)) * 100f); string[] textArray1 = new string[] { "Found ", this.playerCount.ToString(), " players on ", this.serverCount.ToString(), " servers. We are at ", num.ToString(), "% capacity." }; this.detailsLabel.Text = string.Concat(textArray1); if (iType == 3) { this.servers[5].Add(item); this.categoryButtons[5].UpdateServerCount(this.servers[5].Count); } else if (iType == 4) { int num2 = (int)POSIX.Time.ElapsedSecondsSince((int)item.lastplayed); string str2 = string.Empty; if (num2 < 60) { str2 = num2.ToString() + " seconds ago"; } else if (num2 < 0xe10) { str2 = ((num2 / 60)).ToString() + " minutes ago"; } else if (num2 < 0x2a300) { str2 = (((num2 / 60) / 60)).ToString() + " hours ago"; } else { str2 = ((((num2 / 60) / 60) / 0x18)).ToString() + " days ago"; } item.name = item.name + " (" + str2 + ")"; this.servers[4].Add(item); this.categoryButtons[4].UpdateServerCount(this.servers[4].Count); } else if (tags.Contains("official")) { this.servers[0].Add(item); this.categoryButtons[0].UpdateServerCount(this.servers[0].Count); } else { char[] separator = new char[] { ',' }; foreach (string str3 in tags.Split(separator)) { ulong num4; if ((!str3.StartsWith("mp") && !str3.StartsWith("cp")) && (str3.StartsWith("sg:") && ulong.TryParse(str3.Substring(3), NumberStyles.HexNumber, null, out num4))) { if (SteamGroups.MemberOf(num4)) { this.servers[3].Add(item); this.categoryButtons[3].UpdateServerCount(this.servers[3].Count); } return; } } if (tags.Contains("modded")) { this.servers[2].Add(item); this.categoryButtons[2].UpdateServerCount(this.servers[2].Count); } else if (!strHostname.Contains("oxide", true) && !strHostname.Contains("rust++", true)) { this.servers[1].Add(item); this.categoryButtons[1].UpdateServerCount(this.servers[1].Count); } } } }
private void Add_Server(int iMaxPlayers, int iCurrentPlayers, int iPing, uint iLastPlayed, [In] string strHostname, [In] string strAddress, int iPort, int iQueryPort, [In] string tags, bool bPassworded, int iType) { ulong num; string str = string.Concat(strAddress, ":", iPort.ToString()); ServerBrowser.Server server = new ServerBrowser.Server() { name = strHostname, address = strAddress, maxplayers = iMaxPlayers, currentplayers = iCurrentPlayers, ping = iPing, lastplayed = iLastPlayed, port = iPort, queryport = iQueryPort, fave = FavouriteList.Contains(str) }; if (server.name.Length > 64) { server.name = server.name.Substring(0, 64); } if (this.ShouldIgnoreServer(server)) { return; } ServerBrowser serverBrowser = this; serverBrowser.playerCount = serverBrowser.playerCount + iCurrentPlayers; ServerBrowser serverBrowser1 = this; serverBrowser1.serverCount = serverBrowser1.serverCount + 1; ServerBrowser serverBrowser2 = this; serverBrowser2.slotCount = serverBrowser2.slotCount + iMaxPlayers; this.needsServerListUpdate = true; int num1 = (int)((float)this.playerCount / (float)this.slotCount * 100f); this.detailsLabel.Text = string.Concat(new string[] { "Found ", this.playerCount.ToString(), " players on ", this.serverCount.ToString(), " servers. We are at ", num1.ToString(), "% capacity." }); if (iType == 3) { this.servers[5].Add(server); this.categoryButtons[5].UpdateServerCount(this.servers[5].Count); return; } if (iType == 4) { int num2 = (int)POSIX.Time.ElapsedSecondsSince((int)server.lastplayed); string empty = string.Empty; if (num2 < 60) { empty = string.Concat(num2.ToString(), " seconds ago"); } else if (num2 < 3600) { int num3 = num2 / 60; empty = string.Concat(num3.ToString(), " minutes ago"); } else if (num2 >= 172800) { int num4 = num2 / 60 / 60 / 24; empty = string.Concat(num4.ToString(), " days ago"); } else { int num5 = num2 / 60 / 60; empty = string.Concat(num5.ToString(), " hours ago"); } ServerBrowser.Server server1 = server; server1.name = string.Concat(server1.name, " (", empty, ")"); this.servers[4].Add(server); this.categoryButtons[4].UpdateServerCount(this.servers[4].Count); return; } if (tags.Contains("official")) { this.servers[0].Add(server); this.categoryButtons[0].UpdateServerCount(this.servers[0].Count); return; } string[] strArrays = tags.Split(new char[] { ',' }); for (int i = 0; i < (int)strArrays.Length; i++) { string str1 = strArrays[i]; if (!str1.StartsWith("mp")) { if (!str1.StartsWith("cp")) { if (str1.StartsWith("sg:") && ulong.TryParse(str1.Substring(3), NumberStyles.HexNumber, null, out num)) { if (!SteamGroups.MemberOf(num)) { return; } this.servers[3].Add(server); this.categoryButtons[3].UpdateServerCount(this.servers[3].Count); return; } } } } if (tags.Contains("modded")) { this.servers[2].Add(server); this.categoryButtons[2].UpdateServerCount(this.servers[2].Count); return; } if (strHostname.Contains("oxide", true)) { return; } if (strHostname.Contains("rust++", true)) { return; } this.servers[1].Add(server); this.categoryButtons[1].UpdateServerCount(this.servers[1].Count); }