public CPythonInterpreterFactoryProvider() { Instance = this; HashSet <string> registeredPaths = new HashSet <string>(); using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) using (var python = baseKey.OpenSubKey(PythonCorePath)) { if (python != null) { RegisterInterpreters(registeredPaths, python, ProcessorArchitecture.X86); } } if (Environment.Is64BitOperatingSystem) { using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) using (var python64 = baseKey.OpenSubKey(PythonCorePath)) { if (python64 != null) { RegisterInterpreters(registeredPaths, python64, ProcessorArchitecture.Amd64); } } } var arch = Environment.Is64BitOperatingSystem ? null : (ProcessorArchitecture?)ProcessorArchitecture.X86; using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)) using (var python = baseKey.OpenSubKey(PythonCorePath)) { if (python != null) { RegisterInterpreters(registeredPaths, python, arch); } } }
public CPythonInterpreterFactoryProvider() { Instance = this; HashSet<string> registeredPaths = new HashSet<string>(); using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) using (var python = baseKey.OpenSubKey(PythonCorePath)) { if (python != null) { RegisterInterpreters(registeredPaths, python, ProcessorArchitecture.X86); } } if (Environment.Is64BitOperatingSystem) { using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) using (var python64 = baseKey.OpenSubKey(PythonCorePath)) { if (python64 != null) { RegisterInterpreters(registeredPaths, python64, ProcessorArchitecture.Amd64); } } } var arch = Environment.Is64BitOperatingSystem ? null : (ProcessorArchitecture?)ProcessorArchitecture.X86; using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)) using (var python = baseKey.OpenSubKey(PythonCorePath)) { if (python != null) { RegisterInterpreters(registeredPaths, python, arch); } } }
public CPythonInterpreterFactoryProvider() { Debug.Assert(Instance == null); Instance = this; HashSet <string> registeredPaths = new HashSet <string>(); foreach (var baseKey in new[] { Registry.LocalMachine, Registry.CurrentUser }) { using (var python = baseKey.OpenSubKey(PythonCorePath)) { if (python != null) { RegisterInterpreters(registeredPaths, python, CpyInterpreterGuid, "Python", ProcessorArchitecture.X86); } } } if (Environment.Is64BitOperatingSystem) { foreach (var baseHive in new[] { RegistryHive.LocalMachine, RegistryHive.CurrentUser }) { var python64 = RegistryKey.OpenBaseKey(baseHive, RegistryView.Registry64).OpenSubKey(PythonCorePath); if (python64 != null) { RegisterInterpreters(registeredPaths, python64, _cpy64InterpreterGuid, "Python 64-bit", ProcessorArchitecture.Amd64); } } } }