private void TestReadWrite(string file, out DexReader dexreader, out DexWriter dexwriter) { TestContext.WriteLine("Testing {0}", file); using (Stream fs = new FileStream(file, FileMode.Open)) { var dex = new Dex(fs); dexreader = new DexReader(dex); var reader = new BinaryReader(dex.buffer); dexreader.ReadFrom(reader); dexwriter = new DexWriter(dex); if (Extralog) { using (Stream ofs = new FileStream(file + ".out", FileMode.Create)) using (var writer = new BinaryWriter(ofs)) dexwriter.WriteTo(writer); } else { using (Stream ofs = new MemoryStream()) using (var writer = new BinaryWriter(ofs)) dexwriter.WriteTo(writer); } } }
public void Write(Stream stream) { using var binaryWriter = new BinaryWriter(stream); DexWriter dexWriter = new DexWriter(this); dexWriter.WriteTo(binaryWriter); }
public void Write(Stream stream, bool bufferize) { var deststream = stream; MemoryStream memorystream = null; if (bufferize) { memorystream = new MemoryStream(); deststream = memorystream; } using (var binaryWriter = new BinaryWriter(deststream)) { var writer = new DexWriter(this); writer.WriteTo(binaryWriter); if (!bufferize) { return; } memorystream.Position = 0; memorystream.CopyTo(stream); } }
public void Write(string filename, bool bufferize) { using (var filestream = new FileStream(filename, FileMode.Create)) { Stream deststream = filestream; MemoryStream memorystream = null; if (bufferize) { memorystream = new MemoryStream(); deststream = memorystream; } using (var binaryWriter = new BinaryWriter(deststream)) { var writer = new DexWriter(this); writer.WriteTo(binaryWriter); if (bufferize) { memorystream.Position = 0; memorystream.CopyTo(filestream); } } } }
public void Write(string filename, bool bufferize) { using (var filestream = new FileStream(filename, FileMode.Create)) { Stream deststream = filestream; MemoryStream memorystream = null; if (bufferize) { memorystream = new MemoryStream(); deststream = memorystream; } using (var binaryWriter = new BinaryWriter(deststream)) { var writer = new DexWriter(this); writer.WriteTo(binaryWriter); if (!bufferize) { return; } memorystream.Position = 0; memorystream.CopyTo(filestream); } } }
private void TestReadWrite(string file, out DexReader dexreader, out DexWriter dexwriter) { TestContext.WriteLine("Testing {0}", file); var dex = new Dex(); dexreader = new DexReader(dex); using (Stream fs = new FileStream(file, FileMode.Open)) using (var reader = new BinaryReader(fs)) dexreader.ReadFrom(reader); dexwriter = new DexWriter(dex); dexwriter.WriteTo(new BinaryWriter(new MemoryStream())); }