fixed hardcoded version info + code cleanup

This commit is contained in:
tomse
2025-08-23 16:22:44 +02:00
parent 65a0be77d2
commit 626197a22b
6 changed files with 37 additions and 35 deletions

View File

@@ -1,7 +1,6 @@
using ImageMagick; using ImageMagick;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO;
namespace PDFWorkflowManager namespace PDFWorkflowManager
{ {

View File

@@ -1,11 +1,5 @@
using System; using System;
using System.Collections.Generic; 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; using System.Windows.Forms;
namespace PDFWorkflowManager namespace PDFWorkflowManager

View File

@@ -7,6 +7,7 @@ using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -240,7 +241,7 @@ namespace PDFWorkflowManager
btnMakePDF.Enabled = true; btnMakePDF.Enabled = true;
//public string txtPostProcessor.text = ""; //public string txtPostProcessor.text = "";
} }
private void btnProjectDir_Click(object sender, EventArgs e) private void btnProjectDir_Click(object sender, EventArgs e)
@@ -702,7 +703,7 @@ namespace PDFWorkflowManager
toolStripProgressBar1.Value = 0; toolStripProgressBar1.Value = 0;
toolStripStatusLabel1.Text = "Converting files to pdf."; toolStripStatusLabel1.Text = "Converting files to pdf.";
Task convertpdf = Task.Run(() => Task convertpdf = Task.Run(() =>
{ {
Parallel.ForEach(strFiles, inputFile => Parallel.ForEach(strFiles, inputFile =>
{ {
@@ -956,7 +957,7 @@ namespace PDFWorkflowManager
// TODO make this configurable // TODO make this configurable
startInfo.FileName = Properties.Settings.Default.PDFtk; 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)) using (var process = Process.Start(startInfo))
{ {
process.WaitForExit(); process.WaitForExit();
@@ -1032,7 +1033,7 @@ namespace PDFWorkflowManager
string dateTimeNow = DateTime.Now.ToString("yyyyMMddHHmmss"); string dateTimeNow = DateTime.Now.ToString("yyyyMMddHHmmss");
string pdfMetaData = $"[ /Title ({txtTitle.Text})\r\n"; 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 += $" /Subject ({txtType.Text})\r\n";
pdfMetaData += $" /Keywords ({txtPDFKeywords.Text})\r\n"; pdfMetaData += $" /Keywords ({txtPDFKeywords.Text})\r\n";
pdfMetaData += $" /ModDate (D:{dateTimeNow})\r\n"; pdfMetaData += $" /ModDate (D:{dateTimeNow})\r\n";
@@ -1056,7 +1057,7 @@ namespace PDFWorkflowManager
string[] origFiles = Directory.GetFiles(origsDir, "*.tif"); string[] origFiles = Directory.GetFiles(origsDir, "*.tif");
int count = origFiles.Length; int count = origFiles.Length;
var startOrig = new FileInfo(origFiles[0]); 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 startTimeFile = startOrig.LastWriteTime.ToString();
string endTimeFile = endOrig.LastWriteTime.ToString(); string endTimeFile = endOrig.LastWriteTime.ToString();
@@ -1166,10 +1167,10 @@ namespace PDFWorkflowManager
string strOcrText = ""; string strOcrText = "";
//if (Directory.GetFiles(workOutDir, "*.tif").Length == txtFiles.Length) //if (Directory.GetFiles(workOutDir, "*.tif").Length == txtFiles.Length)
//{ //{
foreach (string ocrFile in txtFiles) foreach (string ocrFile in txtFiles)
{ {
strOcrText += File.ReadAllText(ocrFile) + "\r\n\r\n\r\n"; strOcrText += File.ReadAllText(ocrFile) + "\r\n\r\n\r\n";
} }
//} //}
File.WriteAllText(Path.Combine(txtProjectDir.Text, txtFileName.Text + ".ocr.txt"), strOcrText); 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) 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) var copyrightAttr = assembly
{ .GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)
//GalleryForm sf = new GalleryForm(workOutDir); .OfType<AssemblyCopyrightAttribute>()
//sf.ShowDialog(); .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
);
} }

View File

@@ -1,5 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO;
namespace PDFWorkflowManager namespace PDFWorkflowManager
{ {

View File

@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Retro Commodore")] [assembly: AssemblyCompany("Retro Commodore")]
[assembly: AssemblyProduct("PDF Workflow Manager")] [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: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.3")] [assembly: AssemblyVersion("0.9.4")]
[assembly: AssemblyFileVersion("0.9.3")] [assembly: AssemblyFileVersion("0.9.4")]