diff --git a/OfficeConverter.sln b/OfficeConverter.sln
index 0c1684f..7a7661d 100644
--- a/OfficeConverter.sln
+++ b/OfficeConverter.sln
@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OfficeConverter", "OfficeCo
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projektmappenelemente", "Projektmappenelemente", "{D66D2D0C-17EE-4008-BB58-DDD6EB016AAB}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OfficeConverterCore", "OfficeConverterCore\OfficeConverterCore.csproj", "{B996BAD7-81B4-47F1-84E9-73ABE48859AC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -29,6 +31,18 @@ Global
{6E77662E-82C3-4913-8964-5A452B229F78}.Test|Any CPU.Build.0 = Test|Any CPU
{6E77662E-82C3-4913-8964-5A452B229F78}.Test|x64.ActiveCfg = Debug|x64
{6E77662E-82C3-4913-8964-5A452B229F78}.Test|x64.Build.0 = Debug|x64
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Debug|x64.Build.0 = Debug|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Release|x64.ActiveCfg = Release|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Release|x64.Build.0 = Release|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Test|Any CPU.ActiveCfg = Debug|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Test|Any CPU.Build.0 = Debug|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Test|x64.ActiveCfg = Debug|Any CPU
+ {B996BAD7-81B4-47F1-84E9-73ABE48859AC}.Test|x64.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/OfficeConverterCore/App.config b/OfficeConverterCore/App.config
new file mode 100644
index 0000000..5f986e8
--- /dev/null
+++ b/OfficeConverterCore/App.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OfficeConverterCore/App.xaml b/OfficeConverterCore/App.xaml
new file mode 100644
index 0000000..3320980
--- /dev/null
+++ b/OfficeConverterCore/App.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/OfficeConverterCore/App.xaml.cs b/OfficeConverterCore/App.xaml.cs
new file mode 100644
index 0000000..255f980
--- /dev/null
+++ b/OfficeConverterCore/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace OfficeConverter
+{
+ ///
+ /// Interaktionslogik für "App.xaml"
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/OfficeConverterCore/MainWindow.xaml b/OfficeConverterCore/MainWindow.xaml
new file mode 100644
index 0000000..e932bd3
--- /dev/null
+++ b/OfficeConverterCore/MainWindow.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OfficeConverterCore/MainWindow.xaml.cs b/OfficeConverterCore/MainWindow.xaml.cs
new file mode 100644
index 0000000..63f0202
--- /dev/null
+++ b/OfficeConverterCore/MainWindow.xaml.cs
@@ -0,0 +1,699 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using Excel = Microsoft.Office.Interop.Excel;
+using Forms = System.Windows.Forms;
+using PowerPoint = Microsoft.Office.Interop.PowerPoint;
+using Word = Microsoft.Office.Interop.Word;
+
+namespace OfficeConverter
+{
+ ///
+ /// Interaktionslogik für MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ //Definiere Background worker für die Konvertierung
+ private BackgroundWorker backgroundWorker;
+ private CancellationTokenSource cancellationTokenSource;
+
+ //Definiter listen für die Anzeige im GUI
+ List combinedFiles = new List();
+ List convertedFiles = new List();
+
+ //Globalvariables
+ bool doSubfolders = false;
+ bool doReplace = false;
+ bool doWord = false;
+ bool doExcel = false;
+ bool doPPoint = false;
+ string errorFolderEmpty = "";
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ setLangEN();
+ chkWord.IsChecked = true;
+ chkExcel.IsChecked = true;
+ chkPowerpoint.IsChecked = true;
+ cmbLang.Items.Add("EN");
+ cmbLang.Items.Add("DE");
+ cmbLang.SelectedIndex = 0;
+ lstDestFiles.ItemsSource = convertedFiles;
+
+ backgroundWorker = new BackgroundWorker();
+ backgroundWorker.WorkerReportsProgress = true;
+ backgroundWorker.DoWork += BackgroundWorker_DoWork;
+ backgroundWorker.ProgressChanged += BackgroundWorker_ProgressChanged;
+ backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;
+ lblState.Content = "Ready";
+ cancellationTokenSource = new CancellationTokenSource();
+ }
+
+
+ //Konvertier-Button
+ private void btnConvert_Click(object sender, RoutedEventArgs e)
+ {
+ string folderPath = txtSourceFolder.Text;
+ if (cmbLang.SelectedIndex == 0)
+ {
+ lblState.Content = "Conversion in progress";
+ }
+ if (cmbLang.SelectedIndex == 1)
+ {
+ lblState.Content = "Konvertierung läuft";
+ }
+
+ doSubfolders = (bool)chkSubfolders.IsChecked;
+ doReplace = (bool)chkReplace.IsChecked;
+ doWord = (bool)chkWord.IsChecked;
+ doExcel = (bool)chkExcel.IsChecked;
+ doPPoint = (bool)chkPowerpoint.IsChecked;
+
+ // Check if the background worker is not already running
+ if (!backgroundWorker.IsBusy)
+ {
+ // Start the existing background worker
+ backgroundWorker.RunWorkerAsync(folderPath);
+ }
+ else
+ {
+ // The worker is already busy, handle accordingly
+ System.Windows.MessageBox.Show("Conversion is already in progress. Please wait for the current operation to finish.");
+ }
+ }
+
+ //Background Worker
+ private async void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
+ {
+ // Clear the list of converted files at the beginning of each conversion
+ convertedFiles.Clear();
+ string folderPath = e.Argument as string;
+
+ // Use Dispatcher.Invoke to access UI elements from the UI thread
+ System.Windows.Application.Current.Dispatcher.Invoke(() =>
+ {
+ // Check if txtDestFolder is empty and doReplace is false
+ if (string.IsNullOrWhiteSpace(txtDestFolder.Text) && !doReplace)
+ {
+ // Show a warning message in a MessageBox
+ System.Windows.MessageBox.Show(errorFolderEmpty, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
+
+ // Cancel the task
+ e.Cancel = true;
+ cancellationTokenSource.Cancel();
+
+ return;
+ }
+
+ // Disable buttons during conversion
+ UpdateButtonStates(false);
+
+ // Initialize the CancellationTokenSource
+ cancellationTokenSource = new CancellationTokenSource();
+ });
+
+ try
+ {
+ // Pass the cancellation token to SearchAndConvertDocs
+ await SearchAndConvertDocs(folderPath, cancellationTokenSource.Token);
+ }
+ catch (OperationCanceledException)
+ {
+ // Handle cancellation if needed
+ }
+ finally
+ {
+ // Use Dispatcher.Invoke to update UI elements from the UI thread
+ System.Windows.Application.Current.Dispatcher.Invoke(() =>
+ {
+ // Clear the UI-bound collection
+ combinedFiles.Clear();
+ // Add the contents of the combinedFiles list to the UI-bound collection
+ combinedFiles.ForEach(file => lstSourceFiles.Items.Add(file));
+ // Enable buttons after conversion completion
+ UpdateButtonStates(true);
+ });
+ }
+ }
+ private void BackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
+ {
+ // Update the UI with the progress value
+ //progressBar.Value = e.ProgressPercentage;
+ }
+ private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
+ {
+ // Perform any additional tasks after the background work is completed
+ // Enable buttons after conversion completion
+
+ }
+
+ private async Task SearchAndConvertDocs(string folderPath, CancellationToken cancellationToken)
+ {
+ string[] docFiles = null;
+ string[] xlsFiles = null;
+ string[] pptFiles = null;
+
+ if (doWord)
+ {
+ docFiles = Directory.GetFiles(folderPath, "*.doc");
+ }
+ if (doExcel)
+ {
+ xlsFiles = Directory.GetFiles(folderPath, "*.xls");
+ }
+ if (doPPoint)
+ {
+ pptFiles = Directory.GetFiles(folderPath, "*.ppt");
+ }
+
+ // Check for null before adding to combinedFiles
+ if (docFiles != null)
+ {
+ combinedFiles.AddRange(docFiles);
+ }
+ if (xlsFiles != null)
+ {
+ combinedFiles.AddRange(xlsFiles);
+ }
+ if (pptFiles != null)
+ {
+ combinedFiles.AddRange(pptFiles);
+ }
+
+ Console.WriteLine($"Processing files in folder: {folderPath}");
+
+ /// Create a copy of the collection to avoid modification during iteration
+ List snapshot = new List(combinedFiles);
+
+ // Check for cancellation after creating the snapshot
+ cancellationToken.ThrowIfCancellationRequested();
+
+
+ try
+ {
+ // Iterate over currentFolderFiles and start the conversion asynchronously
+ foreach (var docFile in snapshot)
+ {
+ // Check for cancellation before each iteration
+ cancellationToken.ThrowIfCancellationRequested();
+
+ Console.WriteLine($"Converting file: {docFile}");
+
+ try
+ {
+ await ConvertFileToNewFormatAsync(docFile);
+
+ Console.WriteLine($"DisplayCombinedFiles called");
+ DisplayCombinedFiles();
+ }
+ catch (Exception ex)
+ {
+ // Handle exception (log, display error message, etc.)
+ Console.WriteLine($"Error converting {docFile}: {ex.Message}");
+ }
+
+ Console.WriteLine($"Task completed for file: {docFile}");
+ }
+
+ // Check for cancellation before displaying the completion message
+ cancellationToken.ThrowIfCancellationRequested();
+
+ // Clear the list of combined files if the operation was cancelled
+ if (cancellationToken.IsCancellationRequested)
+ {
+ combinedFiles.Clear();
+ }
+ }
+ catch (OperationCanceledException)
+ {
+ // Handle cancellation if needed
+ }
+
+ // Recursively process subfolders
+ if (doSubfolders)
+ {
+ string[] subfolders = Directory.GetDirectories(folderPath);
+ foreach (var subfolder in subfolders)
+ {
+ // Pass the cancellation token to the recursive call
+ await SearchAndConvertDocs(subfolder, cancellationToken);
+
+ // Check for cancellation after processing each subfolder
+ if (cancellationToken.IsCancellationRequested)
+ {
+ // Stop processing if cancellation is requested
+ break;
+ }
+ }
+ }
+
+ System.Windows.Application.Current.Dispatcher.Invoke(() =>
+ {
+ lblState.Content = "Background work completed!";
+ });
+
+ DisplayCombinedFiles();
+ }
+ private async Task ConvertFileToNewFormatAsync(string filePath)
+ {
+ await Task.Run(() =>
+ {
+ try
+ {
+ // Determine the file type based on the extension
+ string extension = System.IO.Path.GetExtension(filePath);
+
+ switch (extension.ToLowerInvariant())
+ {
+ case ".doc":
+ ConvertDocToDocx(filePath, doSubfolders, doReplace);
+ break;
+
+ case ".xls":
+ ConvertXlsToXlsx(filePath, doSubfolders, doReplace);
+ break;
+
+ case ".ppt":
+ ConvertPptToPptx(filePath, doSubfolders, doReplace);
+ break;
+
+ default:
+ // Handle other file types or show an error message
+ Console.WriteLine($"Unsupported file type: {filePath}");
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ // Handle exceptions during conversion
+ Console.WriteLine($"Error converting {filePath}: {ex.Message}");
+ }
+ });
+
+ // Update UI on the main thread
+ System.Windows.Application.Current.Dispatcher.Invoke(() =>
+ {
+ combinedFiles.Remove(filePath);
+ convertedFiles.Add(filePath);
+
+ DisplayCombinedFiles();
+ });
+ }
+ private void ConvertXlsToXlsx(string xlsFile, bool doSubfolders, bool doReplace)
+ {
+ Excel.Application excelApp = new Excel.Application();
+ excelApp.DisplayAlerts = false;
+
+ try
+ {
+ Excel.Workbook workbook = excelApp.Workbooks.Open(xlsFile);
+
+ string targetFolderPath = "";
+
+ // Use Dispatcher.Invoke to execute code on the UI thread
+ Dispatcher.Invoke(() =>
+ {
+ targetFolderPath = GetTargetFolderPath(doReplace, doSubfolders, xlsFile);
+ });
+
+ // Ensure the target folder exists
+ if (!Directory.Exists(targetFolderPath))
+ {
+ Directory.CreateDirectory(targetFolderPath);
+ }
+
+ // Construct the new path for the .xlsx file
+ string newXlsxPath = Path.Combine(targetFolderPath, Path.ChangeExtension(Path.GetFileName(xlsFile), ".xlsx"));
+ workbook.SaveAs(newXlsxPath, Excel.XlFileFormat.xlOpenXMLWorkbook);
+ workbook.Close();
+ }
+ finally
+ {
+ // Quit Excel and release resources
+ excelApp.Quit();
+ Marshal.ReleaseComObject(excelApp);
+
+ // Ensure Excel processes are terminated
+ KillProcess("EXCEL");
+ }
+ }
+ private void ConvertPptToPptx(string pptFile, bool doSubfolders, bool doReplace)
+ {
+ PowerPoint.Application pptApp = new PowerPoint.Application();
+ pptApp.DisplayAlerts = PowerPoint.PpAlertLevel.ppAlertsNone;
+
+ // Set PowerPoint application visibility to false
+ pptApp.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
+
+ try
+ {
+ PowerPoint.Presentation presentation = pptApp.Presentations.Open(pptFile);
+
+ string targetFolderPath = "";
+
+ // Use Dispatcher.Invoke to execute code on the UI thread
+ Dispatcher.Invoke(() =>
+ {
+ targetFolderPath = GetTargetFolderPath(doReplace, doSubfolders, pptFile);
+ });
+
+ // Ensure the target folder exists
+ if (!Directory.Exists(targetFolderPath))
+ {
+ Directory.CreateDirectory(targetFolderPath);
+ }
+
+ // Construct the new path for the .pptx file
+ string newPptxPath = Path.Combine(targetFolderPath, Path.ChangeExtension(Path.GetFileName(pptFile), ".pptx"));
+ presentation.SaveAs(newPptxPath, PowerPoint.PpSaveAsFileType.ppSaveAsOpenXMLPresentation);
+ presentation.Close();
+ }
+ finally
+ {
+ // Set PowerPoint application visibility back to true before quitting
+ pptApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
+
+ // Quit PowerPoint
+ pptApp.Quit();
+ }
+ }
+ private void ConvertDocToDocx(string docFile, bool doSubfolders, bool doReplace)
+ {
+ Word.Application wordApp = new Word.Application();
+ wordApp.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone;
+
+ try
+ {
+ Word.Document doc = wordApp.Documents.Open(docFile);
+
+ string targetFolderPath = "";
+
+ // Use Dispatcher.Invoke to execute code on the UI thread
+ Dispatcher.Invoke(() =>
+ {
+ targetFolderPath = GetTargetFolderPath(doReplace, doSubfolders, docFile);
+ });
+
+ // Ensure the target folder exists
+ if (!Directory.Exists(targetFolderPath))
+ {
+ Directory.CreateDirectory(targetFolderPath);
+ }
+
+ // Construct the new path for the .docx file
+ string newDocxPath = Path.Combine(targetFolderPath, Path.ChangeExtension(Path.GetFileName(docFile), ".docx"));
+ doc.SaveAs2(newDocxPath, Word.WdSaveFormat.wdFormatXMLDocument);
+ doc.Close();
+ }
+ finally
+ {
+ // Quit Word and release resources
+ wordApp.Quit();
+ Marshal.ReleaseComObject(wordApp);
+
+ // Ensure Word processes are terminated
+ KillProcess("WINWORD");
+ }
+ }
+ private void KillProcess(string processName)
+ {
+ try
+ {
+ foreach (var process in Process.GetProcessesByName(processName))
+ {
+ process.Kill();
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Error terminating {processName} processes: {ex.Message}");
+ }
+ }
+
+ // Helper method to determine the target folder path
+ private string GetTargetFolderPath(bool doReplace, bool doSubfolders, string docFilePath)
+ {
+ string targetFolder;
+
+ if (doReplace)
+ {
+ // If doReplace is true, use the original folder of the document file
+ targetFolder = Path.GetDirectoryName(docFilePath);
+ }
+ else
+ {
+ // If doReplace is false, use the folder defined in txtDestFolder
+ targetFolder = txtDestFolder.Text.TrimEnd('\\'); // Ensure no trailing backslash
+
+ // If doSubfolders is true, adjust the target folder based on relative path
+ if (doSubfolders)
+ {
+ string originalFolderPath = txtSourceFolder.Text.TrimEnd('\\'); // Ensure no trailing backslash
+ string relativePath = GetRelativePath(docFilePath, originalFolderPath);
+
+ // Combine the target folder with the modified relative path
+ targetFolder = Path.Combine(targetFolder, relativePath);
+
+ // Ensure the target folder does not include the source folder name
+ string sourceFolderName = Path.GetFileName(originalFolderPath);
+
+ // Remove the source folder name from the target path
+ targetFolder = targetFolder.Replace(sourceFolderName, "").TrimEnd('\\');
+
+ // Replace the original folder path with the destination folder path
+ targetFolder = targetFolder.Replace(originalFolderPath, txtDestFolder.Text.TrimEnd('\\'));
+ }
+ }
+
+ return targetFolder;
+ }
+
+ private string GetRelativePath(string fullPath, string basePath)
+ {
+ Uri baseUri = new Uri(basePath + (basePath.EndsWith("\\") ? "" : "\\"));
+ Uri fullUri = new Uri(fullPath);
+
+ Uri relativeUri = baseUri.MakeRelativeUri(fullUri);
+ string relativePath = Uri.UnescapeDataString(relativeUri.ToString());
+
+ // Replace forward slashes with backslashes
+ relativePath = relativePath.Replace('/', '\\');
+
+ // Remove the filename from the relative path
+ relativePath = Path.GetDirectoryName(relativePath);
+
+ return relativePath;
+ }
+
+ private void setLangEN()
+ {
+ grpFolders.Header = "Folders";
+ lblSouceFolder.Content = "Source Folder";
+ lblDestFolder.Content = "Destination Folder";
+ btnDestFolder.Content = "Browse";
+ btnSourceFolder.Content = "Browse";
+ chkReplace.Content = "Replace files (Preserve folder structure in subfolders)";
+ chkSubfolders.Content = "incl. Subfolders";
+ grpFiles.Header = "Files";
+ grpSourceFiles.Header = "Queue";
+ grpDestFiles.Header = "Completed";
+ btnConvert.Content = "Convert";
+ btnDelete.Content = "Delete Files";
+ btnExport.Content = "Export list";
+ errorFolderEmpty = "Destination folder is required when 'Replace files' is not selected.";
+ }
+ private void setLangDE()
+ {
+ grpFolders.Header = "Verzeichnisse";
+ lblSouceFolder.Content = "Quellordner";
+ lblDestFolder.Content = "Zielordner";
+ btnDestFolder.Content = "Suchen";
+ btnSourceFolder.Content = "Suchen";
+ chkReplace.Content = "Ersetze Dateien (erhalte die Ordnerstruktur für Unterordner)";
+ chkSubfolders.Content = "Unterordner mit einbeziehen";
+ grpFiles.Header = "Dateien";
+ grpSourceFiles.Header = "Warteschlange";
+ grpDestFiles.Header = "Fertiggestellt";
+ btnConvert.Content = "Konvertieren";
+ btnDelete.Content = "Dateien löschen";
+ btnExport.Content = "Liste exportieren";
+ errorFolderEmpty = "Zielordner darf nicht leer sein, wenn 'Ersetze Dateien' nicht gewählt wurde.";
+ }
+ private void btnDestFolder_Click(object sender, RoutedEventArgs e)
+ {
+ using (var folderBrowserDialog = new Forms.FolderBrowserDialog())
+ {
+ Forms.DialogResult result = folderBrowserDialog.ShowDialog();
+
+ if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(folderBrowserDialog.SelectedPath))
+ {
+ txtDestFolder.Text = folderBrowserDialog.SelectedPath;
+ }
+ }
+ }
+
+ private void DisplayCombinedFiles()
+ {
+ if (combinedFiles != null)
+ {
+ System.Windows.Application.Current.Dispatcher.Invoke(() =>
+ {
+ // Assuming lstSourceFiles and lstDestFiles are the names of your WPF ListBox controls
+ lstSourceFiles.ItemsSource = combinedFiles;
+ lstSourceFiles.Items.Refresh();
+ lstDestFiles.Items.Refresh(); // Refresh the ListBox to reflect changes
+ });
+ }
+ }
+ private void btnSourceFolder_Click(object sender, RoutedEventArgs e)
+ {
+ using (var folderBrowserDialog = new Forms.FolderBrowserDialog())
+ {
+ Forms.DialogResult result = folderBrowserDialog.ShowDialog();
+
+ if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(folderBrowserDialog.SelectedPath))
+ {
+ txtSourceFolder.Text = folderBrowserDialog.SelectedPath;
+ if (txtDestFolder.Text == "")
+ {
+ txtDestFolder.Text = folderBrowserDialog.SelectedPath;
+ }
+ }
+ }
+ }
+
+ private void cmbLang_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ switch (cmbLang.SelectedIndex)
+ {
+ case 0:
+ setLangEN();
+ break;
+ case 1:
+ setLangDE();
+ break;
+ }
+ }
+ private void chkReplace_Clicked(object sender, RoutedEventArgs e)
+ {
+ if (chkReplace.IsChecked == true)
+ {
+ lblDestFolder.IsEnabled = false;
+ txtDestFolder.IsEnabled = false;
+ btnDestFolder.IsEnabled = false;
+ doReplace = true;
+
+ }
+ else
+ {
+ lblDestFolder.IsEnabled = true;
+ txtDestFolder.IsEnabled = true;
+ btnDestFolder.IsEnabled = true;
+ doReplace= false;
+ }
+ }
+ private void chkSubfolders_Clicked(object sender, RoutedEventArgs e)
+ {
+ if (chkSubfolders.IsChecked == true)
+ {
+ doSubfolders = true;
+ }
+ else { doSubfolders = false; }
+
+ }
+ private void ExportConvertedFilesToFile(string filePath)
+ {
+ try
+ {
+ // Write the contents of the convertedFiles list to a text file
+ File.WriteAllLines(filePath, convertedFiles);
+
+ System.Windows.MessageBox.Show($"Export successful. File saved at: {filePath}");
+ }
+ catch (Exception ex)
+ {
+ System.Windows.MessageBox.Show($"Error exporting converted files: {ex.Message}");
+ }
+ }
+
+ private void btnExport_Click(object sender, RoutedEventArgs e)
+ {
+ // Use a SaveFileDialog to let the user choose the export file location
+ var saveFileDialog = new Microsoft.Win32.SaveFileDialog
+ {
+ Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*",
+ DefaultExt = "txt"
+ };
+
+ if (saveFileDialog.ShowDialog() == true)
+ {
+ // Call the ExportConvertedFilesToFile method with the selected file path
+ ExportConvertedFilesToFile(saveFileDialog.FileName);
+ }
+ }
+
+ private async void DeleteConvertedFilesAsync()
+ {
+ // Show a confirmation dialog
+ MessageBoxResult result = System.Windows.MessageBox.Show(
+ "Are you sure you want to delete the converted files?",
+ "Confirmation",
+ MessageBoxButton.YesNo,
+ MessageBoxImage.Question);
+
+ if (result == MessageBoxResult.Yes)
+ {
+ await Task.Run(() =>
+ {
+ try
+ {
+ foreach (var filePath in convertedFiles)
+ {
+ if (File.Exists(filePath))
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ System.Windows.MessageBox.Show("Deletion successful.");
+
+ // Clear the convertedFiles list
+ convertedFiles.Clear();
+
+ // Refresh the ListBox to reflect changes
+ DisplayCombinedFiles();
+ }
+ catch (Exception ex)
+ {
+ System.Windows.MessageBox.Show($"Error deleting converted files: {ex.Message}");
+ }
+ });
+ }
+ }
+
+
+ // Button click event
+ private void btnDelete_Click(object sender, RoutedEventArgs e)
+ {
+ // Call the DeleteConvertedFilesAsync method
+ DeleteConvertedFilesAsync();
+ }
+ private void UpdateButtonStates(bool isEnabled)
+ {
+ System.Windows.Application.Current.Dispatcher.Invoke(() =>
+ {
+ btnConvert.IsEnabled = isEnabled;
+ btnExport.IsEnabled = isEnabled;
+ btnDelete.IsEnabled = isEnabled;
+ });
+ }
+ }
+}
diff --git a/OfficeConverterCore/OfficeConverterCore.csproj b/OfficeConverterCore/OfficeConverterCore.csproj
new file mode 100644
index 0000000..87e799d
--- /dev/null
+++ b/OfficeConverterCore/OfficeConverterCore.csproj
@@ -0,0 +1,156 @@
+
+
+ net6.0-windows
+ WinExe
+ false
+ D:\OneDrive - wyniger\Design & Development\Code\Publish\DocConvert\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 5
+ 1.0.0.%2a
+ false
+ true
+ true
+ false
+ true
+ true
+ true
+
+
+ 43955F90264C43EAA4330714374C483BFDF3B6C5
+
+
+ OfficeConverter_TemporaryKey.pfx
+
+
+ true
+
+
+ true
+
+
+ bin\x64\Debug\
+
+
+ bin\x64\Release\
+
+
+ icons8-microsoft-office-480.ico
+
+
+ bin\Test\
+ true
+
+
+ bin\x64\Test\
+ true
+
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+
+
+
+
+
+ {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}
+ 2
+ 8
+ 0
+ primary
+ False
+ True
+
+
+ {00020813-0000-0000-C000-000000000046}
+ 1
+ 9
+ 0
+ primary
+ False
+ True
+
+
+ {91493440-5A91-11CF-8700-00AA0060263B}
+ 2
+ 12
+ 0
+ primary
+ False
+ True
+
+
+ {00020905-0000-0000-C000-000000000046}
+ 8
+ 7
+ 0
+ primary
+ False
+ True
+
+
+ {0002E157-0000-0000-C000-000000000046}
+ 5
+ 3
+ 0
+ primary
+ False
+ True
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4.8.1 %28x86 und x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OfficeConverterCore/Properties/Resources.Designer.cs b/OfficeConverterCore/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..3955383
--- /dev/null
+++ b/OfficeConverterCore/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// Dieser Code wurde von einem Tool generiert.
+// Laufzeitversion:4.0.30319.42000
+//
+// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
+// der Code erneut generiert wird.
+//
+//------------------------------------------------------------------------------
+
+namespace OfficeConverter.Properties {
+ using System;
+
+
+ ///
+ /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
+ ///
+ // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
+ // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
+ // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
+ // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OfficeConverter.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
+ /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/OfficeConverterCore/Properties/Resources.resx b/OfficeConverterCore/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/OfficeConverterCore/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/OfficeConverterCore/Properties/Settings.Designer.cs b/OfficeConverterCore/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..0c20323
--- /dev/null
+++ b/OfficeConverterCore/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// Dieser Code wurde von einem Tool generiert.
+// Laufzeitversion:4.0.30319.42000
+//
+// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
+// der Code erneut generiert wird.
+//
+//------------------------------------------------------------------------------
+
+namespace OfficeConverter.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/OfficeConverterCore/Properties/Settings.settings b/OfficeConverterCore/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/OfficeConverterCore/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OfficeConverterCore/Themes/MetroDark/HowToApplyTheme.txt b/OfficeConverterCore/Themes/MetroDark/HowToApplyTheme.txt
new file mode 100644
index 0000000..b8e9984
--- /dev/null
+++ b/OfficeConverterCore/Themes/MetroDark/HowToApplyTheme.txt
@@ -0,0 +1,10 @@
+To apply the Infragistics WPF MetroDark theme to your WPF application, paste the following code into your App.xaml
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OfficeConverterCore/Themes/MetroDark/MetroDark.MSControls.Core.Implicit.xaml b/OfficeConverterCore/Themes/MetroDark/MetroDark.MSControls.Core.Implicit.xaml
new file mode 100644
index 0000000..a049843
--- /dev/null
+++ b/OfficeConverterCore/Themes/MetroDark/MetroDark.MSControls.Core.Implicit.xaml
@@ -0,0 +1,964 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OfficeConverterCore/Themes/MetroDark/MetroDark.MSControls.Toolkit.Implicit.xaml b/OfficeConverterCore/Themes/MetroDark/MetroDark.MSControls.Toolkit.Implicit.xaml
new file mode 100644
index 0000000..378f869
--- /dev/null
+++ b/OfficeConverterCore/Themes/MetroDark/MetroDark.MSControls.Toolkit.Implicit.xaml
@@ -0,0 +1,934 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OfficeConverterCore/Themes/MetroDark/Styles.Shared.xaml b/OfficeConverterCore/Themes/MetroDark/Styles.Shared.xaml
new file mode 100644
index 0000000..76d150d
--- /dev/null
+++ b/OfficeConverterCore/Themes/MetroDark/Styles.Shared.xaml
@@ -0,0 +1,769 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OfficeConverterCore/Themes/MetroDark/Styles.WPF.xaml b/OfficeConverterCore/Themes/MetroDark/Styles.WPF.xaml
new file mode 100644
index 0000000..d473b00
--- /dev/null
+++ b/OfficeConverterCore/Themes/MetroDark/Styles.WPF.xaml
@@ -0,0 +1,827 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Visible
+
+
+
+
+
+
+
+
+
+
+ Visible
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Visible
+
+
+
+
+
+
+
+
+
+
+ Visible
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OfficeConverterCore/Themes/MetroDark/Theme.Colors.xaml b/OfficeConverterCore/Themes/MetroDark/Theme.Colors.xaml
new file mode 100644
index 0000000..a0840a9
--- /dev/null
+++ b/OfficeConverterCore/Themes/MetroDark/Theme.Colors.xaml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+ #FF282828
+ #FFFFFFFF
+ #FFBABABA
+ #FF858585
+ #FF747474
+ #FF565656
+ #FF454545
+ #FF333333
+ #FF292929
+ #FF181818
+
+
+ #E5FFFFFF
+
+ #BFFFFFFF
+
+ #99FFFFFF
+
+ #72FFFFFF
+
+ #4CFFFFFF
+
+ #26FFFFFF
+
+ #00FFFFFF
+
+
+
+ #E5000000
+
+ #BF000000
+
+ #99000000
+
+ #72000000
+
+ #4C000000
+
+ #26000000
+
+ #00000000
+
+ #66E2E2E2
+
+
+ #FF0086AF
+ #FF00AADE
+ #FF80D5EF
+ #FFB2E1EF
+ #2600AADE
+
+
+ #FFD0284C
+ #FFF55E7F
+ #FFFFCAD5
+
+
+ #FF006481
+ #FF8A9B0F
+ #FF3E4700
+ #FFF14D0F
+ #FF8D2E00
+ #FF81106B
+ #FF410135
+ #FFFCA910
+ #FF8D4902
+ #FF037A54
+ #FF003F2A
+ #FF154D85
+ #FF02284D
+ #FF543511
+ #FF211303
+ #FF89806D
+ #FF393225
+ #FF58458B
+ #FF211347
+ #7FB9B9B9
+ #33565656
+ #7F3F3F3F
+ #FF686868
+ #8000AADE
+ #CC3F3F3F
+
+
+
+ #FF0092BE
+ #FF00AADE
+ #FF2BB9E5
+ #FF55C8EB
+ #FF80D7F2
+
+
+
\ No newline at end of file
diff --git a/OfficeConverterCore/icons8-microsoft-office-480.ico b/OfficeConverterCore/icons8-microsoft-office-480.ico
new file mode 100644
index 0000000..02751a0
Binary files /dev/null and b/OfficeConverterCore/icons8-microsoft-office-480.ico differ