public static void Open() { Console.WriteLine("Type 'Open' or 'Отвори' to open the downloaded book! Or Press Enter To Continue . . ."); string openInput = Console.ReadLine().ToString(); if (openInput.ToLower() == "open" || openInput.ToLower() == "отвори") { if (!File.Exists($@"{ SpecialPaths.epubPath }\{CreateXML.input}.epub")) { Console.Clear(); Console.WriteLine("The file is not found!\nФайлът не е открит!"); Console.WriteLine("Press Any Key To Continue . . ."); Console.ReadKey(); Console.Clear(); Bootstrap.StartProgram(); } Process.Start($@"{ SpecialPaths.epubPath }\{CreateXML.input}.epub"); } else { Console.Clear(); Bootstrap.StartProgram(); } }
public static void StartProgram() { Console.InputEncoding = Encoding.GetEncoding(1251); Console.OutputEncoding = System.Text.Encoding.UTF8; // Lazy Exception Handling :( try { // Creating a directory to save the files CreateDirectory.Create(); // Downloading necessary files DownloadByID.Download(); // Ask the user to open the latest downloaded book or to continue! OpeningBook.Open(); } catch (Exception) { Console.Clear(); Console.WriteLine("Something went wrong maybe you typed a wrong name."); Console.WriteLine("Нещо се е объркало, може би сте написали погрешно име."); Console.WriteLine("Press Any Key To Continue!"); Console.ReadKey(); } finally { if (File.Exists($@"{ SpecialPaths.xmlPath }\{ CreateXML.input }.xml")) { File.Delete($@"{ SpecialPaths.xmlPath }\{ CreateXML.input }.xml"); } Console.Clear(); Bootstrap.StartProgram(); } }
// This is called in the CreateXML class! public static void Help() { // Chitanka Link https://chitanka.info/ Console.Clear(); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine(" Help/Помощ"); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine("Type the name of a book you want to download from https://chitanka.info/"); Console.WriteLine("Въведете името на книга, която искате да изтеглите от https://chitanka.info/"); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine($@"The files are located at: { SpecialPaths.documentsAppFoldier }"); Console.WriteLine($@"Файловете се намират в: { SpecialPaths.documentsAppFoldier }"); Console.WriteLine("----------------------------------------------------------------------------"); Console.WriteLine("Press Any Key To Continue . . ."); Console.ReadKey(); Console.Clear(); Bootstrap.StartProgram(); }
static void Main(string[] args) { Console.OutputEncoding = System.Text.Encoding.UTF8; Bootstrap.StartProgram(); }