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)); }
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()); }