本文整理汇总了C#中IO.RestoreCursor方法的典型用法代码示例。如果您正苦于以下问题:C# IO.RestoreCursor方法的具体用法?C# IO.RestoreCursor怎么用?C# IO.RestoreCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IO
的用法示例。
在下文中一共展示了IO.RestoreCursor方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TypesRead
protected override void TypesRead(IO.XmlStream s)
{
Types = new List<Type>(s.Cursor.ChildNodes.Count);
foreach (XmlNode node in s.Cursor.ChildNodes)
{
if (node.Name != "type") continue;
s.SaveCursor(node);
Types.Add(new Type(s));
s.RestoreCursor();
}
Types.TrimExcess();
}
示例2: Read
public void Read(BlamLib.CheApe.ProjectState state, IO.XmlStream s)
{
int array_start_depth = 0;
foreach (XmlNode n in s.Cursor.ChildNodes)
{
if (n.Name != "field") continue;
Field f;
s.SaveCursor(n);
fields.Add(f = new Field(state, s));
s.RestoreCursor();
if (f.TypeIndex == state.kTypeIndexArrayStart) array_start_depth++;
else if (f.TypeIndex == state.kTypeIndexArrayEnd) array_start_depth--;
}
if (array_start_depth != 0)
throw new Debug.ExceptionLog("Unterminated ArrayStart or extra ArrayEnd in '{0}'.{1}{2}",
s.FileName, Program.NewLine, s.Cursor.OuterXml);
}
示例3: DefinitionsRead
protected override void DefinitionsRead(VertexBuffers owner, IO.XmlStream s)
{
Definitions = new List<Definition>(s.Cursor.ChildNodes.Count);
foreach (XmlNode node in s.Cursor.ChildNodes)
{
if (node.Name != "definition") continue;
s.SaveCursor(node);
Definitions.Add(new Definition(owner, s));
s.RestoreCursor();
}
Definitions.TrimExcess();
}
示例4: Definition
public Definition(VertexBuffers owner, IO.XmlStream s) : base(owner, s)
{
//s.ReadAttribute("size", 16, ref Size);
if (s.Cursor.ChildNodes.Count > 0)
{
var elems = new List<Element>(s.Cursor.ChildNodes.Count);
foreach (XmlNode node in s.Cursor.ChildNodes)
{
if (node.Name != "element") continue;
s.SaveCursor(node);
elems.Add(new Element(owner, this, s));
s.RestoreCursor();
}
elems.TrimExcess();
Elements = elems.ToArray();
foreach (Element e in Elements) Size += GetElementSize(e);
}
}
示例5: FieldType
public FieldType(IO.XmlStream s)
{
s.ReadAttribute("opcode", 16, ref opcode);
s.ReadAttribute("size", 16, ref sizeOf);
s.ReadAttribute("name", ref name);
s.ReadAttributeOpt("needsDefinition", ref requiresDefinition);
#region Read byte swap codes
foreach (XmlNode n in s.Cursor.ChildNodes)
if (n.Name == "byteSwap")
{
s.SaveCursor(n);
int code = 0;
foreach (XmlNode n2 in s.Cursor.ChildNodes)
{
if (n2.Name != "code") continue;
s.SaveCursor(n2);
s.ReadAttribute("value", 10, ref code);
byteSwapCodes.Add(code);
s.RestoreCursor();
}
s.RestoreCursor();
}
#endregion
}
示例6: ScriptFunction
public ScriptFunction(ProjectState state, IO.XmlStream s) : base(state, s)
{
string return_type_name = null;
s.ReadAttribute("returnType", ref return_type_name);
s.ReadAttributeOpt("help", ref helpString);
s.ReadAttributeOpt("helpArg", ref helpArgString);
s.ReadAttributeOpt("internal", ref IsInternal);
foreach (XmlNode n in s.Cursor.ChildNodes)
{
if (n.Name != "arg") continue;
s.SaveCursor(n);
args.Add(new ScriptFunctionArg(this, state, s));
s.RestoreCursor();
}
if (!state.scriptingInterface.Types.Contains(return_type_name))
throw new Debug.ExceptionLog("CheApe: value type '{0}' does not exist", return_type_name);
returnType = state.scriptingInterface.GetValueType(return_type_name);
help = state.Compiler.Strings.Add(helpString);
helpArg = state.Compiler.Strings.Add(helpArgString);
}
示例7: ProcessScriptGlobals
void ProcessScriptGlobals(ProjectState state, IO.XmlStream s)
{
foreach (XmlNode n in s.Cursor.ChildNodes)
{
if (n.Name != "global") continue;
s.SaveCursor(n);
var sg = new ScriptGlobal(state, s);
s.RestoreCursor();
string name_str = sg.ToString();
if (state.scriptingInterface.Globals.Contains(name_str))
{
Debug.LogFile.WriteLine("Engine already contains a {0} named '{1}', ignoring...", "script global", name_str);
continue;
}
try { ScriptGlobals.Add(name_str, sg); }
catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "script global definition", name_str); }
}
}
示例8: ProcessTagDatas
void ProcessTagDatas(ProjectState state, IO.XmlStream s)
{
foreach (XmlNode n in s.Cursor.ChildNodes)
{
if (n.Name != "TagData") continue;
s.SaveCursor(n);
var tagdata = new TagData(state, s);
s.RestoreCursor();
string name_str = tagdata.ToString();
try { Data.Add(name_str, tagdata); }
catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, "tag data definition", name_str); }
}
}
示例9: ProcessStringList
static void ProcessStringList(ProjectState state, IO.XmlStream s, Dictionary<string, StringList> listDic,
string elementName, string listTypeName)
{
foreach (XmlNode n in s.Cursor.ChildNodes)
{
if (n.Name != elementName) continue;
s.SaveCursor(n);
var list = new StringList(state, s);
s.RestoreCursor();
string name_str = list.ToString();
try { listDic.Add(name_str, list); }
catch (ArgumentException) { Debug.LogFile.WriteLine(kDuplicateErrorStr, listTypeName, name_str); }
}
}
示例10: Fixup
public Fixup(ProjectState state, IO.XmlStream s) : base(state, s)
{
string temp = string.Empty;
s.ReadAttribute("guerilla", 16, ref addressGuerilla);
s.ReadAttribute("tool", 16, ref addressTool);
s.ReadAttribute("sapien", 16, ref addressSapien);
s.ReadAttribute("type", ref type);
#region Definition
if (type != FixupType.Field && s.ReadAttributeOpt("definition", ref temp))
{
if (type == FixupType.String || type == FixupType.StringPtr)
definition = state.Compiler.RamAddString(temp, out definitionLength).ToString("X8");
else if (type == FixupType.Memory) definition = state.Compiler.RamAddMemory(temp, out definitionLength).ToString("X8");
else if (type == FixupType.Pointer) definition = temp;
definitionGuerilla =
definitionTool =
definitionSapien =
ToPointer();
}
else definition = null;
#endregion
if(definition == null) foreach (XmlNode node in s.Cursor.ChildNodes)
{
if (node.Name == "definition")
{
s.SaveCursor(node);
if (type != FixupType.Field)
{
bool is_string = type == FixupType.String;
// this will be set to false when not all platforms have a definition
bool add_def_memory = true;
if (add_def_memory) add_def_memory = ReadSingleDefinition(state, s, "guerilla", ref definitionGuerilla);
else definitionGuerilla = uint.MaxValue;
if (add_def_memory) add_def_memory = ReadSingleDefinition(state, s, "tool", ref definitionTool);
else definitionTool = uint.MaxValue;
if (add_def_memory) add_def_memory = ReadSingleDefinition(state, s, "sapien", ref definitionSapien);
else definitionSapien = uint.MaxValue;
// Houston, we forgot a platform...
if (!add_def_memory && definitionGuerilla != uint.MaxValue)
{
// TODO: error here
}
}
else
{
foreach (XmlNode fnode in s.Cursor.ChildNodes)
if (fnode.Name == "field")
{
s.SaveCursor(fnode);
field = new Field(state, s);
s.RestoreCursor();
break;
}
}
s.RestoreCursor();
break;
}
}
}
示例11: Read
public override void Read(BlamLib.CheApe.ProjectState state, IO.XmlStream s)
{
base.Read(state, s);
foreach (XmlNode n in s.Cursor.ChildNodes)
{
if (n.Name != "FieldSet") continue;
s.SaveCursor(n);
fieldSets.Add(new FieldSet(state, s));
s.RestoreCursor();
}
}
示例12: ProcessTagGroups
void ProcessTagGroups(BlamLib.CheApe.ProjectState state, IO.XmlStream s)
{
foreach (XmlNode n in s.Cursor.ChildNodes)
{
if (n.Name != "TagGroup") continue;
s.SaveCursor(n);
var group = new TagGroup(state, s);
s.RestoreCursor();
string name_str = group.ToString();
try { Groups.Add(name_str, group); }
catch (ArgumentException) { Debug.LogFile.WriteLine(CheApe.Import.kDuplicateErrorStr, "tag group definition", name_str); }
}
}
示例13: ProcessTagStructs
void ProcessTagStructs(BlamLib.CheApe.ProjectState state, IO.XmlStream s)
{
foreach (XmlNode n in s.Cursor.ChildNodes)
{
if (n.Name != "Struct") continue;
s.SaveCursor(n);
var block = new TagStruct(state, s);
s.RestoreCursor();
string name_str = block.ToString();
try { Structs.Add(name_str, block); }
catch (ArgumentException) { Debug.LogFile.WriteLine(CheApe.Import.kDuplicateErrorStr, "tag struct definition", name_str); }
}
}