private void InitializeComponents() { callbacks = new ConcurrentQueue <Action>(); officers = new StorageManager <Officer>(); assignments = new List <Assignment>(); ofcAssignments = new Dictionary <Officer, Assignment>(); commands = new Dictionary <string, CommandAttribute>(); bolos = new StorageManager <Bolo>(); civs = new StorageManager <Civilian>(); civVehs = new StorageManager <CivilianVeh>(); currentCalls = new List <EmergencyCall>(); cfg = new iniconfig(Function.Call <string>(Hash.GET_CURRENT_RESOURCE_NAME), "settings.ini"); Permissions.SetInformation("permissions.perms", Function.Call <string>(Hash.GET_CURRENT_RESOURCE_NAME)); perms = Permissions.Get; perms.Refresh(); if (cfg.GetIntValue("server", "enable", 0) == 1) { ThreadPool.QueueUserWorkItem(x => server = new DispatchServer(cfg), null); Log.WriteLine("Starting DISPATCH server"); } else { Log.WriteLine("Not starting DISPATCH server"); } if (cfg.GetIntValue("database", "enable", 0) == 1) { Log.WriteLine("Reading database..."); data = new Database(); civs = data.Read <Civilian>("dsciv.db") ?? new StorageManager <Civilian>(); civVehs = data.Read <CivilianVeh>("dsveh.db") ?? new StorageManager <CivilianVeh>(); Log.WriteLine("Read and set database"); ThreadPool.QueueUserWorkItem(async x => { await Delay(15000); while (true) { #if DEBUG Log.WriteLine("Writing current information to database"); #else Log.WriteLineSilent("Writing current information to database"); #endif data.Write(civs, "dsciv.db"); data.Write(civVehs, "dsveh.db"); await Delay(180 * 1000); } }); } else { Log.WriteLine("Not start database"); } }
public Main() { _cruiseKey = (Control)_config.GetIntValue("keybinds", "toggle", 168); Debug.WriteLine($"{Common.Prefix} Cruise key: {(int) _cruiseKey}"); Debug.WriteLine($"{Common.Prefix} Resource name: {API.GetCurrentResourceName()}"); }
public ToastysCruiseControlClient() { _toggleCruiseControlKey = _config.GetIntValue("keybinds", "togglecruisecontrol", 168); API.DisableControlAction(0, _toggleCruiseControlKey, true); Main(); }