static void Main(string[] args) { Intro(); Console.Title = "Lynda Courses Downloader"; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; var config = new Config(); if (File.Exists("./Config.json")) { Console.WriteLine(TUI.startGlyph + "Found a Config file"); try { config = Config.FromJson(File.ReadAllText("./Config.json")); Console.WriteLine(TUI.continueGlyph + "Data in config file : "); Console.WriteLine(TUI.continueGlyph + "Browser : " + config.Browser); Console.WriteLine(TUI.continueGlyph + "Quality to download in : " + config.Quality); Console.WriteLine(TUI.continueGlyph + "Course Directory/Path : " + config.CourseDirectory); Console.WriteLine(TUI.continueGlyph + "Authentication Token : " + config.AuthenticationToken); if (TUI.UseConfig()) { RunWithConfig(config); } else { Console.WriteLine(TUI.continueGlyph + "The data you enter will be saved in a new Config file"); RunWithoutConfig(); } } catch (JsonSerializationException) { TUI.ShowError("Config file is corrupt"); Console.WriteLine(TUI.continueGlyph + "The data you enter will be saved in a new Config file"); RunWithoutConfig(); } } else { Console.WriteLine(TUI.startGlyph + "Config File not found"); Console.WriteLine(TUI.continueGlyph + "The data you enter will be saved in a new Config file"); RunWithoutConfig(); } Console.WriteLine(); Console.ReadLine(); }
private static void RunApp() { if (File.Exists("./Config.json")) { Console.WriteLine(TUI.startGlyph + "Found a Config file"); try { Config config = Config.FromJson(File.ReadAllText("./Config.json")); Console.WriteLine(TUI.continueGlyph + "Data in config file : "); Console.WriteLine(TUI.continueGlyph + "Browser : " + config.Browser); Console.WriteLine(TUI.continueGlyph + "Quality to download in : " + config.Quality); Console.WriteLine(TUI.continueGlyph + "Course Directory/Path : " + config.CourseDirectory); Console.WriteLine(TUI.continueGlyph + "Authentication Token : " + config.AuthenticationToken); if (TUI.UseConfig()) { RunWithConfig(config); } else { Console.WriteLine(TUI.continueGlyph + "The data you enter will be saved in a new Config file"); RunWithoutConfig(); } } catch (JsonSerializationException) { TUI.ShowError("Config file is corrupt"); Console.WriteLine(TUI.continueGlyph + "The data you enter will be saved in a new Config file"); RunWithoutConfig(); } } else { Console.WriteLine(TUI.startGlyph + "Config File not found"); Console.WriteLine(TUI.continueGlyph + "The data you enter will be saved in a new Config file"); RunWithoutConfig(); } }