示例#1
0
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT, Boolean isSecure = Constants.DEFAULT_ISSECURE)
        {
            try
            {
                List <string> results         = new List <string>();
                string        chartConfigFile = System.Environment.CurrentDirectory + "\\resources\\single.json";

                ExportConfig exportConfig = new ExportConfig();

                // Instantiate the ExportManager class
                using (ExportManager exportManager = new ExportManager(host, port, isSecure))
                {
                    exportConfig.Set("chartConfig", chartConfigFile);

                    // Call the Export() method with the export config
                    //results.AddRange(exportManager.Export(exportConfig, @"D:\temp\exported-charts", true));
                    results.AddRange(exportManager.Export(exportConfig, System.Environment.GetEnvironmentVariable("%TMP%", EnvironmentVariableTarget.User), true));
                }

                foreach (string path in results)
                {
                    Console.WriteLine(path);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.Read();
        }
示例#2
0
        static void Main(string[] args)
        {
            try
            {
                List <string> results         = new List <string>();
                string        chartConfigFile = "./static/test/chart-config-file2.json";
                // string svgFile = "./static/sample.svg";
                // string resourcesFile = "./static/resources.json";
                string templateFile = "./static/test/dashboard-template.html";

                ExportConfig exportConfig = new ExportConfig();

                using (ExportManager em = new ExportManager("localhost", 1337, false, true))
                {
                    exportConfig.Set("chartConfig", chartConfigFile);
                    exportConfig.Set("templateFilePath", templateFile);
                    results.AddRange(em.Export(exportConfig));
                }

                foreach (string path in results)
                {
                    Console.WriteLine(path);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.Read();
        }
示例#3
0
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            string chartConfigFile = System.Environment.CurrentDirectory + "\\resources\\multiple.json";

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", chartConfigFile);
                exportConfig.Set("templateFormat", "A4");
                exportConfig.Set("type", "pdf");

                // Call the Export() method with the export config
                results.AddRange(exportManager.Export(exportConfig, System.Environment.GetEnvironmentVariable("%TMP%", EnvironmentVariableTarget.User), true));
            }

            foreach (string path in results)
            {
                Console.WriteLine(path);
            }

            Console.Read();
        }
示例#4
0
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", File.ReadAllText("./resources/dashboard_charts.json"));
                exportConfig.Set("templateFilePath", "./resources/template.html");
                exportConfig.Set("type", "pdf");
                exportConfig.Set("headerEnabled", "true");
                exportConfig.Set("footerEnabled", "true");
                exportConfig.Set("headerComponents", "{ \"title\": { \"style\": \"color:blue;\" } }");
                exportConfig.Set("footerComponents", "{ \"pageNumber\": { \"style\": \"color:green;\" } }");

                // Call the Export() method with the export config
                results.AddRange(exportManager.Export(exportConfig));
            }

            foreach (string path in results)
            {
                Console.WriteLine(path);
            }

            Console.Read();
        }
        public static void Run()
        {
            try
            {
                List <string> results          = new List <string>();
                string        chartConfigFile  = System.Environment.CurrentDirectory + "\\resources\\chart-config-file2.json";
                string        templateFilePath = System.Environment.CurrentDirectory + "\\resources\\dashboard-template.html";

                ExportConfig exportConfig = new ExportConfig();

                // Instantiate the ExportManager class
                using (ExportManager exportManager = new ExportManager(Constants.DEFAULT_HOST, Constants.DEFAULT_PORT, Constants.DEFAULT_ISSECURE, true))
                {
                    exportConfig.Set("chartConfig", chartConfigFile);
                    exportConfig.Set("templateFilePath", templateFilePath);

                    // Call the Export() method with the export config
                    //results.AddRange(exportManager.Export(exportConfig, @"D:\temp\exported-charts", true));
                    results.AddRange(exportManager.Export(exportConfig, System.Environment.GetEnvironmentVariable("%TMP%", EnvironmentVariableTarget.User), true));
                }

                foreach (string path in results)
                {
                    Console.WriteLine(path);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.Read();
        }
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", File.ReadAllText("./resources/dashboard_charts.json"));
                exportConfig.Set("templateFilePath", "./resources/template.html");
                exportConfig.Set("dashboardLogo", "./resources/logo.png");
                exportConfig.Set("dashboardHeading", "Dashboard");
                exportConfig.Set("dashboardSubheading", "Powered by FusionExport");

                // Call the Export() method with the export config
                results.AddRange(exportManager.Export(exportConfig));
            }

            foreach (string path in results)
            {
                Console.WriteLine(path);
            }

            Console.Read();
        }
示例#7
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            if (DataListView.Items.Count == 0)
            {
                return;
            }

            using (var dlg = new SaveFileDialog())
            {
                dlg.Title           = "Export the user login list";
                dlg.Filter          = "Comma-Delimeted File (*.CSV)|*.csv";
                dlg.FileName        = DatabaseCombo.Text + " User Logins.csv";
                dlg.OverwritePrompt = true;

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    try
                    {
                        ExportManager.Export(dlg.FileName, (List <UserLogin>)DataListView.Tag);
                        MessageBox.Show(this, "User login list exported successfully.", "Export Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(this, exception.Message, "Error Exporting File", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            string chartConfig = @"{
                        ""type"": ""column2d"",
                        ""renderAt"": ""chart-container"",
                        ""width"": ""600"",
                        ""height"": ""400"",
                        ""dataFormat"": ""json"",
                        ""dataSource"": {
                            ""chart"": {
                                ""caption"": ""Number of visitors last week"",
                                ""subCaption"": ""Bakersfield Central vs Los Angeles Topanga""
                            },
                            ""data"": [{
                                    ""label"": ""Mon"",
                                    ""value"": ""15123""
                                },{
                                    ""label"": ""Tue"",
                                    ""value"": ""14233""
                                },{
                                    ""label"": ""Wed"",
                                    ""value"": ""25507""
                                }
                            ]
                        }
                    }";

            string chartConfigFile  = System.Environment.CurrentDirectory + "\\resources\\dashboard_charts.json";
            string templateFilePath = System.Environment.CurrentDirectory + "\\resources\\template.html";

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", chartConfigFile);
                exportConfig.Set("templateFilePath", templateFilePath);
                exportConfig.Set("templateFormat", "letter");
                exportConfig.Set("header", "yugyitfty");
                exportConfig.Set("subheader", "Rishav");


                // Call the Export() method with the export config
                //results.AddRange(exportManager.Export(exportConfig, @"D:\temp\exported-charts", true));
                results.AddRange(exportManager.Export(exportConfig, System.Environment.GetEnvironmentVariable("%TMP%", EnvironmentVariableTarget.User), true));
            }

            foreach (string path in results)
            {
                Console.WriteLine(path);
            }

            Console.Read();
        }
 public byte[] ExportProperties()
 {
     using (MemoryStream stream = new MemoryStream())
     {
         var           root    = metadata.GetRootPackage();
         ExportManager manager = new ExportManager(root);
         manager.Export(stream, ExportFormat.Xlsx);
         return(stream.ToArray());
     }
 }
示例#10
0
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", File.ReadAllText("./resources/dashboard_charts.json"));
                exportConfig.Set("templateFilePath", "./resources/template.html");
                // Call the Export() method with the export config
                results.AddRange(exportManager.Export(exportConfig));
            }

            try
            {
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmaill.com");
                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential("<USERNAME>", "<PASSWORD>");
                SmtpServer.EnableSsl   = true;

                mail.From = new MailAddress("<SENDER'S EMAIL>");
                mail.To.Add("<RECEIVERS'S EMAIL>");
                mail.Subject = "FusionExport";
                mail.Body    = "Hello,\n\nKindly find the attachment of FusionExport exported files.\n\nThank you!";

                System.Net.Mail.Attachment attachment;

                results.ForEach(i =>
                {
                    attachment = new System.Net.Mail.Attachment(i);
                    mail.Attachments.Add(attachment);
                });

                SmtpServer.Send(mail);
                Console.WriteLine("FusionExport C# Client: Email Sent");
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: " + ex.Message + " " + ex.InnerException.Message);
            }
        }
        public void Export(string name)
        {
            ExportManager export = new ExportManager();

            var p = new List <PaperInfo>();

            foreach (var l in wallpaper.TimeLayer)
            {
                var paper = new PaperInfo(l.StartTime, l.Length);
                foreach (var e in l.Layer)
                {
                    var elem = new ElementInfo(e.Scale, e.Location, e.Image, e.Code);
                    paper.Layer.Add(elem);
                }
                p.Add(paper);
            }

            export.Export(new DirectoryInfo(Directory.GetCurrentDirectory()).FullName, name, p);
        }
示例#12
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            ExportFileFlags flags;

            using (DialogSettingsExport dialog = DialogSettingsExport.Export()){
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                flags = dialog.Flags;
            }

            string file;

            using (SaveFileDialog dialog = new SaveFileDialog {
                AddExtension = true,
                AutoUpgradeEnabled = true,
                OverwritePrompt = true,
                DefaultExt = "tdsettings",
                FileName = Program.BrandName + ".tdsettings",
                Title = "Export " + Program.BrandName + " Settings",
                Filter = Program.BrandName + " Settings (*.tdsettings)|*.tdsettings"
            }){
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                file = dialog.FileName;
            }

            Program.UserConfig.Save();

            ExportManager manager = new ExportManager(file, plugins);

            if (!manager.Export(flags))
            {
                Program.Reporter.HandleException("Profile Export Error", "An exception happened while exporting " + Program.BrandName + " settings.", true, manager.LastException);
            }
        }
示例#13
0
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", "./resources/bulk.json");

                // Call the Export() method with the export config
                results.AddRange(exportManager.Export(exportConfig));
            }

            foreach (string path in results)
            {
                Console.WriteLine(path);
            }

            Console.Read();
        }
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("chartConfig", File.ReadAllText("./resources/scrollchart.json"));
                exportConfig.Set("callbackFilePath", "./resources/expand_scroll.js");
                exportConfig.Set("asyncCapture", "true");

                // Call the Export() method with the export config
                results.AddRange(exportManager.Export(exportConfig));
            }

            foreach (string path in results)
            {
                Console.WriteLine(path);
            }

            Console.Read();
        }
        public static void Run(string host = Constants.DEFAULT_HOST, int port = Constants.DEFAULT_PORT)
        {
            // Instantiate the ExportConfig class and add the required configurations
            ExportConfig  exportConfig = new ExportConfig();
            List <string> results      = new List <string>();

            // Instantiate the ExportManager class
            using (ExportManager exportManager = new ExportManager())
            {
                exportConfig.Set("templateFilePath", "./resources/template_chartjs.html");
                exportConfig.Set("type", "jpg");
                exportConfig.Set("asyncCapture", true);

                // Call the Export() method with the export config
                results.AddRange(exportManager.Export(exportConfig));
            }

            foreach (string path in results)
            {
                Console.WriteLine(path);
            }

            Console.Read();
        }
        static void Main(string[] args)
        {
            try
            {
                List <string> results     = new List <string>();
                string        chartConfig = @"[{
                        ""type"": ""column2d"",
                        ""renderAt"": ""chart-container"",
                        ""width"": ""600"",
                        ""height"": ""400"",
                        ""dataFormat"": ""json"",
                        ""dataSource"": {
                            ""chart"": {
                                ""caption"": ""Number of visitors last week"",
                                ""subCaption"": ""Bakersfield Central vs Los Angeles Topanga""
                            },
                            ""data"": [{
                                    ""label"": ""Mon"",
                                    ""value"": ""15123""
                                },{
                                    ""label"": ""Tue"",
                                    ""value"": ""14233""
                                },{
                                    ""label"": ""Wed"",
                                    ""value"": ""25507""
                                }
                            ]
                        }
                    },
                    {
                        ""type"": ""column2d"",
                        ""renderAt"": ""chart-container"",
                        ""width"": ""600"",
                        ""height"": ""400"",
                        ""dataFormat"": ""json"",
                        ""dataSource"": {
                            ""chart"": {
                                ""caption"": ""Number of visitors last week"",
                                ""subCaption"": ""Bakersfield Central vs Los Angeles Topanga""
                            },
                            ""data"": [{
                                    ""label"": ""Mon"",
                                    ""value"": ""15123""
                                },{
                                    ""label"": ""Tue"",
                                    ""value"": ""14233""
                                },{
                                    ""label"": ""Wed"",
                                    ""value"": ""25507""
                                }
                            ]
                        }
                    }]";


                ExportConfig exportConfig = new ExportConfig();

                using (ExportManager em = new ExportManager())
                {
                    exportConfig.Set("chartConfig", chartConfig);
                    exportConfig.Set("type", "xlsx");
                    results.AddRange(em.Export(exportConfig));
                }

                foreach (string path in results)
                {
                    Console.WriteLine(path);
                    Console.WriteLine("adasd");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.Read();
        }
示例#17
0
        public void Export(Total total, string fpath)
        {
            ExportManager em = new ExportManager();

            em.Export(total, fpath);
        }
示例#18
0
        static void Main(string[] args)
        {
            string packagePath     = args[0] ?? "";
            string userName        = args[1] ?? "";
            string applicationPath = args[2] ?? "";
            bool   moduleExport    = false;
            string moduleName      = "";

            if (string.IsNullOrEmpty(packagePath))
            {
                Console.Error.WriteLine("No package path provided");
                return;
            }

            if (string.IsNullOrEmpty(applicationPath))
            {
                Console.Error.WriteLine("No main application path provided");
                return;
            }

            //Initialize Kentico API for external application
            CMSApplication.Init();

            SystemContext.WebApplicationPhysicalPath = applicationPath;

            ImportModule(packagePath, userName);

            ImportObject(packagePath, userName);

            string objectType = "";
            int    objectID   = 0;

            SiteExportSettings siteExportSettings = new SiteExportSettings(UserInfoProvider.GetUserInfo(userName))
            {
                WebsitePath        = SystemContext.WebApplicationPhysicalPath,
                TargetPath         = packagePath + "Export",
                CreatePackage      = true,
                TargetFileName     = $"ExportPackage_{DateTime.Now.ToString()}",
                TemporaryFilesPath = "/path",
            };
            //switch on one object vs global object selection
            var selectedObjects = ObjectSelections(objectType);

            if (objectID > 0)
            {
                var singleObject = SingleObjectSelection(objectID, selectedObjects);
                siteExportSettings.Select(singleObject.TypeInfo.ObjectType, singleObject.TypeInfo.ObjectClassName, singleObject.TypeInfo.IsSiteObject);
            }

            if (moduleExport)
            {
                siteExportSettings.SetInfo(ImportExportHelper.MODULE_NAME, moduleName);
            }

            siteExportSettings.Select(selectedObjects.TypeInfo.ObjectType, selectedObjects.TypeInfo.ObjectClassName, selectedObjects.TypeInfo.IsSiteObject);

            //Preset for global object selection
            siteExportSettings.SelectGlobalObjects(new List <string>(), "");

            // Make sure no data is in temp folder (possibly from previous unsuccessful export)
            ExportProvider.DeleteTemporaryFiles(siteExportSettings, true);
            ExportManager exportManager = new ExportManager(siteExportSettings);

            exportManager.Export(null);

            //Cleanup
            ExportProvider.DeleteTemporaryFiles(siteExportSettings, true);

            return;
        }
 public IActionResult Export()
 {
     _exportManager.Export();
     return(Ok(new { Message = "Başarıyla çıkartıldı." }));
 }