Example #1
0
 public DDEXKeys(WrappedRegistryKey vsKey)
 {
     if (vsKey != null)
     {
         VsKey            = vsKey;
         DataProvidersKey = WrappedRegistry.OpenSubKey(vsKey, "DataProviders", true);
         DataSourcesKey   = WrappedRegistry.OpenSubKey(vsKey, "DataSources", true);
     }
 }
Example #2
0
 private static void ApplyDDEXKeys(WrappedRegistryKey root, string vsRegPath)
 {
     using (var vsRootKey = WrappedRegistry.OpenSubKey(root, vsRegPath, false))
     {
         if (vsRootKey != null)
         {
             foreach (var vsKeyName in vsRootKey.GetSubKeyNames().Where(x => ValidVsVersion(x)))
             {
                 using (var ddexKeys = new DDEXKeys(WrappedRegistry.OpenSubKey(vsRootKey, vsKeyName, false)))
                 {
                     ddexKeys.Apply();
                 }
             }
         }
     }
 }
Example #3
0
 private static IEnumerable <WrappedRegistryKey> GetAssemblyFoldersExKeys(WrappedRegistryKey root, string regPath)
 {
     using (var rootKey = WrappedRegistry.OpenSubKey(root, regPath, false))
     {
         if (rootKey != null)
         {
             foreach (var version in Versions)
             {
                 var versionKey           = WrappedRegistry.OpenSubKey(rootKey, version, false);
                 var assemblyFoldersExKey = WrappedRegistry.OpenSubKey(versionKey, "AssemblyFoldersEx", true);
                 if (versionKey != null && assemblyFoldersExKey != null)
                 {
                     yield return(assemblyFoldersExKey);
                 }
             }
         }
     }
 }
Example #4
0
        private static void ApplyDDEXKeys(bool includeUsers)
        {
            ApplyDDEXKeys(WrappedRegistry.LocalMachine);

            // Install in VS >= 2017 using the VSIX package
            //var dir = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\VisualStudio"));
            //var hiveFiles = dir.GlobFiles("**/privateregistry.bin").Select(f => f.FullName);
            //foreach (var hiveFile in hiveFiles)
            //{
            //    using (var hive = new Hive(hiveFile))
            //    {
            //        ApplyDDEXKeys(hive.RegistryKey);
            //    }
            //}

            if (includeUsers)
            {
                foreach (var userKeyName in Registry.Users.GetSubKeyNames())
                {
                    ApplyDDEXKeys(WrappedRegistry.OpenSubKey(WrappedRegistry.Users, userKeyName, false));
                }
            }
        }