本文整理汇总了C#中IO.ReadAttributeOpt方法的典型用法代码示例。如果您正苦于以下问题:C# IO.ReadAttributeOpt方法的具体用法?C# IO.ReadAttributeOpt怎么用?C# IO.ReadAttributeOpt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IO
的用法示例。
在下文中一共展示了IO.ReadAttributeOpt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeForExport
protected void InitializeForExport(ProjectState state, IO.XmlStream s)
{
s.ReadAttributeOpt("export", ref mIsExported);
// if (IsExported)
// state.Compiler.AddExport(this);
}
示例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: 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);
}
示例4: 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);
}
示例5: TagGroup
/// <summary>
/// Constructs a tag group definition from an xml definition node
/// </summary>
/// <param name="state"></param>
/// <param name="s"></param>
/// <remarks>Construct <see cref="TagGroup.Block"/> in the inheriting class's ctor</remarks>
protected TagGroup(ProjectState state, IO.XmlStream s) : base(state, s)
{
s.ReadAttribute("groupTag", ref groupTag);
s.ReadAttributeOpt("parentTag", ref parentTag);
s.ReadAttribute("version", 10, ref version);
}
示例6: Block
/// <summary>
/// Constructs a block definition from an xml definition node
/// </summary>
/// <param name="state"></param>
/// <param name="s"></param>
protected Block(ProjectState state, IO.XmlStream s) : base(state, s)
{
try { state.ImportedBlocks.Add(this.nameString, this); }
catch (Exception) { }
#region DisplayName
if (s.ReadAttributeOpt("displayName", ref displayString)) displayName = state.Compiler.Strings.Add(displayString);
else { displayName = name; displayString = nameString; }
#endregion
}
示例7: FieldAttribute
/// <summary>
/// Constructs a tag field description from an xml stream
/// </summary>
/// <param name="type"></param>
/// <param name="s"></param>
internal protected FieldAttribute(FieldType type, IO.XmlStream s)
{
Type = type;
//s.ReadAttribute("type", ref Type);
s.ReadAttributeOpt("name", ref Name);
s.ReadAttributeOpt("help", ref Help);
s.ReadAttributeOpt("units", ref Units);
s.ReadAttributeOpt("blockname", ref IsBlockName);
s.ReadAttributeOpt("readonly", ref IsReadonly);
s.ReadAttributeOpt("hidden", ref IsHidden);
}
示例8: ElementBase
protected ElementBase(DefinitionBase parent, IO.XmlStream s)
{
Name = string.Empty;
s.ReadAttributeOpt("name", ref Name);
s.ReadAttribute("declType", ref DeclarationType);
}
示例9: Type
public Type(IO.XmlStream s) : base(s)
{
s.ReadAttributeOpt("declMethod", ref DeclarationMethod);
s.ReadAttribute("declUsage", ref DeclarationUsage);
s.ReadAttributeOpt("usageIndex", 10, ref UsageIndex);
}
示例10: TagGroup
/// <summary>
/// Constructs a tag group definition from an xml definition node
/// </summary>
/// <param name="state"></param>
/// <param name="s"></param>
public TagGroup(BlamLib.CheApe.ProjectState state, IO.XmlStream s) : base(state, s)
{
s.ReadAttributeOpt("isIncludedInTagGroupsChecksum", ref IsIncludedInTagGroupsChecksum);
block = new TagBlock();
block.DisplayName = name;
string tempName = nameString + "_block";
block.Name = blockName = state.Compiler.Strings.Add(tempName);
block.Read(state, s);
}
示例11: 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);
}
示例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: ReadSingleDefinition
bool ReadSingleDefinition(ProjectState state, IO.XmlStream s, string attr_name, ref uint value)
{
string temp = null;
bool add_def_memory = s.ReadAttributeOpt(attr_name, ref temp);
if(add_def_memory)
{
if (type == FixupType.String || type == FixupType.StringPtr)
value = state.Compiler.RamAddString(temp, out definitionLength);
else if (type == FixupType.Memory) value = state.Compiler.RamAddMemory(temp, out definitionLength);
else if (type == FixupType.Pointer) value = Convert.ToUInt32(definition, 16);
}
return add_def_memory;
}
示例14: BuildEditorNameString
internal static string BuildEditorNameString(IO.XmlStream s)
{
StringBuilder value = new StringBuilder();
string temp = string.Empty;
// HACK: Begins the string with a null terminator, leading the tools to think the field is nameless
// Nameless fields are always hidden
if (s.ReadAttributeOpt("hiddenAlways", ref temp) && Util.ParseBooleanLazy(temp))
value.Append('\0');
if (s.ReadAttributeOpt("name", ref temp)) value.Append(temp);
if (s.ReadAttributeOpt("locked", ref temp) && Util.ParseBooleanLazy(temp))
value.Append(MarkupLocked);
if (s.ReadAttributeOpt("hidden", ref temp) && Util.ParseBooleanLazy(temp))
value.Append(MarkupHidden);
if (s.ReadAttributeOpt("blockname", ref temp) && Util.ParseBooleanLazy(temp))
value.Append(MarkupBlockname);
if (s.ReadAttributeOpt("deprecated", ref temp) && Util.ParseBooleanLazy(temp))
value.Append(MarkupDepricated);
if (s.ReadAttributeOpt("units", ref temp))
value.AppendFormat("{0}{1}", MarkupUnits, temp);
if (s.ReadAttributeOpt("tooltip", ref temp))
value.AppendFormat("{0}{1}", MarkupTooltip, temp);
return value.ToString();
}
示例15: BuildEditorNameString
internal static string BuildEditorNameString(IO.XmlStream s)
{
StringBuilder value = new StringBuilder();
string temp = string.Empty;
if (s.ReadAttributeOpt("name", ref temp)) value.Append(temp);
if (s.ReadAttributeOpt("locked", ref temp) && Util.ParseBooleanLazy(temp))
value.Append(MarkupLocked);
if (s.ReadAttributeOpt("hidden", ref temp) && Util.ParseBooleanLazy(temp))
value.Append(MarkupHidden);
if (s.ReadAttributeOpt("blockname", ref temp) && Util.ParseBooleanLazy(temp))
value.Append(MarkupBlockname);
if (s.ReadAttributeOpt("deprecated", ref temp) && Util.ParseBooleanLazy(temp))
value.Append(MarkupDepricated);
if (s.ReadAttributeOpt("units", ref temp))
value.AppendFormat("{0}{1}", MarkupUnits, temp);
if (s.ReadAttributeOpt("tooltip", ref temp))
value.AppendFormat("{0}{1}", MarkupTooltip, temp);
return value.ToString();
}