gooed decoder
a821693b03ba8dade5bbdba3032cbccf6475c7f1
2 files changed
Eml2PdfWinApp/Form1.csEmlFastDecoder/Program.cs
diff --git a/Eml2PdfWinApp/Form1.cs b/Eml2PdfWinApp/Form1.cs
index 72f57a1..f2a768e 100644
--- a/Eml2PdfWinApp/Form1.cs
+++ b/Eml2PdfWinApp/Form1.cs
@@ -75,6 +75,30 @@ public partial class Form1 : Form
}
}
+ static async Task SaveHtmlMailBodyAsync(TextBox log, string OutputDir, MimePart part)
+ {
+
+ if (DateTime.TryParse(part["Date"], out DateTime dtm))
+ {
+ var outputPath = Path.Combine(OutputDir, $"{dtm:yyyyMMdd-HHmmss}.eml");
+
+ try
+ {
+ await part.SaveAsync(outputPath, dtm);
+ }
+ catch (Exception ex)
+ {
+ log.Invoke((MethodInvoker)delegate
+ {
+ log.Text = $"{outputPath} {ex.Message}";
+ });
+ }
+ }
+ }
+
+
+
+
private async void Button2_Click(object sender, EventArgs e)
{
@@ -86,6 +110,7 @@ public partial class Form1 : Form
{
var email = await MimePart.ReadEmlAsync(emlPath);
+ //await SaveHtmlMailBodyAsync(this.txtLog, this.txtOutput.Text, email);
await SaveMailAttachementsAsync(this.txtLog, this.txtOutput.Text, email);
}
@@ -138,7 +163,7 @@ public partial class Form1 : Form
File.SetCreationTime(output, dtm);
}
- catch(Exception eee)
+ catch (Exception eee)
{
this.txtLog.Invoke((MethodInvoker)delegate
{
diff --git a/EmlFastDecoder/Program.cs b/EmlFastDecoder/Program.cs
index 589698d..027e2ba 100644
--- a/EmlFastDecoder/Program.cs
+++ b/EmlFastDecoder/Program.cs
@@ -25,7 +25,7 @@ static async Task ShowPartsAsync(int Depth, MimePart part)
}
- if(contentType.StartsWith("text/html"))
+ if (contentType.StartsWith("text/html"))
{
//await File.WriteAllTextAsync("a.html", part.TextContent, Encoding.GetEncoding( part.CharSet));
}
@@ -44,12 +44,14 @@ static async Task ShowPartsAsync(int Depth, MimePart part)
var sw = Stopwatch.StartNew();
-//var email = await FastHelper.ReadEmlAsync(@"input\20240603-135130.eml");
-var email = await MimePart.ReadEmlAsync(@"input\jun-jul 2024.eml");
+foreach (var path in Directory.EnumerateFiles(@"C:\Users\alphons\Downloads\Rentes2", "*.eml"))
+{
-await ShowPartsAsync(0, email);
+ var email = await MimePart.ReadEmlAsync(@"input\jun-jul 2024.eml");
-Debug.WriteLine(sw.ElapsedMilliseconds + "mS");
+ await ShowPartsAsync(0, email);
+ Debug.WriteLine(sw.ElapsedMilliseconds + "mS");
+}
Console.Write("enter");
Console.ReadLine();