Exemplo n.º 1
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);
                }
        }
Exemplo n.º 2
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()}");
            }
        }
Exemplo n.º 3
0
        protected void OnExportDataClick(object sender, EventArgs e)
        {
            var dataXml        = default(string);
            var dataSerializer = new XmlExport();

            if (RecordExportOptionSelected.IsBlank())
            {
                dataXml = dataSerializer.CreateBlankXml(ZoneId.Value, ApplicationId, ContentTypeIdSelected);
            }
            else
            {
                dataXml = dataSerializer.CreateXml(ZoneId.Value, ApplicationId, ContentTypeIdSelected, LanguageSelected, LanguageFallback, Languages, LanguageReferenceOptionSelected, ResourceReferenceOptionSelected);
            }


            var fileName = string.Format
                           (
                "2sxc {0} {1} {2} {3}.xml",
                ContentTypeNameSelected.Replace(" ", "-"),
                LanguageSelected.Replace(" ", "-"),
                RecordExportOptionSelected.IsBlank() ? "Template" : "Data",
                DateTime.Now.ToString("yyyyMMddHHmmss")
                           );

            Response.Clear();
            Response.Write(dataXml);
            Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", fileName));
            Response.AddHeader("Content-Length", dataXml.Length.ToString());
            Response.ContentType = "text/xml";
            Response.End();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            // Exports saved in PlanetHunters.Export/Export

            JsonExport.ExportPlanets();
            JsonExport.ExportAstronomers();

            XmlExport.ExportStars();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            /* NB! Copy EntityFrameworkSQLServer.dll
             * from Data/bin/Debug to Export/bin/Debug
             */

            JsonExport.ExportPlanetsNotOriginatingAnomalies();
            JsonExport.ExportPeopleNotVictimsOfAnomalies();
            JsonExport.ExportAnomaliesWithMaxVictims();

            XmlExport.ExportAnomaliesAndVictims();
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            pnlChoose.Visible = false;

            string[] contentTypeIds = txtSelectedContentTypes.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] entityIds      = txtSelectedEntities.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] templateIds    = txtSelectedTemplates.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            var messages = new List <ExportImportMessage>();
            var xml      = new XmlExport(ZoneId.Value, AppId.Value, false).ExportXml(contentTypeIds, entityIds, templateIds, out messages);

            Response.Clear();
            Response.Write(xml);
            Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", "SexyContent-Export.xml"));
            Response.AddHeader("Content-Length", xml.Length.ToString());
            Response.ContentType = "text/xml";
            Response.End();
        }
Exemplo n.º 8
0
        public void GenerateXmlTest()
        {
            if (File.Exists(_saveToFile))
            {
                File.Delete(_saveToFile);
            }
            bool value = XmlExport.Generate(_databasePath, _gunId, "7.x", _saveToFile, out _errOut);

            if (value && File.Exists(_saveToFile))
            {
                TestContext.WriteLine($"File was saved to {_saveToFile}");
            }
            else
            {
                TestContext.WriteLine("Unable to save file!");
            }
            General.HasTrueValue(value && File.Exists(_saveToFile), _errOut);
        }
Exemplo n.º 9
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());
            }
        }
Exemplo n.º 10
0
 string GetXml(EmberNode ember)
 {
     return(GetXmlBody(writer => XmlExport.Export(ember, writer)));
 }
Exemplo n.º 11
0
 public static void Main(string[] args)
 {
     JsonExport.ExportPlanets("TRAPPIST");
     JsonExport.ExportAstronomers("Alpha Centauri");
     XmlExport.ExportStars();
 }