private void Reload() { var isCustom = false; var bindsFile = FileOperations.RetryIfNull( () => BindingPreset.FindActivePresetFile(_gameInstallFolder, _gameOptionsFolder, out isCustom), _reloadRetries); if (bindsFile == null) { return; } var bindingPreset = FileOperations.RetryIfNull( () => BindingPreset.FromFile(bindsFile), _reloadRetries); if (isCustom) { _customBindsWatcher.Filter = Path.GetFileName(bindsFile); _customBindsWatcher.Start(); } if (bindingPreset == null) { return; } Changed?.Invoke(this, bindingPreset); }
private void Reload() { var bindsFiles = FileOperations.RetryIfNull( () => BindingPreset.FindActivePresetFiles(_gameInstallFolder, _gameOptionsFolder), _reloadRetries); if (bindsFiles == null) { return; } var uniquePresets = new Dictionary <string, BindingPreset>(StringComparer.Ordinal); foreach (var bindsFile in bindsFiles.Values) { if (uniquePresets.ContainsKey(bindsFile)) { continue; } var bindingPreset = FileOperations.RetryIfNull( () => BindingPreset.FromFile(bindsFile), _reloadRetries); if (bindingPreset == null) { return; } uniquePresets.Add(bindsFile, bindingPreset); } var binds = bindsFiles.ToDictionary(kv => kv.Key, kv => uniquePresets[kv.Value]); var merged = BindingPreset.MergeFromCategories(binds); Changed?.Invoke(this, merged); }
private void Reload() { var bindsFile = BindingPreset.FindActivePresetFile(_gameInstallFolder, _gameOptionsFolder, out var isCustom); if (bindsFile == null) { return; } var bindingPreset = BindingPreset.FromFile(bindsFile); if (isCustom) { _customBindsWatcher.Filter = Path.GetFileName(bindsFile); _customBindsWatcher.Start(); } if (bindingPreset == null) { return; } Changed?.Invoke(this, bindingPreset); }