本文整理汇总了C#中IPluginVisitor.VisitStringID方法的典型用法代码示例。如果您正苦于以下问题:C# IPluginVisitor.VisitStringID方法的具体用法?C# IPluginVisitor.VisitStringID怎么用?C# IPluginVisitor.VisitStringID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPluginVisitor
的用法示例。
在下文中一共展示了IPluginVisitor.VisitStringID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleValueElement
/// <summary>
/// Handles an element which describes how a value
/// should be read from the cache file.
/// </summary>
/// <param name="reader">The XmlReader that read the element.</param>
/// <param name="elementName">The element's name.</param>
/// <param name="visitor">The IPluginVisitor to call to.</param>
private static void HandleValueElement(XmlReader reader, string elementName, IPluginVisitor visitor)
{
var name = "Unknown";
uint offset = 0;
var xmlLineInfo = reader as IXmlLineInfo;
if (xmlLineInfo == null) return;
var pluginLine = (uint)xmlLineInfo.LineNumber;
var visible = true;
if (reader.MoveToAttribute("name"))
name = reader.Value;
if (reader.MoveToAttribute("offset"))
offset = ParseUInt(reader.Value);
if (reader.MoveToAttribute("visible"))
visible = ParseBool(reader.Value);
reader.MoveToElement();
switch (elementName.ToLower()) // FIXME: Using ToLower() here violates XML standards
{
case "uint8":
visitor.VisitUInt8(name, offset, visible, pluginLine);
break;
case "int8":
visitor.VisitInt8(name, offset, visible, pluginLine);
break;
case "uint16":
visitor.VisitUInt16(name, offset, visible, pluginLine);
break;
case "int16":
visitor.VisitInt16(name, offset, visible, pluginLine);
break;
case "uint32":
visitor.VisitUInt32(name, offset, visible, pluginLine);
break;
case "int32":
visitor.VisitInt32(name, offset, visible, pluginLine);
break;
case "float32": case "float":
visitor.VisitFloat32(name, offset, visible, pluginLine);
break;
case "undefined":
visitor.VisitUndefined(name, offset, visible, pluginLine);
break;
case "vector3":
visitor.VisitVector3(name, offset, visible, pluginLine);
break;
case "degree":
visitor.VisitDegree(name, offset, visible, pluginLine);
break;
case "stringid":
visitor.VisitStringID(name, offset, visible, pluginLine);
break;
case "tagref":
ReadTagRef(reader, name, offset, visible, visitor, pluginLine);
break;
case "range":
ReadRange(reader, name, offset, visible, visitor, pluginLine);
break;
case "ascii":
ReadAscii(reader, name, offset, visible, visitor, pluginLine);
break;
case "utf16":
ReadUtf16(reader, name, offset, visible, visitor, pluginLine);
break;
case "bitfield8":
if (visitor.EnterBitfield8(name, offset, visible, pluginLine))
ReadBits(reader, visitor);
else
reader.Skip();
break;
case "bitfield16":
if (visitor.EnterBitfield16(name, offset, visible, pluginLine))
ReadBits(reader, visitor);
else
reader.Skip();
break;
case "bitfield32":
if (visitor.EnterBitfield32(name, offset, visible, pluginLine))
ReadBits(reader, visitor);
else
reader.Skip();
break;
case "enum8":
if (visitor.EnterEnum8(name, offset, visible, pluginLine))
ReadOptions(reader, visitor);
else
reader.Skip();
break;
//.........这里部分代码省略.........
示例2: HandleValueElement
/// <summary>
/// Handles an element which describes how a value
/// should be read from the cache file.
/// </summary>
/// <param name="reader">The XmlReader that read the element.</param>
/// <param name="elementName">The element's name.</param>
/// <param name="visitor">The IPluginVisitor to call to.</param>
private void HandleValueElement(XmlReader reader, string elementName, IPluginVisitor visitor)
{
string name = "Unknown";
uint offset = 0;
var pluginLine = (uint) (reader as IXmlLineInfo).LineNumber;
bool visible = true;
if (reader.MoveToAttribute("name"))
name = reader.Value;
if (reader.MoveToAttribute("offset"))
offset = ParseUInt(reader.Value);
if (reader.MoveToAttribute("visible"))
visible = ParseBool(reader.Value);
reader.MoveToElement();
switch (elementName.ToLower())
{
case "uint8":
case "byte":
visitor.VisitUInt8(name, offset, visible, pluginLine);
break;
case "sbyte":
case "int8":
visitor.VisitInt8(name, offset, visible, pluginLine);
break;
case "ushort":
case "uint16":
visitor.VisitUInt16(name, offset, visible, pluginLine);
break;
case "short":
case "int16":
visitor.VisitInt16(name, offset, visible, pluginLine);
break;
case "dword":
case "uint":
case "uint32":
case "long":
case "true":
visitor.VisitUInt32(name, offset, visible, pluginLine);
break;
case "int":
case "int32":
visitor.VisitInt32(name, offset, visible, pluginLine);
break;
case "undefined":
case "unknown":
visitor.VisitUndefined(name, offset, visible, pluginLine);
break;
case "float":
case "float32":
case "degree":
visitor.VisitFloat32(name, offset, visible, pluginLine);
break;
case "vector3":
visitor.VisitVector3(name, offset, visible, pluginLine);
break;
case "stringid":
visitor.VisitStringID(name, offset, visible, pluginLine);
break;
case "tag":
case "tagid":
case "tagref":
case "ident":
ReadTagRef(reader, name, offset, visible, visitor, pluginLine);
break;
case "string":
case "ascii":
ReadAscii(reader, name, offset, visible, visitor, pluginLine);
break;
case "string32":
visitor.VisitAscii(name, offset, visible, 32, pluginLine);
break;
case "string64":
visitor.VisitAscii(name, offset, visible, 64, pluginLine);
break;
case "string256":
visitor.VisitAscii(name, offset, visible, 256, pluginLine);
break;
case "unicode":
case "utf16":
ReadUtf16(reader, name, offset, visible, visitor, pluginLine);
break;
case "unicode32":
visitor.VisitUtf16(name, offset, visible, 32, pluginLine);
break;
case "unicode64":
visitor.VisitUtf16(name, offset, visible, 64, pluginLine);
break;
case "unicode256":
visitor.VisitUtf16(name, offset, visible, 256, pluginLine);
break;
//.........这里部分代码省略.........