示例#1
0
文件: Program.cs 项目: scy/ember-plus
        void Test_XmlImport()
        {
            var frame       = new EmberSequence(new BerTag(BerClass.Application, 1));
            var appDefined1 = EmberApplicationInterface.CreateApplicationDefinedSet(new BerTag(BerClass.ContextSpecific, 444), 1, frame);
            var appDefined2 = EmberApplicationInterface.CreateApplicationDefinedSequence(new BerTag(BerClass.ContextSpecific, 445), 2, appDefined1);

            appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 1), -1);
            appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 2), true);
            appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 3), false);
            appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 4), 12345.6789);
            appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 5), "wasgehtäb?");

            Console.WriteLine("\r\n------------------------ XML Import");
            DumpXml(frame);

            var buffer = new StringBuilder();

            using (var writer = XmlWriter.Create(buffer))
                XmlExport.Export(frame, writer);

            using (var stream = new StringReader(buffer.ToString()))
                using (var reader = new XmlTextReader(stream))
                {
                    var root = XmlImport.Import(reader, this);

                    DumpXml(root);
                }
        }
示例#2
0
 public AsyncFrameReader(EmberApplicationInterface application)
     : base(application)
 {
     ResetFraming();
 }
示例#3
0
 XmlImport(XmlReader reader, EmberApplicationInterface application)
 {
     _reader = reader;
      _application = application;
 }
示例#4
0
        /// <summary>
        /// Converts XML previously generated by XmlExport.Export to an Ember tree.
        /// </summary>
        /// <param name="reader">XmlReader pointing to the data to import.</param>
        /// <param name="application">Application interface used to create nodes with
        /// application-defined types.</param>
        /// <returns>The root of the imported ember tree.</returns>
        public static EmberNode Import(XmlReader reader, EmberApplicationInterface application)
        {
            var import = new XmlImport(reader, application);

             return import.Convert();
        }
示例#5
0
 public AsyncFrameReader(EmberApplicationInterface application)
     : base(application)
 {
     ResetFraming();
 }