fixed hardcoded version info + code cleanup
This commit is contained in:
		@@ -1,7 +1,6 @@
 | 
			
		||||
using ImageMagick;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
using System.Drawing.Imaging;
 | 
			
		||||
using System.IO;
 | 
			
		||||
 | 
			
		||||
namespace PDFWorkflowManager
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,5 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
using System.Data;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows.Forms;
 | 
			
		||||
 | 
			
		||||
namespace PDFWorkflowManager
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ using System.Drawing;
 | 
			
		||||
using System.Drawing.Imaging;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using System.Security.Cryptography;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
@@ -239,8 +240,8 @@ namespace PDFWorkflowManager
 | 
			
		||||
 | 
			
		||||
            btnMakePDF.Enabled = true;
 | 
			
		||||
            //public string txtPostProcessor.text = "";
 | 
			
		||||
            
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private void btnProjectDir_Click(object sender, EventArgs e)
 | 
			
		||||
@@ -301,8 +302,8 @@ namespace PDFWorkflowManager
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // Check input dir for origs dir and files
 | 
			
		||||
        private void check_input_dir() 
 | 
			
		||||
        { 
 | 
			
		||||
        private void check_input_dir()
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            Cursor.Current = Cursors.WaitCursor;
 | 
			
		||||
 | 
			
		||||
@@ -311,7 +312,7 @@ namespace PDFWorkflowManager
 | 
			
		||||
                MessageBox.Show("Origs dir not found.", "Origs dir not found.", MessageBoxButtons.OK, MessageBoxIcon.Error);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            else if (Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir), "*.tif").Length == 0 
 | 
			
		||||
            else if (Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir), "*.tif").Length == 0
 | 
			
		||||
                && Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir), "*.tiff").Length == 0
 | 
			
		||||
                && Directory.GetFiles(Path.Combine(txtProjectDir.Text, Properties.Settings.Default.OrigsDir), "*.png").Length == 0)
 | 
			
		||||
            {
 | 
			
		||||
@@ -421,7 +422,7 @@ namespace PDFWorkflowManager
 | 
			
		||||
 | 
			
		||||
                    // Set Banner
 | 
			
		||||
                    if (Properties.Settings.Default.Banner != 2)
 | 
			
		||||
                    { 
 | 
			
		||||
                    {
 | 
			
		||||
                        if ((image.Width > 4000 || image.Height > 5500) && (cmbResolution.SelectedItem.ToString() == "600"))
 | 
			
		||||
                        {
 | 
			
		||||
                            cmbBanner.SelectedIndex = 0;
 | 
			
		||||
@@ -702,7 +703,7 @@ namespace PDFWorkflowManager
 | 
			
		||||
            toolStripProgressBar1.Value = 0;
 | 
			
		||||
            toolStripStatusLabel1.Text = "Converting files to pdf.";
 | 
			
		||||
 | 
			
		||||
            Task convertpdf =  Task.Run(() =>
 | 
			
		||||
            Task convertpdf = Task.Run(() =>
 | 
			
		||||
            {
 | 
			
		||||
                Parallel.ForEach(strFiles, inputFile =>
 | 
			
		||||
                {
 | 
			
		||||
@@ -909,7 +910,7 @@ namespace PDFWorkflowManager
 | 
			
		||||
                txtPageCount.Text = outFiles.Length.ToString();
 | 
			
		||||
            }
 | 
			
		||||
            catch
 | 
			
		||||
            { 
 | 
			
		||||
            {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -921,7 +922,7 @@ namespace PDFWorkflowManager
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            { 
 | 
			
		||||
            {
 | 
			
		||||
                toolStripProgressBar1.Maximum = 1;
 | 
			
		||||
                toolStripStatusLabel1.Text = "Creating final pdf.";
 | 
			
		||||
                toolStripProgressBar1.Value = 0;
 | 
			
		||||
@@ -956,7 +957,7 @@ namespace PDFWorkflowManager
 | 
			
		||||
 | 
			
		||||
                // TODO make this configurable
 | 
			
		||||
                startInfo.FileName = Properties.Settings.Default.PDFtk;
 | 
			
		||||
                startInfo.Arguments = "\"" + Path.Combine(outputDir, "*.pdf") + "\" " + bannerPage + " cat output " + "\"" + tempFile +  "\"";
 | 
			
		||||
                startInfo.Arguments = "\"" + Path.Combine(outputDir, "*.pdf") + "\" " + bannerPage + " cat output " + "\"" + tempFile + "\"";
 | 
			
		||||
                using (var process = Process.Start(startInfo))
 | 
			
		||||
                {
 | 
			
		||||
                    process.WaitForExit();
 | 
			
		||||
@@ -1032,7 +1033,7 @@ namespace PDFWorkflowManager
 | 
			
		||||
            string dateTimeNow = DateTime.Now.ToString("yyyyMMddHHmmss");
 | 
			
		||||
 | 
			
		||||
            string pdfMetaData = $"[ /Title ({txtTitle.Text})\r\n";
 | 
			
		||||
            pdfMetaData += $" /Author ("+ txtPDFAuthor.Text + ")\r\n";
 | 
			
		||||
            pdfMetaData += $" /Author (" + txtPDFAuthor.Text + ")\r\n";
 | 
			
		||||
            pdfMetaData += $" /Subject ({txtType.Text})\r\n";
 | 
			
		||||
            pdfMetaData += $" /Keywords ({txtPDFKeywords.Text})\r\n";
 | 
			
		||||
            pdfMetaData += $" /ModDate (D:{dateTimeNow})\r\n";
 | 
			
		||||
@@ -1056,7 +1057,7 @@ namespace PDFWorkflowManager
 | 
			
		||||
            string[] origFiles = Directory.GetFiles(origsDir, "*.tif");
 | 
			
		||||
            int count = origFiles.Length;
 | 
			
		||||
            var startOrig = new FileInfo(origFiles[0]);
 | 
			
		||||
            var endOrig = new FileInfo(origFiles[count-1]);
 | 
			
		||||
            var endOrig = new FileInfo(origFiles[count - 1]);
 | 
			
		||||
            string startTimeFile = startOrig.LastWriteTime.ToString();
 | 
			
		||||
            string endTimeFile = endOrig.LastWriteTime.ToString();
 | 
			
		||||
 | 
			
		||||
@@ -1166,10 +1167,10 @@ namespace PDFWorkflowManager
 | 
			
		||||
            string strOcrText = "";
 | 
			
		||||
            //if (Directory.GetFiles(workOutDir, "*.tif").Length == txtFiles.Length)
 | 
			
		||||
            //{
 | 
			
		||||
                foreach (string ocrFile in txtFiles)
 | 
			
		||||
                {
 | 
			
		||||
                    strOcrText += File.ReadAllText(ocrFile) + "\r\n\r\n\r\n";
 | 
			
		||||
                }
 | 
			
		||||
            foreach (string ocrFile in txtFiles)
 | 
			
		||||
            {
 | 
			
		||||
                strOcrText += File.ReadAllText(ocrFile) + "\r\n\r\n\r\n";
 | 
			
		||||
            }
 | 
			
		||||
            //}
 | 
			
		||||
            File.WriteAllText(Path.Combine(txtProjectDir.Text, txtFileName.Text + ".ocr.txt"), strOcrText);
 | 
			
		||||
        }
 | 
			
		||||
@@ -1328,13 +1329,22 @@ namespace PDFWorkflowManager
 | 
			
		||||
 | 
			
		||||
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            MessageBox.Show("PDF Workflow Manager v0.9.4 \r\n\r\nCopyright (c) 2023-2025 https://retro-commodore.eu", "Version", MessageBoxButtons.OK, MessageBoxIcon.Information);
 | 
			
		||||
        }
 | 
			
		||||
            var assembly = Assembly.GetExecutingAssembly();
 | 
			
		||||
            var version = assembly.GetName().Version.ToString();
 | 
			
		||||
 | 
			
		||||
        private void button1_Click(object sender, EventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            //GalleryForm sf = new GalleryForm(workOutDir);
 | 
			
		||||
            //sf.ShowDialog();
 | 
			
		||||
            var copyrightAttr = assembly
 | 
			
		||||
                .GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)
 | 
			
		||||
                .OfType<AssemblyCopyrightAttribute>()
 | 
			
		||||
                .FirstOrDefault();
 | 
			
		||||
 | 
			
		||||
            var copyright = copyrightAttr?.Copyright ?? "Copyright info not found";
 | 
			
		||||
 | 
			
		||||
            MessageBox.Show(
 | 
			
		||||
                $"PDF Workflow Manager v{version}\r\n\r\n{copyright}",
 | 
			
		||||
                "Version",
 | 
			
		||||
                MessageBoxButtons.OK,
 | 
			
		||||
                MessageBoxIcon.Information
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.IO;
 | 
			
		||||
 | 
			
		||||
namespace PDFWorkflowManager
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
 | 
			
		||||
[assembly: AssemblyConfiguration("")]
 | 
			
		||||
[assembly: AssemblyCompany("Retro Commodore")]
 | 
			
		||||
[assembly: AssemblyProduct("PDF Workflow Manager")]
 | 
			
		||||
[assembly: AssemblyCopyright("Copyright © 2023-2024 https://retro-commodore.eu")]
 | 
			
		||||
[assembly: AssemblyCopyright("Copyright © 2023-2025 https://retro-commodore.eu")]
 | 
			
		||||
[assembly: AssemblyTrademark("")]
 | 
			
		||||
[assembly: AssemblyCulture("")]
 | 
			
		||||
 | 
			
		||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
 | 
			
		||||
// You can specify all the values or you can default the Build and Revision Numbers
 | 
			
		||||
// by using the '*' as shown below:
 | 
			
		||||
// [assembly: AssemblyVersion("1.0.*")]
 | 
			
		||||
[assembly: AssemblyVersion("0.9.3")]
 | 
			
		||||
[assembly: AssemblyFileVersion("0.9.3")]
 | 
			
		||||
[assembly: AssemblyVersion("0.9.4")]
 | 
			
		||||
[assembly: AssemblyFileVersion("0.9.4")]
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,8 @@ namespace PDFWorkflowManager
 | 
			
		||||
{
 | 
			
		||||
    public partial class SettingsForm : Form
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public SettingsForm()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user