public static PlayerExtList Load(string path, char separator = ' ') { PlayerExtList list = new PlayerExtList(); list.Path = path; list.Separator = separator; if (!File.Exists(path)) { File.Create(path).Close(); Logger.Log(LogType.SystemActivity, "CREATED NEW: " + path); return(list); } using (StreamReader r = new StreamReader(path, Encoding.UTF8)) { string line = null; while ((line = r.ReadLine()) != null) { list.lines.Add(line); int sepIndex = line.IndexOf(separator); string name = sepIndex >= 0 ? line.Substring(0, sepIndex) : line; list.names.Add(name); } } return(list); }
internal static void LoadPlayerLists() { agreed = PlayerList.Load("ranks/agreed.txt"); invalidIds = PlayerList.Load("extra/invalidids.txt"); Player.Console.DatabaseID = NameConverter.InvalidNameID("(console)"); bannedIP = PlayerList.Load("ranks/banned-ip.txt"); ircControllers = PlayerList.Load("ranks/IRC_Controllers.txt"); hidden = PlayerList.Load("ranks/hidden.txt"); vip = PlayerList.Load("text/vip.txt"); noEmotes = PlayerList.Load("text/emotelist.txt"); lockdown = PlayerList.Load("text/lockdown.txt"); models = PlayerExtList.Load("extra/models.txt"); skins = PlayerExtList.Load("extra/skins.txt"); reach = PlayerExtList.Load("extra/reach.txt"); rotations = PlayerExtList.Load("extra/rotations.txt"); modelScales = PlayerExtList.Load("extra/modelscales.txt"); muted = PlayerExtList.Load("ranks/muted.txt"); frozen = PlayerExtList.Load("ranks/frozen.txt"); tempRanks = PlayerExtList.Load(Paths.TempRanksFile); tempBans = PlayerExtList.Load(Paths.TempBansFile); if (Server.Config.WhitelistedOnly) { whiteList = PlayerList.Load("ranks/whitelist.txt"); } }
public override void Load(bool startup) { Command.Register(new CmdReloadEffects()); Command.Register(new CmdEffect()); Command.Register(new CmdSpawner()); rnd = new Random(); LoadEffects(); DefineEffectsAll(); playerEffects = PlayerExtList.Load("extra/playereffects.txt"); OnPlayerMoveEvent.Register(OnPlayerMove, Priority.Low); OnPlayerFinishConnectingEvent.Register(OnPlayerFinishConnecting, Priority.Low); OnLevelLoadedEvent.Register(OnLevelLoaded, Priority.Low); OnLevelUnloadEvent.Register(OnLevelUnload, Priority.Low); OnLevelDeletedEvent.Register(OnLevelDeleted, Priority.Low); OnLevelCopiedEvent.Register(OnLevelCopied, Priority.Low); OnLevelRenamedEvent.Register(OnLevelRenamed, Priority.Low); SpawnersFile.cache = new ThreadSafeCache(); if (!Directory.Exists(SpawnersFile.spawnerDirectory)) { Directory.CreateDirectory(SpawnersFile.spawnerDirectory); } Level[] levels = LevelInfo.Loaded.Items; foreach (Level level in levels) { SpawnersFile.Load(level); } spawnerAccum = 0; ActivateSpawners(); }
static void LoadPlayerLists(SchedulerTask task) { agreed = new PlayerList("ranks/agreed.txt"); try { UpgradeTasks.UpgradeOldAgreed(); agreed = PlayerList.Load("ranks/agreed.txt"); } catch (Exception ex) { Logger.LogError(ex); } bannedIP = PlayerList.Load("ranks/banned-ip.txt"); ircControllers = PlayerList.Load("ranks/IRC_Controllers.txt"); hidden = PlayerList.Load("ranks/hidden.txt"); vip = PlayerList.Load("text/vip.txt"); noEmotes = PlayerList.Load("text/emotelist.txt"); lockdown = PlayerList.Load("text/lockdown.txt"); jailed = PlayerExtList.Load("ranks/jailed.txt"); models = PlayerExtList.Load("extra/models.txt"); skins = PlayerExtList.Load("extra/skins.txt"); reach = PlayerExtList.Load("extra/reach.txt"); invalidIds = PlayerList.Load("extra/invalidids.txt"); rotations = PlayerExtList.Load("extra/rotations.txt"); modelScales = PlayerExtList.Load("extra/modelscales.txt"); muted = PlayerExtList.Load("ranks/muted.txt"); frozen = PlayerExtList.Load("ranks/frozen.txt"); tempRanks = PlayerExtList.Load(Paths.TempRanksFile); tempBans = PlayerExtList.Load(Paths.TempBansFile); ModerationTasks.QueueTasks(); if (ServerConfig.WhitelistedOnly) { whiteList = PlayerList.Load("ranks/whitelist.txt"); } }
void LoadPlayerLists() { agreed = new PlayerList("ranks/agreed.txt"); try { UpgradeTasks.UpgradeOldAgreed(); agreed = PlayerList.Load("agreed.txt"); } catch (Exception ex) { Server.ErrorLog(ex); } bannedIP = PlayerList.Load("banned-ip.txt"); ircControllers = PlayerList.Load("IRC_Controllers.txt"); muted = PlayerList.Load("muted.txt"); frozen = PlayerList.Load("frozen.txt"); hidden = PlayerList.Load("hidden.txt"); vip = PlayerList.Load("text/vip.txt"); noEmotes = PlayerList.Load("text/emotelist.txt"); lockdown = PlayerList.Load("text/lockdown.txt"); jailed = PlayerExtList.Load("ranks/jailed.txt"); models = PlayerExtList.Load("extra/models.txt"); skins = PlayerExtList.Load("extra/skins.txt"); reach = PlayerExtList.Load("extra/reach.txt"); invalidIds = PlayerList.Load("extra/invalidids.txt"); foreach (Group grp in Group.GroupList) { grp.playerList = PlayerList.Load(grp.fileName); } if (useWhitelist) { whiteList = PlayerList.Load("whitelist.txt"); } }
static void LoadAutoloadMaps(SchedulerTask task) { AutoloadMaps = PlayerExtList.Load("text/autoload.txt", '='); List <string> maps = AutoloadMaps.AllNames(); foreach (string map in maps) { if (map.CaselessEq(Server.Config.MainLevel)) { continue; } LevelActions.Load(Player.Console, map, false); } }
static void LoadAutoloadMaps(SchedulerTask task) { AutoloadMaps = PlayerExtList.Load("text/autoload.txt", '='); List <string> maps = AutoloadMaps.AllNames(); foreach (string map in maps) { if (map.CaselessEq(mainLevel.name)) { continue; } CmdLoad.LoadLevel(null, map); } }
public static PlayerExtList Load(string path) { PlayerExtList list = new PlayerExtList(); list.path = path; if (!File.Exists(path)) { File.Create(path).Close(); Server.s.Log("CREATED NEW: " + path); return(list); } using (StreamReader r = new StreamReader(path, Encoding.UTF8)) { string line = null; while ((line = r.ReadLine()) != null) { list.lines.Add(line); int space = line.IndexOf(' '); string name = space >= 0 ? line.Substring(0, space) : line; // Need to convert uppercase to lowercase, in case user added in entries. bool anyUpper = false; for (int i = 0; i < name.Length; i++) { char c = line[i]; anyUpper |= (c >= 'A' && c <= 'Z'); } if (anyUpper) { name = name.ToLower(); } list.players.Add(name); } } return(list); }