| 52 | } |
| 53 | |
| 54 | ResourceManager::ResourceManager() |
| 55 | { |
| 56 | /*-------------------------------------------------------------------------*\ |
| 57 | | Initialize Detection Variables | |
| 58 | \*-------------------------------------------------------------------------*/ |
| 59 | detection_enabled = true; |
| 60 | detection_percent = 100; |
| 61 | detection_string = ""; |
| 62 | detection_is_required = false; |
| 63 | DetectDevicesThread = nullptr; |
| 64 | dynamic_detectors_processed = false; |
| 65 | |
| 66 | SetupConfigurationDirectory(); |
| 67 | |
| 68 | /*-------------------------------------------------------------------------*\ |
| 69 | | Load settings from file | |
| 70 | \*-------------------------------------------------------------------------*/ |
| 71 | settings_manager = new SettingsManager(); |
| 72 | |
| 73 | settings_manager->LoadSettings(GetConfigurationDirectory() / "OpenRGB.json"); |
| 74 | |
| 75 | /*-------------------------------------------------------------------------*\ |
| 76 | | Configure the log manager | |
| 77 | \*-------------------------------------------------------------------------*/ |
| 78 | LogManager::get()->configure(settings_manager->GetSettings("LogManager"), GetConfigurationDirectory()); |
| 79 | |
| 80 | /*-------------------------------------------------------------------------*\ |
| 81 | | Initialize Server Instance | |
| 82 | | If configured, pass through full controller list including clients | |
| 83 | | Otherwise, pass only local hardware controllers | |
| 84 | \*-------------------------------------------------------------------------*/ |
| 85 | json server_settings = settings_manager->GetSettings("Server"); |
| 86 | bool all_controllers = false; |
| 87 | |
| 88 | if(server_settings.contains("all_controllers")) |
| 89 | { |
| 90 | all_controllers = server_settings["all_controllers"]; |
| 91 | } |
| 92 | |
| 93 | if(all_controllers) |
| 94 | { |
| 95 | server = new NetworkServer(rgb_controllers); |
| 96 | } |
| 97 | else |
| 98 | { |
| 99 | server = new NetworkServer(rgb_controllers_hw); |
| 100 | } |
| 101 | |
| 102 | /*-------------------------------------------------------------------------*\ |
| 103 | | Initialize Saved Client Connections | |
| 104 | \*-------------------------------------------------------------------------*/ |
| 105 | json client_settings = settings_manager->GetSettings("Client"); |
| 106 | |
| 107 | if(client_settings.contains("clients")) |
| 108 | { |
| 109 | for(unsigned int client_idx = 0; client_idx < client_settings["clients"].size(); client_idx++) |
| 110 | { |
| 111 | NetworkClient * client = new NetworkClient(rgb_controllers); |
nothing calls this directly
no test coverage detected