diff --git a/OF DL/Program.cs b/OF DL/Program.cs index da0fecf..112be18 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 { @@ -244,6 +246,8 @@ public class Program { Console.ReadKey(); } + + Log.CloseAndFlush(); Environment.Exit(3); } } @@ -373,7 +377,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(3); + + Log.CloseAndFlush(); + Environment.Exit(3); } } else @@ -482,7 +488,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(3); + + Log.CloseAndFlush(); + Environment.Exit(3); } @@ -566,7 +574,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(1); + + Log.CloseAndFlush(); + Environment.Exit(1); } else { @@ -663,7 +673,8 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); - Environment.Exit(2); + Log.CloseAndFlush(); + Environment.Exit(2); } @@ -679,6 +690,7 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); + Log.CloseAndFlush(); Environment.Exit(2); } } @@ -693,7 +705,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) @@ -708,6 +721,7 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); + Log.CloseAndFlush(); Environment.Exit(2); } } @@ -737,7 +751,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(2); + + Log.CloseAndFlush(); + Environment.Exit(2); } } @@ -880,7 +896,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"))) @@ -936,9 +954,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); @@ -979,6 +1000,7 @@ public class Program { Console.ReadKey(); } + Log.CloseAndFlush(); Environment.Exit(5); }