Ejemplo n.º 1
0
        public static void UnregisterClass(Type t)
        {
            CustomToolAttribute customToolAttribute = getCustomToolAttribute(t);

            Registry.LocalMachine.DeleteSubKey(GetKeyName(
                                                   CSharpCategoryGuid, customToolAttribute.Name), false);
        }
Ejemplo n.º 2
0
        public static void RegisterClass(Type t)
        {
            Type attributeType = typeof(GuidAttribute);

            object[] attributes = t.GetCustomAttributes(attributeType, /* inherit */ true);
            if (attributes.Length == 0)
            {
                throw new Exception(
                          String.Format("Class '{0}' does not provide a '{1}' attribute.",
                                        t.FullName, attributeType.FullName));
            }
            GuidAttribute       guidAttribute       = (GuidAttribute)((Attribute)attributes[0]);
            CustomToolAttribute customToolAttribute = getCustomToolAttribute(t);

            using (RegistryKey key = Registry.LocalMachine.CreateSubKey(
                       GetKeyName(CSharpCategoryGuid, customToolAttribute.Name)))
            {
                key.SetValue("", customToolAttribute.Description);
                key.SetValue("CLSID", "{" + guidAttribute.Value + "}");
                key.SetValue("GeneratesDesignTimeSource", 1);
            }
        }