public static void usewl(string[] s) { if (s.Length == 2) { Console.WriteLine(Filemanager.toggleWhitelist((Boolean.Parse(s[1])))); } else { Console.WriteLine("Wrong number of arguments"); } }
public static void removefromwl(string[] s) { if (s.Length == 2) { Console.WriteLine(Filemanager.removefromwl(s[1])); } else { Console.WriteLine("Wrong number of arguments"); } }
public static void unban(string[] s) { if (s.Length == 2) { Console.WriteLine(Filemanager.removeFromBlacklist(s[1], "")); } else { Console.WriteLine("Wrong number of arguments"); } }
public static void ban(string[] s) { if (s.Length == 2) { Console.WriteLine(Filemanager.blacklist(s[1], "")); kick(s, 1); } else { Console.WriteLine("Wrong number of arguments"); } }
private void connectClient(string[] data, Message e) { try { string username = data[1]; Boolean isAlreadyConnected = usernames.Contains(username); usernames.Add(username); if (isAlreadyConnected) { e.ReplyLine($"$kck${username}$3"); return; } int index = usernames.IndexOf(username); string ip = Program.clients[index].Client.RemoteEndPoint.ToString().Split(':')[0]; if (Filemanager.isBanned(username) || Filemanager.isIpBanned(ip)) { e.ReplyLine($"$kck${username}$1"); return; } else if (useWhitelist && !Filemanager.isOnWhitelist(username)) { e.ReplyLine($"$kck${username}$2"); return; } else { if (Program.isFirstConnection) { //Console.WriteLine("First connection, fetching Data..."); e.ReplyLine("$gad"); Program.isFirstConnection = false; } else { //Console.WriteLine("Not first connection."); e.ReplyLine("$rad"); sendAllData(e); } Console.WriteLine(currentTimeStamp() + " User connected: " + username); } } catch (Exception ex) { Consolemanager.error("connect client", ex); } }
public static void listwl() { if (Filemanager.whitelistedUsers() == null) { Console.WriteLine("No users were whitelisted."); } else { foreach (string s in Filemanager.whitelistedUsers()) { Console.WriteLine(s); } } }
public static void listbanned() { var banned = Filemanager.bannedUsers(); if (banned == null || banned.Length == 0) { Console.WriteLine("No users were banned."); } else { foreach (string s in Filemanager.bannedUsers()) { Console.WriteLine(s.Replace(";", " ")); } } }
public static void banip(string[] s) { if (s.Length == 2) { if (Program.manager.usernames.Contains(s[1])) { int index = Program.manager.usernames.IndexOf(s[1]); string ip = Program.clients[index].Client.RemoteEndPoint.ToString().Split(':')[0]; Console.WriteLine(Filemanager.blacklist(s[1], ip)); kick(s, 1); } else { Console.WriteLine($"User {s[1]} is not connected."); } } else { Console.WriteLine("Wrong number of arguments"); } }