Пример #1
0
        public void TesHighLevelRoundTrip()
        {
            foreach (var file in Directory.GetFiles(_filesDirectory, "*.wasm"))
            {
                TestContext.WriteLine("Testing {0}", file);
                var tmpFile = Path.GetTempFileName();

                ModuleMetadata moduleMetadata;

                using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read))
                    using (var reader = new BinaryReader(stream))
                        moduleMetadata = ModuleMetadata.Read(reader);

                var newModuleMetadata = new ModuleMetadata(moduleMetadata.Module);
                using (var stream = new FileStream(tmpFile, FileMode.Create, FileAccess.Write))
                    using (var writer = new BinaryWriter(stream))
                        newModuleMetadata.Write(writer);

                CompareSections(moduleMetadata, newModuleMetadata);
            }
        }
Пример #2
0
        public void Write(BinaryWriter writer)
        {
            var moduleMetadata = new ModuleMetadata(this);

            moduleMetadata.Write(writer);
        }