本文整理汇总了C#中PropertyDictionary类的典型用法代码示例。如果您正苦于以下问题:C# PropertyDictionary类的具体用法?C# PropertyDictionary怎么用?C# PropertyDictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyDictionary类属于命名空间,在下文中一共展示了PropertyDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpressionOptions
internal ExpressionOptions(ExpressionContext owner)
{
MyOwner = owner;
MyProperties = new PropertyDictionary();
this.InitializeProperties();
}
示例2: ToolsetConfigurationReader
/// <summary>
/// Constructor taking a delegate for unit test purposes only
/// </summary>
internal ToolsetConfigurationReader(PropertyDictionary<ProjectPropertyInstance> environmentProperties, PropertyDictionary<ProjectPropertyInstance> globalProperties, Func<Configuration> readApplicationConfiguration)
: base(environmentProperties, globalProperties)
{
ErrorUtilities.VerifyThrowArgumentNull(readApplicationConfiguration, "readApplicationConfiguration");
_readApplicationConfiguration = readApplicationConfiguration;
_projectImportSearchPathsCache = new Dictionary<string, Dictionary<string, List<string>>>(StringComparer.OrdinalIgnoreCase);
}
示例3: TranslateProjectPropertyInstanceDictionary
/// <summary>
/// Translates a PropertyDictionary of ProjectPropertyInstances.
/// </summary>
/// <param name="translator">The tranlator doing the translating</param>
/// <param name="value">The dictionary to translate.</param>
public static void TranslateProjectPropertyInstanceDictionary(this INodePacketTranslator translator, ref PropertyDictionary<ProjectPropertyInstance> value)
{
if (!translator.TranslateNullable(value))
{
return;
}
if (translator.Mode == TranslationDirection.ReadFromStream)
{
int count = 0;
translator.Translate(ref count);
value = new PropertyDictionary<ProjectPropertyInstance>(count);
for (int i = 0; i < count; i++)
{
ProjectPropertyInstance instance = null;
translator.Translate(ref instance, ProjectPropertyInstance.FactoryForDeserialization);
value[instance.Name] = instance;
}
}
else // TranslationDirection.WriteToStream
{
int count = value.Count;
translator.Translate(ref count);
foreach (ProjectPropertyInstance instance in value)
{
ProjectPropertyInstance instanceForSerialization = instance;
translator.Translate(ref instanceForSerialization, ProjectPropertyInstance.FactoryForDeserialization);
}
}
}
示例4: ToolsetRegistryReader
/// <summary>
/// Constructor overload accepting a registry wrapper for unit testing purposes only
/// </summary>
internal ToolsetRegistryReader(PropertyDictionary<ProjectPropertyInstance> environmentProperties, PropertyDictionary<ProjectPropertyInstance> globalProperties, RegistryKeyWrapper msbuildRegistryWrapper)
: base(environmentProperties, globalProperties)
{
error.VerifyThrowArgumentNull(msbuildRegistryWrapper, "msbuildRegistryWrapper");
_msbuildRegistryWrapper = msbuildRegistryWrapper;
}
示例5: ExpandAllIntoTaskItems3
public void ExpandAllIntoTaskItems3()
{
ProjectInstance project = ProjectHelpers.CreateEmptyProjectInstance();
PropertyDictionary<ProjectPropertyInstance> pg = new PropertyDictionary<ProjectPropertyInstance>();
List<ProjectItemInstance> ig = new List<ProjectItemInstance>();
ig.Add(new ProjectItemInstance(project, "Compile", "foo.cs", project.FullPath));
ig.Add(new ProjectItemInstance(project, "Compile", "bar.cs", project.FullPath));
List<ProjectItemInstance> ig2 = new List<ProjectItemInstance>();
ig2.Add(new ProjectItemInstance(project, "Resource", "bing.resx", project.FullPath));
ItemDictionary<ProjectItemInstance> itemsByType = new ItemDictionary<ProjectItemInstance>();
itemsByType.ImportItems(ig);
itemsByType.ImportItems(ig2);
Expander<ProjectPropertyInstance, ProjectItemInstance> expander = new Expander<ProjectPropertyInstance, ProjectItemInstance>(pg, itemsByType);
IList<TaskItem> itemsOut = expander.ExpandIntoTaskItemsLeaveEscaped("foo;bar;@(compile);@(resource)", ExpanderOptions.ExpandPropertiesAndItems, MockElementLocation.Instance);
ObjectModelHelpers.AssertItemsMatch(@"
foo
bar
foo.cs
bar.cs
bing.resx
", GetTaskArrayFromItemList(itemsOut));
}
示例6: SubToolset
/// <summary>
/// Constructor that associates a set of properties with a sub-toolset version.
/// </summary>
internal SubToolset(string subToolsetVersion, PropertyDictionary<ProjectPropertyInstance> properties)
{
ErrorUtilities.VerifyThrowArgumentLength(subToolsetVersion, "subToolsetVersion");
_subToolsetVersion = subToolsetVersion;
_properties = properties;
}
示例7: ValidateToolsetTranslation
public void ValidateToolsetTranslation()
{
PropertyDictionary<ProjectPropertyInstance> buildProperties = new PropertyDictionary<ProjectPropertyInstance>();
buildProperties.Set(ProjectPropertyInstance.Create("a", "a1"));
PropertyDictionary<ProjectPropertyInstance> environmentProperties = new PropertyDictionary<ProjectPropertyInstance>();
environmentProperties.Set(ProjectPropertyInstance.Create("b", "b1"));
PropertyDictionary<ProjectPropertyInstance> globalProperties = new PropertyDictionary<ProjectPropertyInstance>();
globalProperties.Set(ProjectPropertyInstance.Create("c", "c1"));
PropertyDictionary<ProjectPropertyInstance> subToolsetProperties = new PropertyDictionary<ProjectPropertyInstance>();
subToolsetProperties.Set(ProjectPropertyInstance.Create("d", "d1"));
Dictionary<string, SubToolset> subToolsets = new Dictionary<string, SubToolset>(StringComparer.OrdinalIgnoreCase);
subToolsets.Add("dogfood", new SubToolset("dogfood", subToolsetProperties));
Toolset t = new Toolset("4.0", "c:\\bar", buildProperties, environmentProperties, globalProperties, subToolsets, "c:\\foo", "4.0");
((INodePacketTranslatable)t).Translate(TranslationHelpers.GetWriteTranslator());
Toolset t2 = Toolset.FactoryForDeserialization(TranslationHelpers.GetReadTranslator());
Assert.Equal(t.ToolsVersion, t2.ToolsVersion);
Assert.Equal(t.ToolsPath, t2.ToolsPath);
Assert.Equal(t.OverrideTasksPath, t2.OverrideTasksPath);
Assert.Equal(t.Properties.Count, t2.Properties.Count);
foreach (string key in t.Properties.Keys)
{
Assert.Equal(t.Properties[key].Name, t2.Properties[key].Name);
Assert.Equal(t.Properties[key].EvaluatedValue, t2.Properties[key].EvaluatedValue);
}
Assert.Equal(t.SubToolsets.Count, t2.SubToolsets.Count);
foreach (string key in t.SubToolsets.Keys)
{
SubToolset subToolset1 = t.SubToolsets[key];
SubToolset subToolset2 = null;
if (t2.SubToolsets.TryGetValue(key, out subToolset2))
{
Assert.Equal(subToolset1.SubToolsetVersion, subToolset2.SubToolsetVersion);
Assert.Equal(subToolset1.Properties.Count, subToolset2.Properties.Count);
foreach (string subToolsetPropertyKey in subToolset1.Properties.Keys)
{
Assert.Equal(subToolset1.Properties[subToolsetPropertyKey].Name, subToolset2.Properties[subToolsetPropertyKey].Name);
Assert.Equal(subToolset1.Properties[subToolsetPropertyKey].EvaluatedValue, subToolset2.Properties[subToolsetPropertyKey].EvaluatedValue);
}
}
else
{
Assert.True(false, string.Format("Sub-toolset {0} was lost in translation.", key));
}
}
Assert.Equal(t.DefaultOverrideToolsVersion, t2.DefaultOverrideToolsVersion);
}
示例8: ExpressionParserOptions
internal ExpressionParserOptions(ExpressionContext owner)
{
MyOwner = owner;
MyProperties = new PropertyDictionary();
MyParseCulture = CultureInfo.InvariantCulture;
this.InitializeProperties();
}
示例9: ExpandAllIntoTaskItems1
public void ExpandAllIntoTaskItems1()
{
PropertyDictionary<ProjectPropertyInstance> pg = new PropertyDictionary<ProjectPropertyInstance>();
Expander<ProjectPropertyInstance, ProjectItemInstance> expander = new Expander<ProjectPropertyInstance, ProjectItemInstance>(pg);
IList<TaskItem> itemsOut = expander.ExpandIntoTaskItemsLeaveEscaped("foo", ExpanderOptions.ExpandProperties, MockElementLocation.Instance);
ObjectModelHelpers.AssertItemsMatch(@"foo", GetTaskArrayFromItemList(itemsOut));
}
示例10: PropertyDefinition
public PropertyDefinition(String systemName, String humanName, Type type, PropertyDictionary owner)
{
SystemName = systemName;
HumanName = humanName;
ValueType = type;
Owner = owner;
Rules = new List<Rule>();
}
示例11: ElementNode
public ElementNode(ElementNode parent, int openAngleBracketPosition, NameToken nameToken, int maxEnd) {
Parent = parent;
if (nameToken.HasColon)
StartTag = new TagNodeWithPrefix(this, openAngleBracketPosition, nameToken, maxEnd);
else
StartTag = new TagNode(this, openAngleBracketPosition, nameToken, maxEnd);
VirtualEnd = maxEnd;
Properties = new PropertyDictionary();
}
示例12: PropertyGroupEmpty
public void PropertyGroupEmpty()
{
string content = ObjectModelHelpers.CleanupFileContents(@"
<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
<Target Name='t' >
<PropertyGroup/>
</Target>
</Project>");
IntrinsicTask task = CreateIntrinsicTask(content);
PropertyDictionary<ProjectPropertyInstance> properties = new PropertyDictionary<ProjectPropertyInstance>();
ExecuteTask(task, LookupHelpers.CreateLookup(properties));
Assert.AreEqual(0, properties.Count);
}
示例13: AppendSwitchUnquotedIfNotNull
/// <summary>
/// Set a boolean switch only if its value exists.
/// </summary>
internal void AppendPlusOrMinusSwitch
(
string switchName,
PropertyDictionary bag,
string parameterName
)
{
object obj = bag[parameterName];
// If the switch isn't set, don't add it to the command line.
if (obj != null)
{
bool value = (bool)obj;
// Do not quote - or + as they are part of the switch
AppendSwitchUnquotedIfNotNull(switchName, (value ? "+" : "-"));
}
}
示例14: PropertyGroupWithComments
public void PropertyGroupWithComments()
{
string content = ObjectModelHelpers.CleanupFileContents(@"
<Project ToolsVersion='msbuilddefaulttoolsversion' xmlns='msbuildnamespace'>
<Target Name='t' >
<PropertyGroup><!-- c -->
<p1>v1</p1><!-- c -->
</PropertyGroup>
</Target>
</Project>");
IntrinsicTask task = CreateIntrinsicTask(content);
PropertyDictionary<ProjectPropertyInstance> properties = new PropertyDictionary<ProjectPropertyInstance>();
ExecuteTask(task, LookupHelpers.CreateLookup(properties));
Assert.AreEqual(1, properties.Count);
Assert.AreEqual("v1", properties["p1"].EvaluatedValue);
}
示例15: AppendSwitch
/// <summary>
/// Set a boolean switch iff its value exists and its value is 'true'.
/// </summary>
internal void AppendWhenTrue
(
string switchName,
PropertyDictionary bag,
string parameterName
)
{
object obj = bag[parameterName];
// If the switch isn't set, don't add it to the command line.
if (obj != null)
{
bool value = (bool)obj;
if (value)
{
AppendSwitch(switchName);
}
}
}