public override void Register(RegistrationContext context)
 {
     using (Key key = context.CreateKey(EditorRegKey))
     {
         key.SetValue(string.Empty, FactoryType.Name);
         key.SetValue("DisplayName", string.Format(CultureInfo.InvariantCulture, "#{0}", NameResourceID));
         key.SetValue("Package", context.ComponentType.GUID.ToString("B"));
         key.SetValue("CommonPhysicalViewAttributes", (int)_commonPhysicalViewAttributes);
         key.SetValue("EditorTrustLevel", (int)_trustLevel);
         using (Key key2 = key.CreateSubkey("LogicalViews"))
         {
             TypeConverter converter = TypeDescriptor.GetConverter(typeof(LogicalView));
             object[] customAttributes = FactoryType.GetCustomAttributes(typeof(ProvideViewAttribute), true);
             foreach (ProvideViewAttribute attribute in customAttributes)
             {
                 if (attribute.LogicalView != LogicalView.Primary)
                 {
                     Guid guid = (Guid)converter.ConvertTo(attribute.LogicalView, typeof(Guid));
                     string physicalView = attribute.PhysicalView ?? string.Empty;
                     key2.SetValue(guid.ToString("B"), physicalView);
                 }
             }
         }
     }
 }
        //////////////////////////////////////////////////////////////////////
        // ProvideLanguageCodeExpansionAttribute Public Methods.

        /// <include file='doc\ProvideLanguageCodeExpansionAttribute.uex' path='docs/doc[@for="ProvideLanguageCodeExpansionAttribute.Register"]' />
        public override void Register(RegistrationAttribute.RegistrationContext context)
        {
            context.Log.WriteLine(string.Format(Resources.Culture, Resources.Reg_NotifyLanguageCodeExpansion, LanguageServiceSid.ToString("B")));

            string packageGuid = context.ComponentType.GUID.ToString("B");

            // Create our top-most language key
            using (Key serviceKey = context.CreateKey(LanguageRegistryKey))
            {
                // Add specific entries corresponding to arguments to
                // ProvideLanguageCodeExpansionAttribute constructor.
                serviceKey.SetValue(string.Empty, LanguageServiceSid.ToString("B"));
                serviceKey.SetValue(RegistryPaths.package, packageGuid);
                serviceKey.SetValue(RegistryPaths.displayName, displayName);
                serviceKey.SetValue(RegistryPaths.languageStringId, languageIdString);
                serviceKey.SetValue(RegistryPaths.indexPath, snippetIndexPath);
                serviceKey.SetValue(RegistryPaths.showRoots, showRoots ? 1 : 0);
                if (!string.IsNullOrEmpty(SearchPaths))
                {
                    using (Key pathsKey = serviceKey.CreateSubkey(RegistryPaths.paths))
                    {
                        pathsKey.SetValue(LanguageName, SearchPaths);
                    }
                }
                if (!string.IsNullOrEmpty(ForceCreateDirs))
                {
                    using (Key forceCreateKey = serviceKey.CreateSubkey(RegistryPaths.forceCreateDirs))
                    {
                        forceCreateKey.SetValue(LanguageName, ForceCreateDirs);
                    }
                }
            }
        }
 public override void Register(RegistrationContext context)
 {
     using (Key key = context.CreateKey(RegKeyBaseName))
     {
         key.SetValue("Code", Code);
         key.SetValue("State", (int)State);
     }
 }
示例#4
0
        /// <include file='doc\ProvideLanguageServiceAttribute.uex' path='docs/doc[@for="ProvideLanguageServiceAttribute.Register"]' />
        public override void Register(RegistrationAttribute.RegistrationContext context)
        {
            context.Log.WriteLine(string.Format(Resources.Culture, Resources.Reg_NotifyLanguageService, LanguageName, LanguageServiceSid.ToString("B")));

            // Create our top-most language key
            using (Key serviceKey = context.CreateKey(LanguageServicesKeyName))
            {
                // Add specific entries corresponding to arguments to
                // ProvideLanguageServiceAttribute constructor.
                serviceKey.SetValue(string.Empty, LanguageServiceSid.ToString("B"));
                serviceKey.SetValue(RegistryPaths.package, context.ComponentType.GUID.ToString("B"));
                serviceKey.SetValue(RegistryPaths.languageResourceId, languageResourceID);

                // Now add any explicitly specified options.
                string name;
                string value;
                foreach (object item in optionsTable.Keys)
                {
                    name = item.ToString();
                    if (optionsTable[item] is bool)
                    {
                        // Bool values are special-cased as they need to
                        // be written as 0 or 1 instead of false or true.
                        int nValue = 0;
                        if ((bool)optionsTable[item])
                        {
                            nValue = 1;
                        }
                        serviceKey.SetValue(name, nValue);
                    }
                    else if (optionsTable[item] is int)
                    {
                        serviceKey.SetValue(name, (int)optionsTable[item]);
                    }
                    else
                    {
                        // If not bool type, always write the value as a
                        // string.
                        value = optionsTable[item].ToString();
                        serviceKey.SetValue(name, value);
                    }
                }
                if (debuggerLanguages.IsValid())
                {
                    // If any debugger language options have been specified then...
                    // Note: we are assuming there can be only one of these entries
                    // for each language service.
                    string eeRegName = string.Format(CultureInfo.InvariantCulture,
                                                     "{0}\\{1}",
                                                     RegistryPaths.debuggerLanguages,
                                                     debuggerLanguages.ExpressionEvaluator.ToString("B"));
                    using (Key dbgLangKey = serviceKey.CreateSubkey(eeRegName))
                    {
                        dbgLangKey.SetValue(null, debuggerLanguages.LanguageName);
                    }
                }
            }
        }
 internal static void CreateRegistryEntries(RegistrationAttribute.RegistrationContext context, string languageName, string categoryName, string categoryResourceId, Guid pageGuid)
 {
     using (RegistrationAttribute.Key serviceKey = context.CreateKey(FormatRegKey(languageName, categoryName))) {
         // Add specific entries corresponding to arguments to
         // constructor.
         serviceKey.SetValue(string.Empty, categoryResourceId);
         serviceKey.SetValue(RegistryPaths.package, context.ComponentType.GUID.ToString("B"));
         if (pageGuid != Guid.Empty)
         {
             serviceKey.SetValue(RegistryPaths.page, pageGuid.ToString("B"));
         }
     }
 }
示例#6
0
        public override void Register(RegistrationAttribute.RegistrationContext context)
        {
            var engineKey = context.CreateKey(ExceptionKey);
            var key       = engineKey;

            foreach (var pathElem in _path)
            {
                key = key.CreateSubkey(pathElem);
            }

            key.SetValue("Code", _code);
            key.SetValue("State", _state);
        }
        public override void Register(RegistrationContext context)
        {
            using (Key key = context.CreateKey(RegKeyBaseName))
            {
                Key parentKey = key;
                if (!string.IsNullOrEmpty(ExceptionNamespace))
                    parentKey = key.CreateSubkey(ExceptionNamespace);

                try
                {
                    if (!string.IsNullOrEmpty(ExceptionNamespace))
                    {
                        parentKey.SetValue("Code", 0);
                        parentKey.SetValue("State", (int)DefaultState);
                    }

                    using (Key child = parentKey.CreateSubkey(ExceptionName))
                    {
                        child.SetValue("Code", Code);
                        child.SetValue("State", (int)State);
                    }
                }
                finally
                {
                    if (!string.IsNullOrEmpty(ExceptionNamespace))
                        parentKey.Close();
                }
            }
        }