// Token: 0x0600002F RID: 47 RVA: 0x00003E38 File Offset: 0x00002038 private static void WriteNode(DTBTreeItem Node, BinaryWriter Output) { Output.Write((int)Node.Type); if (Node is DTBTreeInteger) { DTBTreeInteger dtbtreeInteger = (DTBTreeInteger)Node; Output.Write(dtbtreeInteger.Integer); return; } if (Node is DTBTreeFloat) { DTBTreeFloat dtbtreeFloat = (DTBTreeFloat)Node; Output.Write(dtbtreeFloat.Float); return; } if (Node is DTBTreeString) { DTBTreeString dtbtreeString = (DTBTreeString)Node; byte[] bytes = Encoding.GetEncoding(1252).GetBytes(dtbtreeString.String); Output.Write(bytes.Length); Output.Write(bytes); return; } if (Node is DTBTreeInnerNode) { DTBTreeInnerNode innerNode = (DTBTreeInnerNode)Node; DTBWriter.WriteNodeList(innerNode, Output); return; } throw new DTBException("Internal Error (DTB Writer: Unknown type)."); }
// Token: 0x0600004C RID: 76 RVA: 0x000050A8 File Offset: 0x000032A8 public static void Print(DTBTreeItem Node, TextWriter Output, int TabCount) { for (int i = 0; i < TabCount; i++) { Output.Write("\t"); } if (Node is DTBTreeInteger) { DTBTreeInteger dtbtreeInteger = (DTBTreeInteger)Node; Output.WriteLine("DTBTreeInteger = " + dtbtreeInteger.Integer.ToString()); return; } if (Node is DTBTreeFloat) { DTBTreeFloat dtbtreeFloat = (DTBTreeFloat)Node; Output.WriteLine("DTBTreeFloat = " + dtbtreeFloat.Float.ToString()); return; } if (Node is DTBTreeString) { DTBTreeString dtbtreeString = (DTBTreeString)Node; Output.WriteLine("DTBTreeString = " + dtbtreeString.String.ToString()); return; } if (Node is DTBTreeInnerNode) { DTBTreeInnerNode dtbtreeInnerNode = (DTBTreeInnerNode)Node; Output.WriteLine("DTBTreeInnerNode > Line " + dtbtreeInnerNode.LineNumber.ToString()); using (List <DTBTreeItem> .Enumerator enumerator = dtbtreeInnerNode.SubNodes.GetEnumerator()) { while (enumerator.MoveNext()) { DTBTreeItem node = enumerator.Current; DTBDebugger.Print(node, Output, TabCount + 1); } return; } } throw new DTBException("Internal Error (DTB Debugger: Unknown type)."); }
// Token: 0x06000033 RID: 51 RVA: 0x00003F54 File Offset: 0x00002154 private static DTBTreeItem ReadNode(BinaryReader Input) { DTBType dtbtype = (DTBType)Input.ReadInt32(); Type classType = DTBTreeItem.GetClassType(dtbtype); if (classType == typeof(DTBTreeInteger)) { return(new DTBTreeInteger { Type = dtbtype, Integer = Input.ReadInt32() }); } if (classType == typeof(DTBTreeFloat)) { return(new DTBTreeFloat { Type = dtbtype, Float = Input.ReadSingle() }); } if (classType == typeof(DTBTreeString)) { DTBTreeString dtbtreeString = new DTBTreeString(); int num = Input.ReadInt32(); byte[] array = new byte[num]; Input.Read(array, 0, num); dtbtreeString.Type = dtbtype; dtbtreeString.String = Encoding.GetEncoding(1252).GetString(array); return(dtbtreeString); } if (classType == typeof(DTBTreeInnerNode)) { DTBTreeInnerNode dtbtreeInnerNode = new DTBTreeInnerNode(); dtbtreeInnerNode.Type = dtbtype; DTBReader.ReadNodeList(dtbtreeInnerNode, Input); return(dtbtreeInnerNode); } throw new DTBException("Unknown type \"" + dtbtype.ToString() + "\""); }
// Token: 0x06000018 RID: 24 RVA: 0x00002E60 File Offset: 0x00001060 private static DTBTreeItem ReadNode(DTAParser Parser, DTAParserStatus BreakAt) { DTAParserToken token = Parser.GetToken(); if (token.Status == BreakAt) { return(null); } if (token.Status != DTAParserStatus.OK) { throw new DTBException(string.Concat(new string[] { "Unexpected end character (at line ", token.Line.ToString(), ", position ", token.Position.ToString(), ")." })); } DTBType type = token.Type; switch (type) { case DTBType.Integer: { DTBTreeInteger dtbtreeInteger = new DTBTreeInteger(); dtbtreeInteger.Type = token.Type; if (token.Text.StartsWith("0x") || token.Text.StartsWith("0X")) { dtbtreeInteger.Integer = Convert.ToInt32(token.Text, 16); } else { dtbtreeInteger.Integer = Convert.ToInt32(token.Text, 10); } return(dtbtreeInteger); } case DTBType.Float: return(new DTBTreeFloat { Type = token.Type, Float = Convert.ToSingle(token.Text, CultureInfo.InvariantCulture) }); case DTBType.Variable: case DTBType.Keyword: case DTBType.String: return(new DTBTreeString { Type = token.Type, String = token.Text }); case (DTBType)3: case (DTBType)4: case (DTBType)10: case (DTBType)11: case (DTBType)12: case (DTBType)13: case (DTBType)14: case (DTBType)15: goto IL_2F7; case DTBType.kDataUnhandled: case DTBType.Else: case DTBType.EndIf: return(new DTBTreeInteger { Type = token.Type, Integer = 0 }); case DTBType.IfDef: break; case DTBType.InnerNode: case DTBType.ScriptInnerNode: case DTBType.PropertyInnerNode: { DTBTreeInnerNode dtbtreeInnerNode = new DTBTreeInnerNode(); DTAParserStatus breakAt; switch (token.Type) { case DTBType.InnerNode: breakAt = DTAParserStatus.InnerNodeEnd; goto IL_2D0; case DTBType.ScriptInnerNode: breakAt = DTAParserStatus.ScriptInnerNodeEnd; goto IL_2D0; case DTBType.PropertyInnerNode: breakAt = DTAParserStatus.PropertyInnerNodeEnd; goto IL_2D0; } throw new DTBException("Internal error (DTA Reader: Unknown type)."); IL_2D0: dtbtreeInnerNode.Type = token.Type; dtbtreeInnerNode.LineNumber = token.Line; DTAReader.ReadNodeList(dtbtreeInnerNode, Parser, breakAt); return(dtbtreeInnerNode); } default: switch (type) { case DTBType.Define: case DTBType.Include: case DTBType.Merge: case DTBType.IfNDef: break; default: goto IL_2F7; } break; } DTBTreeString dtbtreeString = new DTBTreeString(); DTAParserToken token2 = Parser.GetToken(); if (token2.Status != DTAParserStatus.OK) { throw new DTBException(string.Concat(new string[] { "Invalid format found in a macro declaration (at line ", token.Line.ToString(), ", position ", token.Position.ToString(), ")." })); } if (token2.Type != DTBType.Keyword) { throw new DTBException(string.Concat(new string[] { "Macro name not followed by a keyword (at line ", token.Line.ToString(), ", position ", token.Position.ToString(), ")." })); } dtbtreeString.Type = token.Type; dtbtreeString.String = token2.Text; return(dtbtreeString); IL_2F7: throw new DTBException("Unknown type \"" + token.Type.ToString() + "\""); }