feat(FinalizeDocument): aus CommonJobs kopiert, mit einfachen Fehlerbehebungen unter Verwendung von Copilot

- Programmiersprache von VSC zu C# geändert
 - Framework von .NET Framework zu .NET geändert
This commit is contained in:
2026-02-23 17:12:25 +01:00
parent 41cca7fa64
commit c93c32307a
21 changed files with 1538 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
using System.IO;
using DigitalData.Modules.Base;
using DigitalData.Modules.Logging;
namespace EnvelopeGenerator.ServiceHost.Jobs;
public class TempFiles : BaseClass
{
public string TempPath { get; }
public TempFiles(LogConfig logConfig) : base(logConfig)
{
var tempDirectoryPath = Path.GetTempPath();
TempPath = Path.Combine(tempDirectoryPath, "EnvelopeGenerator");
}
public bool Create()
{
try
{
if (!Directory.Exists(TempPath))
{
Directory.CreateDirectory(TempPath);
}
else
{
CleanUpFiles();
}
return true;
}
catch (Exception ex)
{
Logger.Error(ex);
return false;
}
}
private bool CleanUpFiles()
{
try
{
foreach (var fileItem in Directory.GetFiles(TempPath))
{
Logger.Debug("Deleting tempPath-file: {0} ...", fileItem);
File.Delete(fileItem);
}
return true;
}
catch (Exception ex)
{
Logger.Error(ex);
return false;
}
}
public bool CleanUp()
{
try
{
Logger.Debug("Deleting tempPath-Data: {0} ...", TempPath);
Directory.Delete(TempPath, true);
return true;
}
catch (Exception ex)
{
Logger.Error(ex);
return false;
}
}
}