public BsonIterator(Stream input) { if (!input.CanRead) { Dispose(); throw new IOException("Input stream must be readable"); } if (!input.CanSeek) { Dispose(); throw new IOException("Input stream must be seekable"); } this._input = new ExtBinaryReader(input); this._ctype = BsonType.UNKNOWN; this._doclen = _input.ReadInt32(); if (this._doclen < 5) { Dispose(); throw new InvalidBsonDataException("Unexpected end of Bson document"); } }
public void Read(ExtBinaryReader reader) { moduleHeader.Read(reader); tablesHeader.Read(reader); sections = reader.ReadArrayOfReadables <SectionLayout>(tablesHeader.sectionsCount); symbols = reader.ReadArrayOfReadables <SymbolLayout>(tablesHeader.symbolsCount); sourceFiles = reader.ReadArrayOfReadables <SourceFileLayout>(tablesHeader.sourceFilesCount); sourceTextRanges = reader.ReadArrayOfReadables <SourceTextRangeLayout>(tablesHeader.sourceTextRangesCount); sourceCodePoints = reader.ReadArrayOfReadables <SourceCodePointLayout>(tablesHeader.sourceCodePointsCount); int[] blobLengths = reader.ReadArrayOfPrimitives(tablesHeader.blobsCount, reader.ReadInt32); blobs = new BlobLayout[tablesHeader.blobsCount]; for (int i = 0; i < tablesHeader.blobsCount; i++) { blobs[i].data = reader.ReadBytes(blobLengths[i]); } strings = reader.ReadArrayOfReadables <StringLayout>(tablesHeader.stringsCount); }
private static void Main(string[] args) { var input = File.OpenRead(path: args[0]); var reader = new ExtBinaryReader(input); var moduleLayout = new BinaryModuleLayout(); moduleLayout.Read(reader); input.Close(); var storage = new InterpreterStorage() { instructions = new List <IInstruction> { new NopInstruction(), new PrintInstruction(), new MovInstruction(), new AddInstruction(), new JumpLessInstruction(), new HaltInstruction(), new InputInstruction(), new JumpGreaterInstruction(), new JumpEqualsInstruction(), new JumpInstruction(), new PushInstruction(), new PopInstruction(), }, stack = new Stack <int>(), module = new BinaryModule(moduleLayout), cursor = 0, registers = new int[4] }; var interpreter = new Interpreter(storage); interpreter.Run(); }
public void Read(ExtBinaryReader reader) { fileNameIndex = reader.ReadInt32(); sha256hashBytesIndex = reader.ReadInt32(); }
public void Read(ExtBinaryReader reader) { sectionIndex = reader.ReadInt32(); blobEntryIndex = reader.ReadInt64(); nameIndex = reader.ReadInt32(); }
public void Read(ExtBinaryReader reader) { address = reader.ReadInt64(); sourceOperationRangeIndex = reader.ReadInt32(); }
public void Read(ExtBinaryReader reader) => str = new string(reader.ReadChars(reader.ReadInt32()));
static void Main(string[] args) { var reader = new ExtBinaryReader(File.OpenRead(path: args[0])); }