From a467e6f8b73189c3009798d4a10e0d74bcb736f4 Mon Sep 17 00:00:00 2001 From: Casper Sparre Date: Wed, 22 Oct 2025 00:52:58 +0200 Subject: [PATCH] Added "Log.CloseAndFlush" call before every Environment.Exit --- OF DL/Program.cs | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/OF DL/Program.cs b/OF DL/Program.cs index 7c428e9..55e5912 100644 --- a/OF DL/Program.cs +++ b/OF DL/Program.cs @@ -83,7 +83,8 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Log.Error(e, "auth invalid after attempt to get auth from browser"); - Environment.Exit(2); + Log.CloseAndFlush(); + Environment.Exit(2); } if (auth == null) @@ -95,7 +96,8 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Log.Error("auth invalid after attempt to get auth from browser"); - Environment.Exit(2); + Log.CloseAndFlush(); + Environment.Exit(2); } else { @@ -250,6 +252,8 @@ public class Program { Console.ReadKey(); } + + Log.CloseAndFlush(); Environment.Exit(3); } } @@ -379,7 +383,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(3); + + Log.CloseAndFlush(); + Environment.Exit(3); } } else @@ -490,7 +496,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(3); + + Log.CloseAndFlush(); + Environment.Exit(3); } @@ -574,7 +582,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(1); + + Log.CloseAndFlush(); + Environment.Exit(1); } else { @@ -671,7 +681,8 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); - Environment.Exit(2); + Log.CloseAndFlush(); + Environment.Exit(2); } @@ -687,6 +698,7 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); + Log.CloseAndFlush(); Environment.Exit(2); } } @@ -701,7 +713,8 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); - Environment.Exit(2); + Log.CloseAndFlush(); + Environment.Exit(2); } if (!config!.DisableBrowserAuth) @@ -716,6 +729,7 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); + Log.CloseAndFlush(); Environment.Exit(2); } } @@ -745,7 +759,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(2); + + Log.CloseAndFlush(); + Environment.Exit(2); } } @@ -888,7 +904,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(4); + + Log.CloseAndFlush(); + Environment.Exit(4); } if (!File.Exists(Path.Join(WidevineClient.Widevine.Constants.DEVICES_FOLDER, WidevineClient.Widevine.Constants.DEVICE_NAME, "device_client_id_blob"))) @@ -944,9 +962,12 @@ public class Program { AnsiConsole.MarkupLine($"\n[red]Auth failed. Please try again or use other authentication methods detailed here:[/]\n"); AnsiConsole.MarkupLine($"[link]https://docs.ofdl.tools/config/auth[/]\n"); - Console.ReadKey(); + + Console.ReadKey(); + + Log.CloseAndFlush(); Environment.Exit(2); - } + } } Log.Information("Logged In successfully as {Name:l} ({Username:l})", validate.name, validate.username); @@ -987,6 +1008,7 @@ public class Program { Console.ReadKey(); } + Log.CloseAndFlush(); Environment.Exit(5); }