Ejemplo n.º 1
0
        void GlowReader_RootReady(object sender, AsyncDomReader.RootReadyArgs e)
        {
            var root = e.Root as GlowContainer;

            if (root != null)
            {
                var buffer   = new StringBuilder();
                var settings = new XmlWriterSettings
                {
                    OmitXmlDeclaration = true,
                    Indent             = true,
                    IndentChars        = "  ",
                };

                // INFO: Think this one prints out the tree
                using (var writer = XmlWriter.Create(Console.Out, settings))
                    XmlExport.Export(root, writer);

                Dispatcher.DispatchGlow(root, this);
            }
            else
            {
                Debug.WriteLine($"Unexpected Ember Root: Client/GlowReader_RootReady: {e.Root} Type: {e.Root.GetType()}");
                Console.WriteLine($"Unexpected Ember Root: Client/GlowReader_RootReady: {e.Root} Type: {e.Root.GetType()}");
            }
        }
Ejemplo n.º 2
0
        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);
                }
        }
Ejemplo n.º 3
0
        string DumpXml(EmberNode node)
        {
            var xmlBuffer   = new StringBuilder();
            var xmlSettings = new XmlWriterSettings {
                OmitXmlDeclaration = true
            };

            using (var writer = XmlWriter.Create(xmlBuffer, xmlSettings))
                XmlExport.Export(node, writer);

            var str = xmlBuffer.ToString();

            Console.WriteLine(str);
            return(str);
        }
Ejemplo n.º 4
0
        void GlowReader_RootReady(object sender, AsyncDomReader.RootReadyArgs e)
        {
            var root = e.Root as GlowContainer;

            if (root != null)
            {
                var buffer   = new StringBuilder();
                var settings = new XmlWriterSettings
                {
                    OmitXmlDeclaration = true,
                    Indent             = true,
                    IndentChars        = "  ",
                };

                using (var writer = XmlWriter.Create(Console.Out, settings))
                    XmlExport.Export(root, writer);

                Dispatcher.DispatchGlow(root, this);
            }
            else
            {
                Console.WriteLine("Unexpected Ember Root: {0} ({1})", e.Root, e.Root.GetType());
            }
        }
Ejemplo n.º 5
0
 string GetXml(EmberNode ember)
 {
     return(GetXmlBody(writer => XmlExport.Export(ember, writer)));
 }