本文整理汇总了C#中IO.ReadAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IO.ReadAttribute方法的具体用法?C# IO.ReadAttribute怎么用?C# IO.ReadAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IO
的用法示例。
在下文中一共展示了IO.ReadAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ScriptFunctionArg
public ScriptFunctionArg(ScriptFunction func, ProjectState state, IO.XmlStream s)
{
string type_name = null;
s.ReadAttribute("type", ref type_name);
if (!state.scriptingInterface.Types.Contains(type_name))
throw new Debug.ExceptionLog("CheApe: value type '{0}' does not exist", type_name);
type = state.scriptingInterface.GetValueType(type_name);
}
示例2: Element
public Element(VertexBuffers owner, Definition parent, IO.XmlStream s) : base(parent, s)
{
UsageIndex = 0;
string TypeStr = null;
s.ReadAttribute("type", ref TypeStr);
s.ReadAttributeOpt("usageIndex", 10, ref UsageIndex);
Type t = owner.TypeFind(TypeStr) as Type;
if (t != null) this.Type = t;
else throw new Debug.ExceptionLog("'{0}' isn't a defined type (Owner: {1}/{2})", TypeStr, parent.Opcode.ToString("X2"), parent.Name);
}
示例3: MemoryInformation
public MemoryInformation(IO.XmlStream s)
{
uint value = uint.MaxValue;
s.ReadAttribute("baseAddress", 16, ref value); BaseAddress = value;
s.ReadAttribute("allocationSize", 16, ref value); AllocationSize = value;
}
示例4: 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);
}
示例5: ScriptGlobal
public ScriptGlobal(ProjectState state, IO.XmlStream s) : base(state, s)
{
string type_name = null;
s.ReadAttribute("type", ref type_name);
s.ReadAttributeOpt("internal", ref IsInternal);
if (!state.scriptingInterface.Types.Contains(type_name))
throw new Debug.ExceptionLog("CheApe: value type '{0}' does not exist", type_name);
type = state.scriptingInterface.GetValueType(type_name);
}
示例6: Struct
public Struct(BlamLib.CheApe.ProjectState state, IO.XmlStream s) : base(state, s)
{
s.ReadAttribute("groupTag", ref groupTag);
block = new TagBlock();
block.DisplayName = name;
string tempName = nameString + "_block";
block.Name = state.Compiler.Strings.Add(tempName);
block.Read(state, s);
}
示例7: ElementBase
protected ElementBase(DefinitionBase parent, IO.XmlStream s)
{
Name = string.Empty;
s.ReadAttributeOpt("name", ref Name);
s.ReadAttribute("declType", ref DeclarationType);
}
示例8: Type
public Type(IO.XmlStream s) : base(s)
{
s.ReadAttributeOpt("declMethod", ref DeclarationMethod);
s.ReadAttribute("declUsage", ref DeclarationUsage);
s.ReadAttributeOpt("usageIndex", 10, ref UsageIndex);
}
示例9: TagStruct
public TagStruct(BlamLib.CheApe.ProjectState state, IO.XmlStream s)
{
string name_string = null;
s.ReadAttribute("name", ref name_string);
Name = name_string;
Fields = new FieldContainer();
}
示例10: Object
protected Object(ProjectState state, IO.XmlStream s)
{
s.ReadAttribute("name", ref nameString);
InitializeForExport(state, s);
name = state.Compiler.Strings.Add(nameString);
}
示例11: ObjectWithDebugName
protected ObjectWithDebugName(ProjectState state, IO.XmlStream s) : base()
{
s.ReadAttribute("name", ref nameString);
InitializeForExport(state, s);
name = state.Compiler.DebugStrings.Add(nameString);
}
示例12: 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;
}
}
}
示例13: 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
}
示例14: TagBlock
public TagBlock(BlamLib.CheApe.ProjectState state, IO.XmlStream s) : base(state, s)
{
s.ReadAttribute("maxElements", 10, ref maxElements);
s.ReadAttributeOpt("dontReadChildren", ref DontReadChildren);
mFields.Read(state, s);
}
示例15: Field
/// <summary>
/// Constructs a field from an xml definition node
/// </summary>
/// <param name="state"></param>
/// <param name="s"></param>
public Field(ProjectState state, IO.XmlStream s)
{
string temp = string.Empty;
#region Type
s.ReadAttribute("type", ref temp);
typeIndex = state.Definition.GetTypeIndex(temp);
Debug.Assert.If(typeIndex != -1, "Not a usable field type: {0}", temp);
#endregion
#region Name
nameString = temp = XmlInterface.BuildEditorNameString(s);
name = state.Compiler.Strings.Add(temp);
#endregion
#region Definition
if (s.ReadAttributeOpt("definition", ref definition) || TypeIndexIsExplanation(state))
{
SyncDefinitionWithState(state);
}
else if(state.Definition.FieldTypes[typeIndex].RequiresDefinition)
throw new Debug.ExceptionLog("\"{0}\" of type {1} has no definition", nameString, state.Definition.FieldTypes[typeIndex].Name);
#endregion
}