diff --git a/OF DL/Program.cs b/OF DL/Program.cs index 9fbac16..354ea6d 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 { @@ -649,7 +659,8 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); - Environment.Exit(2); + Log.CloseAndFlush(); + Environment.Exit(2); } @@ -665,6 +676,7 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); + Log.CloseAndFlush(); Environment.Exit(2); } } @@ -679,7 +691,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) @@ -694,6 +707,7 @@ public class Program AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); Console.ReadKey(); + Log.CloseAndFlush(); Environment.Exit(2); } } @@ -723,7 +737,9 @@ public class Program { Console.ReadKey(); } - Environment.Exit(2); + + Log.CloseAndFlush(); + Environment.Exit(2); } } @@ -811,7 +827,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"))) @@ -867,9 +885,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); @@ -910,6 +931,7 @@ public class Program { Console.ReadKey(); } + Log.CloseAndFlush(); Environment.Exit(5); }