private void btnExport_Click(object sender, EventArgs e)
        {
            var result = ExportFileDialog.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            using (var excel = new ExcelPackage())
            {
                var sheet = excel.Workbook.Worksheets.Add("Hoja 1");

                var header = new List <string[]>
                {
                    new[] { "OFFSET", "ORIGINAL", "TRADUCCIÓN" }
                };

                sheet.Cells["A1:C1"].LoadFromArrays(header);

                var row = 2;
                foreach (var subtitle in _subtitles)
                {
                    sheet.Cells[row, 1].Value = subtitle.Offset;
                    sheet.Cells[row, 2].Value = subtitle.Text;
                    sheet.Cells[row, 3].Value = subtitle.Translation;

                    row++;
                }

                var excelFile = new FileInfo(ExportFileDialog.FileName);
                excel.SaveAs(excelFile);
            }
        }
Example #2
0
 /// <summary>Saves Image to Disk</summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SaveToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     if (ExportFileDialog.ShowDialog() == DialogResult.OK)
     {
         ImageBox.Image.Save(ExportFileDialog.FileName, System.Drawing.Imaging.ImageFormat.Png);
     }
 }
Example #3
0
        private void exportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ExportFileDialog.ShowDialog() == DialogResult.OK)
            {
                Log("SATEditor : Starting TXT Exporter...");

                String TXTFileName = ExportFileDialog.FileName.ToString();
                if (TXTFileName != "")
                {
                    try
                    {
                        Log("TXT Exporter : Exporting all entries on the screen into " + TXTFileName);
                        using (StreamWriter TXTFile = new StreamWriter(TXTFileName))
                        {
                            TXTFile.WriteLine("#" + " " + "\t" + SATEditorUI.ActiveForm.Text);
                            TXTFile.WriteLine("#");
                            TXTFile.WriteLine("#" + " " + "\t" + "Offset (HEX)" + "\t\t" + "Red" + "\t" + "Blue" + "\t" + "Green" + "\t" + "Alpha" + "\t\t" + "Comments (BGRA HEX as Default)");
                            TXTFile.WriteLine("#" + " " + "---------------------------------------------------------------------------------------------------------");
                            foreach (ListViewItem item in SATEditorList.Items)
                            {
                                TXTFile.WriteLine("{0}\t{1}\t\t{2}\t{3}\t{4}\t{5}\t\t{6}", item.SubItems[0].Text, item.SubItems[1].Text, item.SubItems[2].Text, item.SubItems[3].Text, item.SubItems[4].Text, item.SubItems[5].Text, item.SubItems[6].Text);
                            }

                            MessageBox.Show("All values on the screen are exported into" + "\n" + TXTFileName, "SATEditor", MessageBoxButtons.OK);
                            Log("TXT Exporter : All values on the screen are exported into " + TXTFileName);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Values could not be exported.", "SATEditor", MessageBoxButtons.OK);
                        Log("TXT Exporter : Values could not be exported." + " " + "Exception: " + ex.ToString());
                    }
                }
            }
        }
        private void ExportSimpleExcel()
        {
            if (_openProject == null)
            {
                return;
            }

            ExportFileDialog.Filter = "Archivos Excel|*.xlsx";

            var result = ExportFileDialog.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                var sl = new SLDocument();

                var row = 1;
                foreach (var str in _openProject.Strings.Where(x => x.Visible))
                {
                    sl.SetCellValue(row, 1, $"'{str.Original}");
                    sl.SetCellValue(row, 2, $"'{str.Translation}");
                    row++;
                }

                sl.SaveAs(ExportFileDialog.FileName);
            }
        }
        private void btnExportPo_Click(object sender, EventArgs e)
        {
            ExportFileDialog.Filter   = "Archivos Po|*.po";
            ExportFileDialog.FileName = string.Concat(Path.GetFileNameWithoutExtension(_file.Path), ".po");
            var result = ExportFileDialog.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            _file.ExportPo(ExportFileDialog.FileName);
        }
Example #6
0
        private void MenuStrip_File_Export_Click(object sender, EventArgs e)
        {
            if (ExportFileDialog.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            SetStatusText("Exporting Table...");

            Export.ToFile(ref m_loadedTable, ExportFileDialog.FileName,
                          Export.GetFormatFromExtension(ExportFileDialog.FileName));

            SetStatusText("Viewing Table: {0}.tbl", m_loadedTable.TableName);
        }
Example #7
0
 private void ExportButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (ExportFileDialog.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         Texture.Save(ExportFileDialog.FileName, ImageFormat.Png);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error: Can not export texture.");
     }
 }
Example #8
0
        /// <summary>
        ///     Creates ExportFileDialog to get width, height and path of file.
        /// </summary>
        /// <param name="bitmap">Bitmap to be saved as file.</param>
        /// <param name="fileDimensions">Size of file.</param>
        public static void Export(WriteableBitmap bitmap, Size fileDimensions)
        {
            ExportFileDialog info = new ExportFileDialog(fileDimensions);

            // If OK on dialog has been clicked
            if (info.ShowDialog())
            {
                // If sizes are incorrect
                if (info.FileWidth < bitmap.Width || info.FileHeight < bitmap.Height)
                {
                    MessageBox.Show("Incorrect height or width value", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                SaveAsPng(info.FilePath, info.FileWidth, info.FileHeight, bitmap);
            }
        }
Example #9
0
        private void ExportTextureMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (ExportFileDialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                LoadedResource.Texture.Save(ExportFileDialog.FileName, ImageFormat.Png);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), "Error: Can not export texture.",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #10
0
        /// <summary>
        /// Creates ExportFileDialog to get width, height and path of file.
        /// </summary>
        /// <param name="type">Type of file to be saved in.</param>
        /// <param name="imageToSave">Image to be saved as file.</param>
        public static void Export(FileType type, Image imageToSave, Size fileDimensions)
        {
            ExportFileDialog info = new ExportFileDialog(fileDimensions);

            //If OK on dialog has been clicked
            if (info.ShowDialog() == true)
            {
                //If sizes are incorrect
                if (info.FileWidth < imageToSave.Width || info.FileHeight < imageToSave.Height)
                {
                    MessageBox.Show("Incorrect height or width value", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                _savePath       = info.FilePath;
                _fileDimensions = new Size(info.FileWidth, info.FileHeight);
                SaveAsPng(info.FilePath, (int)imageToSave.Width, (int)imageToSave.Height, info.FileHeight, info.FileWidth, imageToSave);
            }
        }
        private void btnExport_Click(object sender, System.EventArgs e)
        {
            var result = ExportFileDialog.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            using (var excel = new ExcelPackage())
            {
                var sheet = excel.Workbook.Worksheets.Add("Hoja 1");

                var header = new List <string[]>
                {
                    new[] { "COLUMNA", "ORDEN", "ORIGINAL", "TRADUCCIÓN" }
                };

                sheet.Cells["A1:D1"].LoadFromArrays(header);

                var row = 2;
                foreach (var column in _data.Columns)
                {
                    var uniqueValues = column.GetUniqueValues();

                    var i = 0;
                    foreach (var(original, translation) in uniqueValues)
                    {
                        sheet.Cells[row, 1].Value = column.Name;
                        sheet.Cells[row, 2].Value = i;
                        sheet.Cells[row, 3].Value = original;
                        sheet.Cells[row, 4].Value = translation;

                        i++;
                        row++;
                    }
                }

                var excelFile = new FileInfo(ExportFileDialog.FileName);
                excel.SaveAs(excelFile);
            }
        }
        private void ExportCompleteExcel()
        {
            if (_openProject == null)
            {
                return;
            }

            ExportFileDialog.Filter = "Archivos Excel|*.xlsx";

            var result = ExportFileDialog.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                var sl = new SLDocument();

                var row = 2;
                sl.SetCellValue(1, 1, "FICHERO");
                sl.SetCellValue(1, 2, "SECCION");
                sl.SetCellValue(1, 3, "OFFSET");
                sl.SetCellValue(1, 4, "ORIGINAL");
                sl.SetCellValue(1, 5, "TRADUCCION");

                var files = _openProject.Files.ToDictionary(file => file.Id, file => Path.GetFileName(file.Path));

                foreach (var str in _openProject.Strings.Where(x => x.Visible))
                {
                    sl.SetCellValue(row, 1, files[str.FileId]);
                    sl.SetCellValue(row, 2, str.Section);
                    sl.SetCellValue(row, 3, str.Offset);
                    sl.SetCellValue(row, 4, $"'{str.Original}");
                    sl.SetCellValue(row, 5, $"'{str.Translation}");
                    row++;
                }

                sl.SaveAs(ExportFileDialog.FileName);
            }
        }
        protected override void btnExport_Click(object sender, EventArgs e)
        {
            ExportFileDialog.Filter   = "Archivos Excel|*.xlsx";
            ExportFileDialog.FileName = string.Concat(Path.GetFileNameWithoutExtension(_file.Path), ".xlsx");
            var result = ExportFileDialog.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            using (var excel = new ExcelPackage())
            {
                var sheet = excel.Workbook.Worksheets.Add("Hoja 1");

                var header = new List <string[]>
                {
                    new[] { "ID", "ORIGINAL", "TRADUCCIÓN" }
                };

                sheet.Cells["A1:C1"].LoadFromArrays(header);

                var row = 2;
                foreach (var subtitle in _subtitles)
                {
                    var subtitleWithId = subtitle as SubtitleWithId;
                    sheet.Cells[row, 1].Value = subtitleWithId.Id;
                    sheet.Cells[row, 2].Value = subtitleWithId.Text;
                    sheet.Cells[row, 3].Value = subtitleWithId.Translation;

                    row++;
                }

                var excelFile = new FileInfo(ExportFileDialog.FileName);
                excel.SaveAs(excelFile);
            }
        }
Example #14
0
 private void BtnExportAllSsns_Click(object sender, EventArgs e)
 {
     isExportAllSession      = true;
     ExportFileDialog.Filter = "XML Files (*.xml)|*.xml";
     ExportFileDialog.ShowDialog();
 }
Example #15
0
 private void BtnExportSsn_Click(object sender, EventArgs e)
 {
     isExportAllSession      = false;
     ExportFileDialog.Filter = "XML Files (*.xml)|*.xml|Data Files (*.dat)|*.dat";
     ExportFileDialog.ShowDialog();
 }
Example #16
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            if (ExportTableComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select a table from the dropdown.");
                return;
            }

            Table table = (Table)ExportTableComboBox.SelectedItem;

            ExportFileDialog.FileName = table.Name;

            DialogResult result = ExportFileDialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            Field[] fields = ExportFieldsPanel.Controls
                             .OfType <CheckBox>()
                             .Where(checkBox => checkBox.Checked)
                             .Select(checkBox => (Field)checkBox.Tag)
                             .ToArray();

            // Disabling the tab control makes it so the user cannot interact with any
            // controls while the export is executing, but running in a separate thread
            // does allow the user to move the window around while the export executes
            Cursor cursor = Cursor;

            BeginExport();

            Thread t = new Thread(() =>
            {
                try { DoExport(); }
                finally { EndExport(); }
            });

            t.IsBackground = true;
            t.Start();

            void BeginExport()
            {
                if (InvokeRequired)
                {
                    Invoke(new Action(BeginExport));
                    return;
                }

                MainTabControl.Enabled = false;
                Cursor = Cursors.WaitCursor;
                ExportProgressBar.Value = 0;
            }

            void DoExport()
            {
                // The DBSchema database connection was closed after loading the schema so
                // it needs to be reopened before we can query the data to be exported
                OpenDBConnectionAndExecute(() => ExportSelectionToFile(table, fields));

                // Automatically open the exported file to upon completion
                using (Process.Start(ExportFileDialog.FileName)) { }
            }

            void EndExport()
            {
                if (InvokeRequired)
                {
                    Invoke(new Action(EndExport));
                    return;
                }

                MainTabControl.Enabled = true;
                Cursor = cursor;
                ExportProgressBar.Value = 100;
            }
        }
 private void btnExport_Click(object sender, EventArgs e)
 {
     ExportFileDialog.Filter = "Excel File|*.xls";
     ExportFileDialog.Title  = "Save an Excel File";
     ExportFileDialog.ShowDialog();
 }