private static AppRegistry LoadRegistry(string jsonFileName) { var dto = AppsDto.Load(jsonFileName); var registry = new AppRegistry(dto.Apps.Select(x => new AppInfo(x.Id, x.DisplayName, x.LauncherId, x.LauncherParams))); return(registry); }
private JsonFileAppRegistryProvider(AppRegistry registry, string jsonFileName) { _jsonFileName = Path.GetFullPath(jsonFileName); var jsonFileDirectory = Path.GetDirectoryName(_jsonFileName) ?? throw new InvalidOperationException(); Current = registry; _watcher = new FileSystemWatcher(jsonFileDirectory) { EnableRaisingEvents = true, Filter = Path.GetFileName(_jsonFileName), NotifyFilter = NotifyFilters.LastWrite, }; _watcher.Changed += OnFileChanged; }