コード例 #1
0
ファイル: RoundtripTest.cs プロジェクト: LoyieKing/Dexer
        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);
                }
            }
        }
コード例 #2
0
ファイル: Dex.cs プロジェクト: LoyieKing/Dexer
        public void Write(Stream stream)
        {
            using var binaryWriter = new BinaryWriter(stream);
            DexWriter dexWriter = new DexWriter(this);

            dexWriter.WriteTo(binaryWriter);
        }
コード例 #3
0
ファイル: Dex.cs プロジェクト: oujunke/Dexer
        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);
            }
        }
コード例 #4
0
ファイル: Dex.cs プロジェクト: rfcclub/dot42
        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);
                    }
                }
            }
        }
コード例 #5
0
ファイル: Dex.cs プロジェクト: shuixi2013/Dexer
        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);
                }
            }
        }
コード例 #6
0
        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()));
        }
コード例 #7
0
ファイル: RoundtripTest.cs プロジェクト: shuixi2013/Dexer
        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()));
        }