////////////////////////////////////////////////////////////////////// // 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); } } } }
/// <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); } } } }