コード例 #1
0
 public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
 {
     using (var key = packageKey.CreateSubKey("ApplicationIcon"))
     {
         key.SetValue(null, FileName);
     }
 }
コード例 #2
0
 public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
 {
     using (var key = packageKey.CreateSubKey("CommandLine\\" + Name))
     {
         key.SetValue("ExpectArgument", ExpectArgument ? 1 : 0);
     }
 }
コード例 #3
0
 public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
 {
     using (var key = packageKey.CreateSubKey("ApplicationIcon"))
     {
         key.SetValue(null, FileName);
     }
 }
コード例 #4
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string keyName;

            if (ProjectGuid.HasValue)
            {
                keyName = "Projects\\" + ProjectGuid.Value.ToString("B").ToUpperInvariant() + "\\Extensions\\" + Extension;
            }
            else
            {
                keyName = "Extensions\\" + Extension;
            }

            using (var key = packageKey.CreateSubKey(keyName))
            {
                if (DefaultName != null)
                {
                    key.SetValue(null, ResolveStringResource(package, DefaultName));
                    key.SetValue("DefaultName", DefaultName);
                }

                key.SetValue("FactoryType", FactoryType.GUID.ToString("B").ToUpperInvariant());
                key.SetValue("Priority", Priority);

                if (TemplateResource != null)
                {
                    key.SetValue("TemplateResource", TemplateResource);
                }
            }
        }
コード例 #5
0
 public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
 {
     using (var key = packageKey.CreateSubKey("CommandLine\\" + Name))
     {
         key.SetValue("ExpectArgument", ExpectArgument ? 1 : 0);
     }
 }
コード例 #6
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string guid = Type.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("CLSID\\" + guid))
            {
                key.SetValue("Class", Type.AssemblyQualifiedName);
            }
        }
コード例 #7
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string guid = Type.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("CLSID\\" + guid))
            {
                key.SetValue("Class", Type.AssemblyQualifiedName);
            }
        }
コード例 #8
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string factoryGuid = FactoryType.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("Editors\\" + factoryGuid))
            {
                key.SetValue(null, ResolveStringResource(package, Name));
                key.SetValue("DisplayName", Name);
            }
        }
コード例 #9
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string factoryGuid = FactoryType.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("Editors\\" + factoryGuid))
            {
                key.SetValue(null, ResolveStringResource(package, Name));
                key.SetValue("DisplayName", Name);
            }
        }
コード例 #10
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string toolWindowGuid = ToolType.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("ToolWindows\\" + toolWindowGuid))
            {
                key.SetValue("Style", Style.ToString());
                key.SetValue("Orientation", Orientation.ToString());
                key.SetValue("MultipleInstances", MultipleInstances ? 1 : 0);
                key.SetValue("Transient", Transient ? 1 : 0);
            }
        }
コード例 #11
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string toolWindowGuid = ToolType.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("ToolWindows\\" + toolWindowGuid))
            {
                key.SetValue("Style", Style.ToString());
                key.SetValue("Orientation", Orientation.ToString());
                key.SetValue("MultipleInstances", MultipleInstances ? 1 : 0);
                key.SetValue("Transient", Transient ? 1 : 0);
            }
        }
コード例 #12
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string factoryGuid = FactoryType.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("Projects\\" + factoryGuid))
            {
                key.SetValue(null, ResolveStringResource(package, Name));
                key.SetValue("DisplayName", Name);
                key.SetValue("ProjectFileExtensions", ProjectFileExtensions);
                key.SetValue("DefaultProjectExtension", DefaultProjectExtension);
                key.SetValue("PossibleProjectExtensions", PossibleProjectExtensions);
            }
        }
コード例 #13
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string factoryGuid = FactoryType.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("Projects\\" + factoryGuid))
            {
                key.SetValue(null, ResolveStringResource(package, Name));
                key.SetValue("DisplayName", Name);
                key.SetValue("ProjectFileExtensions", ProjectFileExtensions);
                key.SetValue("DefaultProjectExtension", DefaultProjectExtension);
                key.SetValue("PossibleProjectExtensions", PossibleProjectExtensions);
            }
        }
コード例 #14
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string optionPageGuid = PageType.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("OptionPages\\" + optionPageGuid))
            {
                key.SetValue("Class", PageType.AssemblyQualifiedName);
                key.SetValue("CategoryName", CategoryName);
                key.SetValue("PageName", PageName);

                if (CategoryNameResourceKey != null)
                    key.SetValue("CategoryNameResourceKey", CategoryNameResourceKey);
                if (PageNameResourceKey != null)
                    key.SetValue("PageNameResourceKey", PageNameResourceKey);
            }
        }
コード例 #15
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            foreach (var entry in HighlightingManager.Manager.HighlightingDefinitions.Values.OfType<DictionaryEntry>())
            {
                var syntaxMode = (SyntaxMode)entry.Key;

                foreach (string extension in syntaxMode.Extensions)
                {
                    var attribute = new ProvideEditorExtensionAttribute(typeof(TextEditorFactory), extension, 100)
                    {
                        DefaultName = syntaxMode.Name
                    };

                    attribute.Register(package, context, packageKey);
                }
            }
        }
コード例 #16
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            foreach (var entry in HighlightingManager.Manager.HighlightingDefinitions.Values.OfType <DictionaryEntry>())
            {
                var syntaxMode = (SyntaxMode)entry.Key;

                foreach (string extension in syntaxMode.Extensions)
                {
                    var attribute = new ProvideEditorExtensionAttribute(typeof(TextEditorFactory), extension, 100)
                    {
                        DefaultName = syntaxMode.Name
                    };

                    attribute.Register(package, context, packageKey);
                }
            }
        }
コード例 #17
0
        public HResult Register(INiRegistrationContext registrationContext)
        {
            try
            {
                if (registrationContext == null)
                {
                    throw new ArgumentNullException("registrationContext");
                }

                var packageGuid = GetType().GUID.ToString("B").ToUpperInvariant();

                var    descriptionAttribute = GetType().GetCustomAttributes(typeof(DescriptionAttribute), true).Cast <DescriptionAttribute>().SingleOrDefault();
                string description          = descriptionAttribute != null ? descriptionAttribute.Description : registrationContext.PackageId;

                using (var key = registrationContext.CreateKey("Packages\\" + packageGuid))
                {
                    key.SetValue(null, this.ResolveStringResource(description));

                    foreach (var type in GetType().Assembly.GetTypes())
                    {
                        foreach (RegistrationAttribute attribute in type.GetCustomAttributes(typeof(RegistrationAttribute), true))
                        {
                            attribute.Register(this, registrationContext, key);
                        }
                    }
                }

                using (var key = registrationContext.CreateKey("InstalledProducts\\" + registrationContext.PackageId))
                {
                    key.SetValue(null, description);
                    key.SetValue("Package", packageGuid);
                    key.SetValue("Version", GetType().Assembly.GetName().Version.ToString());
                }

                // Add the installed products key.

                return(HResult.OK);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
コード例 #18
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string optionPageGuid = PageType.GUID.ToString("B").ToUpperInvariant();

            using (var key = packageKey.CreateSubKey("OptionPages\\" + optionPageGuid))
            {
                key.SetValue("Class", PageType.AssemblyQualifiedName);
                key.SetValue("CategoryName", CategoryName);
                key.SetValue("PageName", PageName);

                if (CategoryNameResourceKey != null)
                {
                    key.SetValue("CategoryNameResourceKey", CategoryNameResourceKey);
                }
                if (PageNameResourceKey != null)
                {
                    key.SetValue("PageNameResourceKey", PageNameResourceKey);
                }
            }
        }
コード例 #19
0
        public HResult Unregister(INiRegistrationContext registrationContext)
        {
            try
            {
                if (registrationContext == null)
                {
                    throw new ArgumentNullException("registrationContext");
                }

                var packageGuid = GetType().GUID.ToString("B").ToUpperInvariant();

                using (var key = registrationContext.CreateKey("Packages\\" + packageGuid))
                {
                    foreach (var type in GetType().Assembly.GetTypes())
                    {
                        foreach (RegistrationAttribute attribute in type.GetCustomAttributes(typeof(RegistrationAttribute), true))
                        {
                            attribute.Unregister(this, registrationContext, key);
                        }
                    }
                }

                // Un-registration allows attributes to perform cleanup other
                // than from inside the package namespace. The package namespace
                // itself is unconditionally deleted anyway, so the attributes
                // don't have to clean up that.

                registrationContext.RemoveKey("Packages\\" + packageGuid);
                registrationContext.RemoveKey("InstalledProducts\\" + registrationContext.PackageId);

                return(HResult.OK);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
コード例 #20
0
        public override void Register(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
        {
            string keyName;

            if (ProjectGuid.HasValue)
                keyName = "Projects\\" + ProjectGuid.Value.ToString("B").ToUpperInvariant() + "\\Extensions\\" + Extension;
            else
                keyName = "Extensions\\" + Extension;

            using (var key = packageKey.CreateSubKey(keyName))
            {
                if (DefaultName != null)
                {
                    key.SetValue(null, ResolveStringResource(package, DefaultName));
                    key.SetValue("DefaultName", DefaultName);
                }

                key.SetValue("FactoryType", FactoryType.GUID.ToString("B").ToUpperInvariant());
                key.SetValue("Priority", Priority);

                if (TemplateResource != null)
                    key.SetValue("TemplateResource", TemplateResource);
            }
        }
コード例 #21
0
 public override void Unregister(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
 {
 }
コード例 #22
0
 public abstract void Unregister(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey);
コード例 #23
0
 public abstract void Unregister(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey);
コード例 #24
0
ファイル: NiPackage.cs プロジェクト: netide/netide
        public HResult Unregister(INiRegistrationContext registrationContext)
        {
            try
            {
                if (registrationContext == null)
                    throw new ArgumentNullException("registrationContext");

                var packageGuid = GetType().GUID.ToString("B").ToUpperInvariant();

                using (var key = registrationContext.CreateKey("Packages\\" + packageGuid))
                {
                    foreach (var type in GetType().Assembly.GetTypes())
                    {
                        foreach (RegistrationAttribute attribute in type.GetCustomAttributes(typeof(RegistrationAttribute), true))
                        {
                            attribute.Unregister(this, registrationContext, key);
                        }
                    }
                }

                // Un-registration allows attributes to perform cleanup other
                // than from inside the package namespace. The package namespace
                // itself is unconditionally deleted anyway, so the attributes
                // don't have to clean up that.

                registrationContext.RemoveKey("Packages\\" + packageGuid);
                registrationContext.RemoveKey("InstalledProducts\\" + registrationContext.PackageId);

                return HResult.OK;
            }
            catch (Exception ex)
            {
                return ErrorUtil.GetHResult(ex);
            }
        }
コード例 #25
0
 public override void Unregister(INiPackage package, INiRegistrationContext context, INiRegistrationKey packageKey)
 {
 }
コード例 #26
0
ファイル: NiPackage.cs プロジェクト: netide/netide
        public HResult Register(INiRegistrationContext registrationContext)
        {
            try
            {
                if (registrationContext == null)
                    throw new ArgumentNullException("registrationContext");

                var packageGuid = GetType().GUID.ToString("B").ToUpperInvariant();

                var descriptionAttribute = GetType().GetCustomAttributes(typeof(DescriptionAttribute), true).Cast<DescriptionAttribute>().SingleOrDefault();
                string description = descriptionAttribute != null ? descriptionAttribute.Description : registrationContext.PackageId;

                using (var key = registrationContext.CreateKey("Packages\\" + packageGuid))
                {
                    key.SetValue(null, this.ResolveStringResource(description));

                    foreach (var type in GetType().Assembly.GetTypes())
                    {
                        foreach (RegistrationAttribute attribute in type.GetCustomAttributes(typeof(RegistrationAttribute), true))
                        {
                            attribute.Register(this, registrationContext, key);
                        }
                    }
                }

                using (var key = registrationContext.CreateKey("InstalledProducts\\" + registrationContext.PackageId))
                {
                    key.SetValue(null, description);
                    key.SetValue("Package", packageGuid);
                    key.SetValue("Version", GetType().Assembly.GetName().Version.ToString());
                }

                // Add the installed products key.

                return HResult.OK;
            }
            catch (Exception ex)
            {
                return ErrorUtil.GetHResult(ex);
            }
        }