Esempio n. 1
0
        void Test_ReaderWriter()
        {
            var output = new BerMemoryOutput();
            var writer = new EmberWriter(output);

            writer.WriteFrameBegin();

            writer.WriteSequenceBegin(new BerTag(DefaultClass, 1));

            for (uint index = 0; index <= 100; index++)
            {
                writer.Write(new BerTag(DefaultClass, index + 111122), index);
            }

            writer.WriteContainerEnd();

            writer.WriteContainerEnd();

            Console.WriteLine("\r\n------------------------ Reader, Writer");

            var asyncReader = new AsyncDomReader(null);

            asyncReader.ReadBytes(output.Memory);
            DumpXml(asyncReader.DetachRoot());

            //var input = new BerMemoryInput(output.Memory);
            //var reader = new EmberReader(input);

            //var xmlBuffer = new StringBuilder();
            //var xmlSettings = new XmlWriterSettings
            //{
            //   OmitXmlDeclaration = true,
            //};

            //using(var xmlWriter = XmlWriter.Create(xmlBuffer, xmlSettings))
            //   EmberToXml(reader, xmlWriter);
            //Console.WriteLine(xmlBuffer.ToString());
        }