コード例 #1
0
        void Test_ReaderWriter()
        {
            var output = new BerMemoryOutput();
            var writer = new EmberWriter(output);

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

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

            var oid = new int[100];

            for (int index = 0; index < oid.Length; index++)
            {
                oid[index] = 1000 + index;
            }

            writer.WriteRelativeOid(new BerTag(DefaultClass, 500000), oid);

            writer.WriteContainerEnd();

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

            var asyncReader = new AsyncDomReader(null);

            asyncReader.ReadBytes(output.Memory);

            var root = asyncReader.DetachRoot();

            Console.WriteLine(GetXml(root));
        }