private MapSaveResponse SaveMapRot(MapApiParams p) { List <string> mapRot = p.Maps; MapSaveResponse r; sRMtx.WaitOne(); try { ServerMap.SaveMapRotation(Core, mapRot); //theres a good chance that only maps were updated //in this case we dont want to re-write ServerSettings.cfg -> check if Randomize changed if (Core.Server.Settings.Randomize != p.Randomize) { Core.Server.Settings.Randomize = p.Randomize; Core.Server.Settings.WriteToFile(Core); } r = new MapSaveResponse(); } catch (Exception e) { r = new MapSaveResponse(e); } finally { sRMtx.ReleaseMutex(); } return(r); }
private MapSaveResponse SaveMapRot(MapApiParams p) { List <string> mapRot = p.Maps; MapSaveResponse r; sRMtx.WaitOne(); try { ServerMap.SaveMapRotation(Core, mapRot); if (Core.Config.EnableRuntime && Core.Server.Status == ServerStatus.Online) { Core.Scheduler.PushTask(() => Core.Rcon.UpdateMapList(mapRot)); } //there's a good chance that only maps were updated //in this case we dont want to re-write ServerSettings.cfg -> check if Randomize changed if (Core.Server.Settings.Randomize != p.Randomize) { Core.Server.Settings.Randomize = p.Randomize; Core.Server.Settings.WriteToFile(Core); if (Core.Config.EnableRuntime && Core.Server.Status == ServerStatus.Online) { Core.Scheduler.PushTask(() => Core.Rcon.SendCommand("randomize", p.Randomize ? "1" : "0")); } } r = new MapSaveResponse(); } catch (Exception e) { r = new MapSaveResponse(e); } finally { sRMtx.ReleaseMutex(); } return(r); }