|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules
{
internal partial class RazorGeneral
{
/// <summary>Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.</summary>
private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;
/// <summary>The name of the schema to look for at runtime to fulfill property access.</summary>
internal const string SchemaName = "RazorGeneral";
/// <summary>The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
internal const string PrimaryDataSourceItemType = null;
/// <summary>The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
internal const string PrimaryDataSourceLabel = "";
/// <summary>Razor Language Version (The "RazorLangVersion" property).</summary>
internal const string RazorLangVersionProperty = "RazorLangVersion";
/// <summary>Razor Configuration Name (The "RazorDefaultConfiguration" property).</summary>
internal const string RazorDefaultConfigurationProperty = "RazorDefaultConfiguration";
/// <summary>Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.</summary>
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;
/// <summary>Backing field for the file name of the rule property.</summary>
private string file;
/// <summary>Backing field for the ItemType property.</summary>
private string itemType;
/// <summary>Backing field for the ItemName property.</summary>
private string itemName;
/// <summary>Configured Project</summary>
private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;
/// <summary>The dictionary of named catalogs.</summary>
private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;
/// <summary>Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.</summary>
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;
/// <summary>Thread locking object</summary>
private object locker = new object();
/// <summary>Initializes a new instance of the RazorGeneral class.</summary>
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule)
{
this.rule = rule;
}
/// <summary>Initializes a new instance of the RazorGeneral class.</summary>
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) :
this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName))
{
if ((configuredProject is null))
{
throw new System.ArgumentNullException("configuredProject");
}
this.configuredProject = configuredProject;
this.catalogs = catalogs;
this.file = file;
this.itemType = itemType;
this.itemName = itemName;
}
/// <summary>Initializes a new instance of the RazorGeneral class.</summary>
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) :
this(rule)
{
if ((rule is null))
{
throw new System.ArgumentNullException("rule");
}
if ((configuredProject is null))
{
throw new System.ArgumentNullException("configuredProject");
}
this.configuredProject = configuredProject;
this.rule = rule;
this.file = this.rule.File;
this.itemType = this.rule.ItemType;
this.itemName = this.rule.ItemName;
}
/// <summary>Initializes a new instance of the RazorGeneral class.</summary>
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) :
this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName)
{
}
/// <summary>Initializes a new instance of the RazorGeneral class that assumes a project context (neither property sheet nor items).</summary>
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) :
this(configuredProject, catalogs, "Project", null, null, null)
{
}
/// <summary>Gets the IRule used to get and set properties.</summary>
public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule
{
get
{
return this.rule;
}
}
/// <summary>Razor Language Version</summary>
internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty RazorLangVersion
{
get
{
Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
if ((localRule is null))
{
localRule = this.GeneratedFallbackRule;
}
if ((localRule is null))
{
return null;
}
Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorLangVersionProperty)));
if (((property is null)
&& (this.GeneratedFallbackRule != null)))
{
localRule = this.GeneratedFallbackRule;
property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorLangVersionProperty)));
}
return property;
}
}
/// <summary>Razor Configuration Name</summary>
internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty RazorDefaultConfiguration
{
get
{
Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
if ((localRule is null))
{
localRule = this.GeneratedFallbackRule;
}
if ((localRule is null))
{
return null;
}
Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorDefaultConfigurationProperty)));
if (((property is null)
&& (this.GeneratedFallbackRule != null)))
{
localRule = this.GeneratedFallbackRule;
property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorDefaultConfigurationProperty)));
}
return property;
}
}
/// <summary>Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing</summary>
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule
{
get
{
if (((this.fallbackRule is null)
&& (this.configuredProject != null)))
{
System.Threading.Monitor.Enter(this.locker);
try
{
if ((this.fallbackRule is null))
{
this.InitializeFallbackRule();
}
}
finally
{
System.Threading.Monitor.Exit(this.locker);
}
}
return this.fallbackRule;
}
}
private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName)
{
if ((catalog is null))
{
return null;
}
return catalog.BindToContext(SchemaName, file, itemType, itemName);
}
private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext)
{
if ((propertiesContext.IsProjectFile == true))
{
return null;
}
else
{
return propertiesContext.File;
}
}
private void InitializeFallbackRule()
{
if ((this.configuredProject is null))
{
return;
}
Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorGeneral.deserializedFallbackRule;
if ((unboundRule is null))
{
System.IO.Stream xamlStream = null;
System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
try
{
xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorGeneral.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 is 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 = "6851f2efc446915a1288ec829aa82f7dc9bcfc6addb65b97866a1bc9e30b3348";
RazorGeneral.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);
}
}
internal partial class RazorProjectProperties
{
private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGeneral> CreateRazorGeneralPropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGeneral>(CreateRazorGeneralProperties);
private static RazorGeneral CreateRazorGeneralProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state)
{
RazorProjectProperties that = ((RazorProjectProperties)(state));
return new RazorGeneral(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName);
}
/// <summary>Gets the strongly-typed property accessor used to get and set Razor Properties properties.</summary>
internal System.Threading.Tasks.Task<RazorGeneral> GetRazorGeneralPropertiesAsync()
{
System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync();
return namedCatalogsTask.ContinueWith(CreateRazorGeneralPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default);
}
/// <summary>Gets the strongly-typed property accessor used to get value from the current project snapshot Razor Properties properties.</summary>
internal bool TryGetCurrentRazorGeneralPropertiesSnapshot(out RazorGeneral snapshot, [System.Runtime.InteropServices.OptionalAttribute()] [System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] bool requiredToMatchProjectVersion)
{
snapshot = null;
Microsoft.VisualStudio.ProjectSystem.IProjectVersionedValue<Microsoft.VisualStudio.ProjectSystem.Properties.IProjectCatalogSnapshot> catalogSnapshot;
if (this.TryGetCurrentCatalogSnapshot(out catalogSnapshot))
{
if (requiredToMatchProjectVersion)
{
if ((this.ConfiguredProject.ProjectVersion.CompareTo(catalogSnapshot.DataSourceVersions[Microsoft.VisualStudio.ProjectSystem.ProjectDataSources.ConfiguredProjectVersion]) != 0))
{
return false;
}
}
Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule = this.GetSnapshotRule(catalogSnapshot.Value, "Project", RazorGeneral.SchemaName);
if ((rule != null))
{
snapshot = new RazorGeneral(rule, this.ConfiguredProject);
return true;
}
}
return false;
}
}
}
|