Пример #1
0
        private static void ProcessPackages(string fullPath, bool register, VsRegistrationContext context)
        {
            // Look for all the registration types in the assembly.

            SortedList <System.Type, List <RegistrationAttribute> > registrationTypes = GetRegistrationTypes(fullPath);

            // Iterate over each type.

            foreach (KeyValuePair <System.Type, List <RegistrationAttribute> > pair in registrationTypes)
            {
                pair.Value.Sort(RegistrationAttributeComparer.Default);
                foreach (RegistrationAttribute attribute in pair.Value)
                {
                    context.SetType(pair.Key);
                    if (register)
                    {
                        attribute.Register(context);
                    }
                    else
                    {
                        attribute.Unregister(context);
                    }
                }
            }
        }
Пример #2
0
        private static void ProcessPackages(string fullPath, bool register)
        {
            // Try to get the registry root.

            string registryRoot = GetRegistryRoot(fullPath);

            if (registryRoot == null)
            {
                return;
            }

            // Create the context to process the packages.

            using (VsRegistryKey key = new VsRegistryKey(registryRoot))
            {
                using (VsRegistrationContext context = new VsRegistrationContext(key, RegistrationMethod.CodeBase))
                {
                    ProcessPackages(fullPath, register, context);
                }
            }
        }