public ExpressionToken(TokenType type, SCXReader reader) : base(type) { var sb = new StringBuilder(); while (true) { sbyte next = reader.ReadSByte(); if (next == 0) { break; } Value.Add((byte)next); Value.Add(reader.ReadByte()); if (next > 0) { continue; } switch (next & 0x60) { case 0: break; case 0b0100000: Value.Add(reader.ReadByte()); break; case 0b1000000: Value.Add(reader.ReadByte()); Value.Add(reader.ReadByte()); break; case 0b1100000: Value.Add(reader.ReadByte()); Value.Add(reader.ReadByte()); Value.Add(reader.ReadByte()); Value.Add(reader.ReadByte()); break; } } }
public TextToken(SCXReader reader) : base(TokenType.TextMask) { var sb = new StringBuilder(); while (true) { byte next = reader.ReadByte(); if (next == (byte)TokenType.LineBreak) { sb.Append("\n"); continue; } else if (next == (byte)TokenType.Terminator || (next & (byte)TokenType.TextMask) == 0) { reader.BaseStream.Position--; break; } sb.Append(reader.ReadChar(next)); } Value = sb.ToString(); }