本文整理汇总了C#中XmlData.GetAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C# XmlData.GetAttributeValue方法的具体用法?C# XmlData.GetAttributeValue怎么用?C# XmlData.GetAttributeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlData
的用法示例。
在下文中一共展示了XmlData.GetAttributeValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertBasicContentMetaData
private static void AssertBasicContentMetaData(XmlData xmlMetaData, ContentMetaData metaData)
{
AssertMinimumContentMetaData(xmlMetaData, metaData.Name, metaData.Type.ToString(),
metaData.LastTimeUpdated);
Assert.AreEqual(metaData.LocalFilePath, xmlMetaData.GetAttributeValue("LocalFilePath"));
Assert.AreEqual(metaData.FileSize.ToString(), xmlMetaData.GetAttributeValue("FileSize"));
}
示例2: AssertMinimumContentMetaData
private static void AssertMinimumContentMetaData(XmlData xmlMetaData,
string nameAttributeValue, string typeAttributeValue, DateTime lastUpdatedAttributeValue)
{
Assert.AreEqual("ContentMetaData", xmlMetaData.Name);
Assert.AreEqual(nameAttributeValue, xmlMetaData.GetAttributeValue("Name"));
Assert.AreEqual(typeAttributeValue, xmlMetaData.GetAttributeValue("Type"));
Assert.AreEqual(lastUpdatedAttributeValue.GetIsoDateTime(),
xmlMetaData.GetAttributeValue("LastTimeUpdated"));
}
示例3: LoadKerning
//ncrunch: no coverage start
public void LoadKerning(XmlData kerningData)
{
char firstChar = kerningData.GetAttributeValue("First", '\0');
char secondChar = kerningData.GetAttributeValue("Second", '\0');
int kerningDistance = kerningData.GetAttributeValue("Distance", 0);
if (firstChar == '\0' || secondChar == '\0' || kerningDistance == 0)
throw new InvalidDataException("Unable to add kerning " + firstChar + " and " + secondChar +
" with distance=" + kerningDistance);
Glyph glyph;
if (GlyphDictionary.TryGetValue(firstChar, out glyph))
glyph.Kernings.Add(secondChar, kerningDistance);
} //ncrunch: no coverage end
示例4: LoadGlyph
private void LoadGlyph(XmlData glyphData, Size fontMapSize)
{
char character = glyphData.GetAttributeValue("Character", ' ');
var glyph = new Glyph
{
UV = new Rectangle(glyphData.GetAttributeValue("UV")),
LeftSideBearing = glyphData.GetAttributeValue("LeftBearing", 0.0f),
RightSideBearing = glyphData.GetAttributeValue("RightBearing", 0.0f)
};
glyph.AdvanceWidth = glyphData.GetAttributeValue("AdvanceWidth", glyph.UV.Width - 2.0f);
glyph.PrecomputedFontMapUV = Rectangle.BuildUVRectangle(glyph.UV, fontMapSize);
GlyphDictionary.Add(character, glyph);
}
示例5: GetAppGuid
private static Guid GetAppGuid(XmlData appInfoData)
{
string appGuidString = appInfoData.GetAttributeValue(XmlAttributeNameOfAppGuid);
if (String.IsNullOrEmpty(appGuidString))
throw new AppInfoDataMissing(XmlAttributeNameOfAppGuid);
return new Guid(appGuidString);
}
示例6: GetAppPackageFilePath
private string GetAppPackageFilePath(XmlData appInfoData)
{
string fileName = appInfoData.GetAttributeValue(XmlAttributeNameOfFileName);
if (String.IsNullOrEmpty(fileName))
throw new AppInfoDataMissing(XmlAttributeNameOfFileName); // ncrunch: no coverage
return Path.Combine(StorageDirectory, fileName);
}
示例7: GetAppBuildData
private static DateTime GetAppBuildData(XmlData appInfoData)
{
var noBuildDate = DateTime.MinValue;
DateTime buildDate = appInfoData.GetAttributeValue(XmlAttributeNameOfBuildDate, noBuildDate);
if (buildDate == noBuildDate)
throw new AppInfoDataMissing(XmlAttributeNameOfBuildDate);
return buildDate;
}
示例8: AssertFullContentMetaDataEntry
private static void AssertFullContentMetaDataEntry(XmlData xmlMetaData,
ContentMetaData metaData)
{
AssertBasicContentMetaData(xmlMetaData, metaData);
AssertLanguageInMetaData(xmlMetaData, metaData);
AssertPlatformFileIdInMetaData(xmlMetaData, metaData);
foreach (KeyValuePair<string, string> valuePair in metaData.Values)
Assert.AreEqual(metaData.Values[valuePair.Key],
xmlMetaData.GetAttributeValue(valuePair.Key));
}
示例9: ParseData
protected override AgentData ParseData(XmlData tower)
{
return
new TowerData((TowerType)Enum.Parse(typeof(TowerType), tower.GetAttributeValue("Type")),
tower.GetAttributeValue("Name"),
(AttackType)Enum.Parse(typeof(AttackType), tower.GetAttributeValue("AttackType")),
tower.GetAttributeValue("Range", 0.0f), tower.GetAttributeValue("AttackFrequency", 0.0f),
tower.GetAttributeValue("AttackDamage", 0.0f), tower.GetAttributeValue("Cost", 0));
}
示例10: ParseData
protected override AgentData ParseData(XmlData boss)
{
return new BossData((BossType)Enum.Parse(typeof(BossType), boss.GetAttributeValue("Type")),
boss.GetAttributeValue("Name"), boss.GetAttributeValue("MaxHp", 0.0f),
boss.GetAttributeValue("Speed", 0.0f), boss.GetAttributeValue("Resistance", 0.0f),
boss.GetAttributeValue("Gold", 0), ParseTypeDamageModifier(boss));
}
示例11: ParseData
protected override AgentData ParseData(XmlData creep)
{
return
new CreepData((CreepType)Enum.Parse(typeof(CreepType), creep.GetAttributeValue("Type")),
creep.GetAttributeValue("Name"), creep.GetAttributeValue("MaxHp", 0.0f),
creep.GetAttributeValue("Speed", 0.0f), creep.GetAttributeValue("Resistance", 0.0f),
creep.GetAttributeValue("Gold", 0), ParseTypeDamageModifier(creep));
}
示例12: AssertPlatformFileIdInMetaData
private static void AssertPlatformFileIdInMetaData(XmlData xmlMetaData, ContentMetaData metaData)
{
if (metaData.PlatformFileId == 0)
Assert.IsFalse(IsAttributeAvailable(xmlMetaData, "PlatformFileId"));
else
Assert.AreEqual(metaData.PlatformFileId.ToString(),
xmlMetaData.GetAttributeValue("PlatformFileId"));
}
示例13: UpdateExistingAttributeWithSameValue
public void UpdateExistingAttributeWithSameValue()
{
var root = new XmlData("root");
root.AddAttribute("number", "123");
root.UpdateAttribute("number", "123");
Assert.AreEqual("123", root.GetAttributeValue("number"));
}
示例14: UpdateNonExistingAttribute
public void UpdateNonExistingAttribute()
{
var root = new XmlData("root");
root.UpdateAttribute("number", "312");
Assert.AreEqual("312", root.GetAttributeValue("number"));
}
示例15: GetAttributeValueAsInteger
public void GetAttributeValueAsInteger()
{
var root = new XmlData("root");
root.AddAttribute("number", "123");
Assert.AreEqual(123, root.GetAttributeValue("number", 0));
Assert.AreEqual("", root.GetAttributeValue("nonexistant", ""));
}