本文整理汇总了C#中System.Xml.XmlElement.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElement.GetString方法的具体用法?C# XmlElement.GetString怎么用?C# XmlElement.GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlElement
的用法示例。
在下文中一共展示了XmlElement.GetString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
protected virtual void Parse(XmlElement element)
{
Version = element.GetString("element", "UNKNOWN");
Generator = element.GetString("generator", "UNKNOWN");
GeneratorVersion = element.GetString("generator_version", "UNKNOWN");
string pixelArt = element.GetString("pixel_art_mode", "false");
PixelArtMode = pixelArt == "true";
LoadFolders(element);
LoadEntities(element);
}
示例2: Parse
public static ObjectType Parse(XmlElement element)
{
ObjectType value;
string objectType = element.GetString("object_type", "sprite");
switch (objectType)
{
case "point":
value = ObjectType.Point;
break;
case "box":
value = ObjectType.Box;
break;
case "sprite":
value = ObjectType.Sprite;
break;
case "sound":
value = ObjectType.Sound;
break;
case "entity":
value = ObjectType.Entity;
break;
case "variable":
value = ObjectType.Variable;
break;
default:
value = ObjectType.INVALID;
break;
}
return value;
}
示例3: Parse
protected virtual void Parse(XmlElement element, Timeline timeline)
{
string curveString = element.GetString("curve_type", "linear");
switch (curveString)
{
case "instant":
CurveType = Spriter.CurveType.Instant;
break;
case "linear":
CurveType = Spriter.CurveType.Linear;
break;
case "quadratic":
CurveType = Spriter.CurveType.Quadratic;
break;
case "cubic":
CurveType = Spriter.CurveType.Cubic;
break;
case "quartic":
CurveType = Spriter.CurveType.Quartic;
break;
case "quintic":
CurveType = Spriter.CurveType.Quintic;
break;
default:
CurveType = Spriter.CurveType.INVALID;
break;
}
Timeline = timeline;
GetCurveParams(element);
}
示例4: Parse
protected virtual void Parse(XmlElement element, ScmlObject scml)
{
Scml = scml;
Name = element.GetString("name", "");
LoadAnimations(element);
}
示例5: Parse
protected virtual void Parse(XmlElement element, Folder folder)
{
Folder = folder;
var type = element.GetString("type", "image");
switch(type)
{
case "image":
FileType = FileType.Image;
break;
case "atlas_image":
FileType = FileType.AtlasImage;
break;
case "sound_effect":
FileType = FileType.SoundEffect;
break;
case "entity":
FileType = FileType.Entity;
break;
default:
FileType = FileType.INVALID_TYPE;
break;
}
Name = element.GetString("name", "");
Vector2 pivot;
pivot.x = element.GetFloat("pivot_x", 0.0f);
pivot.y = element.GetFloat("pivot_y", 0.0f);
Pivot = pivot;
Vector2 size;
size.x = element.GetInt("width", 0);
size.y = element.GetInt("height", 0);
Size = size;
Vector2 offset;
offset.x = element.GetInt("offset_x", 0);
offset.y = element.GetInt("offset_y", 0);
Offset = offset;
Vector2 originalSize;
originalSize.x = element.GetInt("original_width", 0);
originalSize.y = element.GetInt("original_height", 0);
OriginalSize = originalSize;
}
示例6: ProcessElement
public ModuleResult ProcessElement(XmlElement moduleElement, ViewConfiguration configuration)
{
XmlNamespaceManager nm = XmlNamespaces.Manager;
bool isPublic = moduleElement.GetBoolean("mod:config/mod:public", nm);
string threadName = moduleElement.GetString("mod:config/mod:thread", nm);
string loggerName = moduleElement.GetString("mod:config/mod:logger", DefaultLoggerName, nm);
SageContext context = configuration.Context;
if (!isPublic && !context.IsDeveloperRequest)
{
log.Warn("Skipping work for non-developer reqest. To override this set mod:config/mod:public to 'true'.");
return null;
}
if (string.IsNullOrEmpty(threadName))
{
log.Warn("Thread name parameter is missing. Set mod:config/mod:thread be a non-empty string.");
return new ModuleResult(ModuleResultStatus.MissingParameters);
}
if (!IsLoggingEnabled)
{
log.Warn("Logging is disabled.");
log.WarnFormat("Make sure to enable log4net logging, and to add an appender with the following configuration:");
log.WarnFormat(ConfigurationExample, loggerName);
return new ModuleResult(ModuleResultStatus.NoData);
}
FileAppender appender = GetAppender(loggerName) as FileAppender;
if (appender == null)
{
log.WarnFormat("The log appender '{0}' does not exist or is not a FileAppender.", loggerName);
log.WarnFormat("Either create an appender with that name or specify another using mod:config/mod:logger.");
log.WarnFormat("Make sure to enable log4net logging, and to add an appender with the following configuration:");
log.WarnFormat(ConfigurationExample, loggerName);
return new ModuleResult(ModuleResultStatus.NoData);
}
ModuleResult result = new ModuleResult(moduleElement);
result.AppendDataElement(CreateLogElement(moduleElement.OwnerDocument, appender, threadName));
return result;
}
示例7: Parse
protected virtual void Parse(XmlElement element, Entity entity)
{
Entity = entity;
Name = element.GetString("name", "");
Length_Ms = element.GetInt("length", -1);
LoopType = LoopTypeUtils.Parse(element);
LoopTo = element.GetInt("loop_to", 0);
LoadTimelines(element);
LoadMainline(element);
}
示例8: Parse
protected virtual void Parse(XmlElement element, SpriterAnimation animation)
{
Animation = animation;
Name = element.GetString("name", "");
ObjectType = ObjectType.Parse(element);
var children = element.GetElementsByTagName(TimelineKey.XmlKey);
foreach (XmlElement childElement in children)
{
keys.Add(GetKey(childElement));
}
}
示例9: Parse
public void Parse(XmlElement configElement)
{
this.Enabled = configElement.GetAttribute("enabled").EqualsAnyOf("yes", "true", "1");
this.Directory = configElement.GetString("p:directory", XmlNamespaces.Manager);
var groups = configElement.SelectNodes("p:groups/p:group", XmlNamespaces.Manager);
this.Groups = new Dictionary<string, Group>();
foreach (XmlElement node in groups)
{
var group = new Group(node);
this.Groups.Add(group.Name, group);
}
}
示例10: Parse
public static LoopType Parse(XmlElement element)
{
var looping = element.GetString("looping", "true");
switch (looping)
{
case "true":
return LoopType.True;
case "false":
return LoopType.False;
case "ping_pong":
return LoopType.PingPong;
}
return LoopType.INVALID;
}
示例11: Parse
protected override void Parse(XmlElement element)
{
base.Parse(element);
Name = element.GetString("name", "");
//Parse file elements
var fileElements = element.GetElementsByTagName("file");
var files = new List<File>(fileElements.Count);
foreach(XmlElement fileElement in fileElements)
{
files.Add(new File(fileElement, this));
}
Files = files;
}
示例12: Create
public static DropdownListItem Create(XmlElement row)
{
var text = row.GetString("text");
var value = row.GetString("value");
return new DropdownListItem(text, value);
}
示例13: ReplaceFilter
public ReplaceFilter(XmlElement filterElement)
: base(filterElement)
{
expression = new Regex(filterElement.GetString("p:from", XmlNamespaces.Manager));
replacement = filterElement.GetString("p:to", XmlNamespaces.Manager);
}