public static bool addBan(NetworkID id, string reason) { if (BanList.ContainsKey(id.steamID.m_SteamID)) { return(false); } else { string bantime = Pipliz.Time.FullTimeStamp(); Data.BanData bd = new Data.BanData(id, reason, bantime); BanList.Add(id.steamID.m_SteamID, bd); SaveBanList(); return(true); } }
public static void loadBanList() { try { JSONNode array; if (Pipliz.JSON.JSON.Deserialize(savePath, out array, false)) { if (array != null) { foreach (JSONNode node in array.LoopArray()) { try { ulong id = node["id"].GetAs <ulong>(); string reason = node["reason"].GetAs <string>(); string bantime = node["bantime"].GetAs <string>(); if (!BanList.ContainsKey(id)) { Data.BanData bd = new Data.BanData(new NetworkID(new Steamworks.CSteamID(id)), reason, bantime); BanList.Add(id, bd); } } catch (Exception exception) { Utilities.WriteLog("Exception loading ban list;" + exception.Message); } } Utilities.WriteLog("Loaded Ban List"); } else { Utilities.WriteLog("Loading Ban list Returned 0 results"); } } else { Utilities.WriteLog("Found no ban list (read error?)"); } } catch (Exception exception2) { Utilities.WriteLog("Exception in loading all bans:" + exception2.Message); } }