protected int TokenOffset; // the binaryTokens are offset by this amount, ie for binary world files public override SBR ReadSubBlock() { BinaryBlockReader block = new BinaryBlockReader(); block.Filename = Filename; block.InputStream = InputStream; block.TokenOffset = TokenOffset; int MSTSToken = InputStream.ReadUInt16(); block.ID = (TokenID)(MSTSToken + TokenOffset); block.Flags = InputStream.ReadUInt16(); block.RemainingBytes = InputStream.ReadUInt32(); // record length uint blockSize = block.RemainingBytes + 8; //for the header RemainingBytes -= blockSize; int labelLength = InputStream.ReadByte(); block.RemainingBytes -= 1; if (labelLength > 0) { byte[] buffer = InputStream.ReadBytes(labelLength * 2); block.Label = System.Text.Encoding.Unicode.GetString(buffer, 0, labelLength * 2); block.RemainingBytes -= (uint)labelLength * 2; } return(block); }
public SBRException(BinaryBlockReader sbr, string message) : base(String.Format("{2} in {0}:byte {1}\n", sbr.Filename, sbr.InputStream.BaseStream.Position, message)) { }
public static void TraceInformation(BinaryBlockReader sbr, string message) { Trace.TraceInformation("{2} in {0}:byte {1}", sbr.Filename, sbr.InputStream.BaseStream.Position, message); }