public bool IsBannedIP(string ip) { return(DataStore.GetInstance().Get("Ips", ip) != null); }
public bool IsBannedID(string id) { return(DataStore.GetInstance().Get("Ids", id) != null); }
private bool ProcessoDeSalvamento() { if (ServerIsSaving) { Logger.Log("[Fougerite WorldSave] Server's thread is still saving. We are ignoring the save request."); return(false); } ServerIsSaving = true; path = ServerSaveManager.autoSavePath; AvatarSaveProc.SaveAll(); DataStore.GetInstance().Save(); restart = SystemTimestamp.Restart; if (path == string.Empty) { path = "savedgame.sav"; } if (!path.EndsWith(".sav")) { path = path + ".sav"; } if (ServerSaveManager._loading) { Logger.LogError("[Fougerite WorldSave] Currently loading, aborting save to " + path); return(false); } else { Debug.Log("Saving to '" + path + "'"); if (!ServerSaveManager._loadedOnce) { if (File.Exists(path)) { string[] textArray1 = new string[] { path, ".", ServerSaveManager.DateTimeFileString(File.GetLastWriteTime(path)), ".", ServerSaveManager.DateTimeFileString(DateTime.Now), ".bak" }; string destFileName = string.Concat(textArray1); File.Copy(path, destFileName); Logger.LogError( "A save file exists at target path, but it was never loaded!\n\tbacked up:" + Path.GetFullPath(destFileName)); } ServerSaveManager._loadedOnce = true; } using (Recycler <WorldSave, WorldSave.Builder> recycler = WorldSave.Recycler()) { if (recycler != null) { builder = recycler.OpenBuilder(); timestamp2 = SystemTimestamp.Restart; s = ServerSaveManager.Get(false); } else { Logger.LogError("SOMETHING IS F****D, RECYCLER IS NULL."); } } return(true); } }
private void StartBackGroundWorkerManualBackgroundSave() { if (ServerIsSaving) { Logger.Log( "[Fougerite WorldSave] Server's thread is still saving. We are ignoring the save request."); return; } try { ServerIsSaving = true; path = ServerSaveManager.autoSavePath; AvatarSaveProc.SaveAll(); DataStore.GetInstance().Save(); restart = SystemTimestamp.Restart; if (path == string.Empty) { path = "savedgame.sav"; } if (!path.EndsWith(".sav")) { path = path + ".sav"; } if (ServerSaveManager._loading) { Logger.LogError("[Fougerite WorldSave] Currently loading, aborting save to " + path); } else { Debug.Log("Saving to '" + path + "'"); if (!ServerSaveManager._loadedOnce) { if (File.Exists(path)) { string[] textArray1 = new string[] { path, ".", ServerSaveManager.DateTimeFileString(File.GetLastWriteTime(path)), ".", ServerSaveManager.DateTimeFileString(DateTime.Now), ".bak" }; string destFileName = string.Concat(textArray1); File.Copy(path, destFileName); Logger.LogError( "A save file exists at target path, but it was never loaded!\n\tbacked up:" + Path.GetFullPath(destFileName)); } ServerSaveManager._loadedOnce = true; } using (Recycler <WorldSave, WorldSave.Builder> recycler = WorldSave.Recycler()) { if (recycler != null) { builder = recycler.OpenBuilder(); timestamp2 = SystemTimestamp.Restart; s = ServerSaveManager.Get(false); } else { Logger.LogError("SOMETHING IS F****D, RECYCLER IS NULL."); } } BackgroundWorker BGW = new BackgroundWorker(); BGW.DoWork += new DoWorkEventHandler(SaveServerManualWithoutInvoke); BGW.RunWorkerAsync(); } } catch (Exception ex) { Logger.LogError("[ServerSaveHandler Error1] " + ex); } }
public static Zone3D Get(string name) { Contract.Requires(!string.IsNullOrEmpty(name)); return(DataStore.GetInstance().Get("3DZonesList", name) as Zone3D); }
public static bool ConsoleReceived(ref ConsoleSystem.Arg a) { StringComparison ic = StringComparison.InvariantCultureIgnoreCase; bool external = a.argUser == null; bool adminRights = (a.argUser != null && a.argUser.admin) || external; string userid = "[external][external]"; if (adminRights && !external) { userid = string.Format("[{0}][{1}]", a.argUser.displayName, a.argUser.userID.ToString()); } string logmsg = string.Format("[ConsoleReceived] userid={0} adminRights={1} command={2}.{3} args={4}", userid, adminRights.ToString(), a.Class, a.Function, (a.HasArgs(1) ? a.ArgsStr : "none")); Logger.LogDebug(logmsg); if (a.Class.Equals("fougerite", ic) && a.Function.Equals("reload", ic)) { if (adminRights) { ModuleManager.ReloadModules(); a.ReplyWith("Fougerite: Reloaded!"); } } else if (a.Class.Equals("fougerite", ic) && a.Function.Equals("save", ic)) { AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); if (Fougerite.Server.GetServer().HasRustPP) { Fougerite.Server.GetServer().GetRustPPAPI().RustPPSave(); } DataStore.GetInstance().Save(); a.ReplyWith("Fougerite: Saved!"); } else if (a.Class.Equals("fougerite", ic) && a.Function.Equals("rustpp", ic)) { foreach (var module in Fougerite.ModuleManager.Modules) { if (module.Plugin.Name.Equals("RustPPModule")) { module.DeInitialize(); module.Initialize(); break; } } a.ReplyWith("Rust++ Reloaded!"); } else if (OnConsoleReceived != null) { OnConsoleReceived(ref a, external); } if (string.IsNullOrEmpty(a.Reply)) { a.ReplyWith(string.Format("Fougerite: {0}.{1} was executed!", a.Class, a.Function)); } return(true); }