-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utils.cs
38 lines (30 loc) · 1.18 KB
/
Utils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
namespace StatusBot
{
public class Utils
{
public static List<ServerData> GetOurServers()
{
ServerList serverList = Servers.GetServerList();
List<ServerData> ourServers = new List<ServerData>();
int index = 0;
do
{
ServerData server = serverList.serverData.ElementAt(index);
if (server.Name.StartsWith(Program.GetConfig().ServerNamePrefix))
ourServers.Add(server);
index++;
} while (index < serverList.serverData.Count);
return ourServers;
}
public static List<ServerData> GetServers(string withGamemode = "", string withNamePrefix = "", string? withMap = "")
{
ServerList serverList = Servers.GetServerList();
List<ServerData> result;
result = serverList.serverData.Where((ServerData data) =>
data.Gamemode.ToLower().StartsWith(withGamemode.ToLower())
&& data.Name.ToLower().StartsWith(withNamePrefix.ToLower())
&& data.Map.ToLower().StartsWith(withMap.ToLower())).ToList();
return result;
}
}
}