private void InitializeFallbackRule() { if ((this.configuredProject == null)) { return; } Microsoft.Build.Framework.XamlTypes.Rule unboundRule = Mbed.deserializedFallbackRule; if ((unboundRule == null)) { System.IO.Stream xamlStream = null; System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); try { xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:Mbed.xaml"); Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream))); System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator(); for ( ; ((unboundRule == null) && ruleEnumerator.MoveNext()); ) { Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current)); if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName)) { unboundRule = t; unboundRule.Name = "04cfacb1-99bb-47cd-b319-1e438608bc0c"; Mbed.deserializedFallbackRule = unboundRule; } } } finally { if ((xamlStream != null)) { ((System.IDisposable)(xamlStream)).Dispose(); } } } this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext"); Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext"); this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName); }
private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName) { if ((catalog == null)) { return(null); } return(catalog.BindToContext(SchemaName, file, itemType, itemName)); }