BandObjectLib.BandObject.Register C# (CSharp) Method

Register() private method

private Register ( Type t ) : void
t System.Type
return void
        public static void Register(Type t)
        {
            string guid = t.GUID.ToString("B");

            RegistryKey rkClass = Registry.ClassesRoot.CreateSubKey(@"CLSID\" + guid);
            RegistryKey rkCat = rkClass.CreateSubKey("Implemented Categories");

            BandObjectAttribute[] boa = (BandObjectAttribute[])t.GetCustomAttributes(
                typeof(BandObjectAttribute),
                false);

            string name = t.Name;
            string help = t.Name;
            BandObjectStyle style = 0;
            if (boa.Length == 1)
            {
                if (boa[0].Name != null)
                    name = boa[0].Name;

                if (boa[0].HelpText != null)
                    help = boa[0].HelpText;

                style = boa[0].Style;
            }

            rkClass.SetValue(null, name);
            rkClass.SetValue("MenuText", name);
            rkClass.SetValue("HelpText", help);

            if (0 != (style & BandObjectStyle.Vertical))
                rkCat.CreateSubKey("{00021493-0000-0000-C000-000000000046}");

            if (0 != (style & BandObjectStyle.Horizontal))
                rkCat.CreateSubKey("{00021494-0000-0000-C000-000000000046}");

            if (0 != (style & BandObjectStyle.TaskbarToolBar))
                rkCat.CreateSubKey("{00021492-0000-0000-C000-000000000046}");

            if (0 != (style & BandObjectStyle.ExplorerToolbar))
                Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Toolbar").SetValue(guid, name);
        }