public static void infosMessage(string message, bool clear = false) { if (clear) { Display.Clear(); } Display.foreground(ConsoleColor.White); Console.WriteLine(message); Display.newLines(2); }
public static string readLine(string text) { Display.foreground(ConsoleColor.White); Console.WriteLine(text ?? ""); Display.newLines(1); Console.Write("> "); string str = Console.ReadLine(); Display.newLines(2); return(str); }
public static void successMessage(string message, bool clear = false) { Const.mylogs.addLog(message); if (clear) { Display.Clear(); } Display.foreground(ConsoleColor.Green); Console.WriteLine("> " + message); Display.newLines(2); }
public static void errorMessage(string errorMessage, bool exit = false) { Const.mylogs.addLog(errorMessage); Display.Clear(); Display.foreground(ConsoleColor.Red); Console.WriteLine(errorMessage); Display.newLines(2); Console.WriteLine("L'application va se fermer dans quelques secondes..."); Thread.Sleep(5000); Environment.Exit(0); Display.Clear(); }
public bool convert(string SourceDb) { bool flag = false; string path = this.getdestFile(SourceDb); try { if (File.Exists(path)) { File.Delete(path); } object[] args = new object[2] { (object)SourceDb, (object)path }; Display.infosMessage("Conversion de la base de données en cours...", true); object instance = Activator.CreateInstance(Type.GetTypeFromProgID(Const.DRIVER_NAME)); instance.GetType().InvokeMember(Const.COMPACT_DATABASE, BindingFlags.InvokeMethod, (Binder)null, instance, args); Marshal.ReleaseComObject(instance); Display.successMessage("La base a été correctement convertie ! ", true); Display.foreground(ConsoleColor.White); Console.WriteLine("BASE SOURCE : " + Environment.NewLine); Console.WriteLine(SourceDb ?? ""); Display.newLines(1); Console.WriteLine("BASE CONVERTIE : " + Environment.NewLine); Console.WriteLine(path ?? ""); Thread.Sleep(5000); Environment.Exit(0); } catch (Exception ex) { Display.errorMessage("Une erreur s'est produite lors de la conversion : " + ex.Message, true); } return(flag); }
public static void Title() { Display.foreground(ConsoleColor.Yellow); Console.WriteLine("\r\n================================================================================\r\n __ __ _____ ____ _ _____ _____ _____ ____ \r\n | \\/ | __ \\| _ \\ | | /\\ / ____/ ____| __ \\| _ \\ \r\n | \\ / | | | | |_) | | |_ ___ / \\ | | | | | | | | |_) |\r\n | |\\/| | | | | _ < | __/ _ \\ / /\\ \\| | | | | | | | _ < \r\n | | | | |__| | |_) | | || (_) | / ____ \\ |___| |____| |__| | |_) |\r\n |_| |_|_____/|____/ \\__\\___/ /_/ \\_\\_____\\_____|_____/|____/ \r\n \r\n================================================================================\r\n "); }