()
| 253 | } |
| 254 | |
| 255 | public LoadData(): void { |
| 256 | const pluginState = this.storage.FetchPlugins(); |
| 257 | |
| 258 | pluginState.forEach(x => { |
| 259 | const p = this.pluginManager.FindPlugin(x.name); |
| 260 | |
| 261 | if (p === null) { |
| 262 | return; |
| 263 | } |
| 264 | |
| 265 | p.id = x.id; |
| 266 | p.enabled = x.enabled; |
| 267 | |
| 268 | const observables = new Set<string>(); |
| 269 | p.service.SetObservables(observables); |
| 270 | this.linkedStreams.AddPlugin(p.id, observables); |
| 271 | }); |
| 272 | this.pluginManager.ReorderPlugins(pluginState.map(x => x.id)); |
| 273 | |
| 274 | this.storage |
| 275 | .FetchObservables() |
| 276 | .forEach(x => { |
| 277 | const plugins: Plugin[] = []; |
| 278 | for (const name of x.plugins) { |
| 279 | const plugin = this.pluginManager.FindPlugin(name); |
| 280 | |
| 281 | if (plugin === null) { |
| 282 | Logger.Get.Log(`${x.url} has missing plugin '${name}'`); |
| 283 | return; |
| 284 | } |
| 285 | plugins.push(plugin); |
| 286 | } |
| 287 | |
| 288 | this.observables.set(x.url, { url: x.url, lastSeen: x.lastSeen, plugins }); |
| 289 | }); |
| 290 | |
| 291 | this.archive = this.storage.FetchArchiveRecords() |
| 292 | .map(x => ({ ...x, locked: false, tags: new Set<string>() })); |
| 293 | |
| 294 | this.storage.FetchArchiveTags() |
| 295 | .forEach(x => this.archive.find(y => y.filename === x.filename)?.tags.add(x.tag)); |
| 296 | |
| 297 | this.storage.FetchArchiveFilters() |
| 298 | .forEach(x => this.archiveFilters.set(x.id, x)); |
| 299 | |
| 300 | this.storage.FetchObservablesFilters() |
| 301 | .forEach(x => this.observablesFilters.set(x.id, x)); |
| 302 | } |
| 303 | private async StartResourceMonitor() { |
| 304 | this.systemResourcesMonitor = |
| 305 | await new SystemResourcesMonitorFactory(ARCHIVE_FOLDER, 10000).Create(); |
no test coverage detected