internal void SaveInterpreterOptions() { _interpreterRegistry.BeginSuppressInterpretersChangedEvent(); try { _interpreterOptionsService.DefaultInterpreterId = GlobalInterpreterOptions.DefaultInterpreter; // Remove any items foreach (var option in InterpreterOptions.Select(kv => kv.Value).Where(o => o.Removed).ToList()) { _interpreterOptionsService.RemoveConfigurableInterpreter(option._config.Id); RemoveInterpreterOptions(option._config.Id); } // Add or update any items that weren't removed foreach (var option in InterpreterOptions.Select(x => x.Value)) { if (option.Added) { if (String.IsNullOrWhiteSpace(option.Id)) { option.Id = Guid.NewGuid().ToString(); } option.Added = false; } if (option.IsConfigurable) { // save configurable interpreter options var actualFactory = _interpreterOptionsService.AddConfigurableInterpreter( option.Description, new InterpreterConfiguration( option.Id, option.Description, !String.IsNullOrWhiteSpace(option.InterpreterPath) ? PathUtils.GetParent(option.InterpreterPath) : "", option.InterpreterPath ?? "", option.WindowsInterpreterPath ?? "", option.PathEnvironmentVariable ?? "", InterpreterArchitecture.TryParse(option.Architecture), Version.Parse(option.Version) ?? new Version(2, 7) ) ); } } foreach (var factory in InterpreterOptions.Where(x => x.Value.Id.StartsWith("Placeholder;")).ToArray()) { RemoveInterpreterOptions(factory.Value.Id); } } finally { _interpreterRegistry.EndSuppressInterpretersChangedEvent(); } }
internal void LoadInterpreterOptions() { BeginSuppressRaiseEnvironmentsChanged(); try { var placeholders = InterpreterOptions.Where(kv => kv.Key is InterpreterPlaceholder).ToArray(); ClearInterpreterOptions(); foreach (var interpreter in _interpreterOptionsService.Interpreters) { GetInterpreterOptions(interpreter); } foreach (var kv in placeholders) { AddInterpreterOptions(kv.Key, kv.Value); } } finally { EndSuppressRaiseEnvironmentsChanged(); } }
internal void LoadInterpreterOptions() { BeginSuppressRaiseEnvironmentsChanged(); try { var placeholders = InterpreterOptions.Where(kv => kv.Key.StartsWith("Placeholder;")).ToArray(); ClearInterpreterOptions(); foreach (var interpreter in _interpreterRegistry.Configurations) { GetInterpreterOptions(interpreter.Id); } foreach (var kv in placeholders) { AddInterpreterOptions(kv.Key, kv.Value); } } finally { EndSuppressRaiseEnvironmentsChanged(); } }