static void Main(string[] args) { IGui gui = new ConsoleGui(); #region Caricamento dipendenze LoadMathCalculator(); #endregion gui.Write("Messaggio scritto."); var value = gui.ReadInt("Immettere un numero intero."); gui.Write(value.ToString()); }
public static void draw() { //Draw Command Window ConsoleGui.WriteLine("|| - Commands"); ConsoleGui.Write("|| "); ConsoleGui.Write("|{0}Clear | ", clearSelected ? " *" : " "); ConsoleGui.Write("|{0}Exit |", exitSelected ? " *" : " "); ConsoleGui.WriteLine(); ConsoleGui.Write("|{0}Enter |", enterSelected ? " *" : " "); ConsoleGui.Write("|{0}", inputString); ConsoleGui.WriteLine("\n|| ---------"); //Draw Message Window ConsoleGui.WriteLine("------------"); ConsoleGui.WriteLine("|| - Messages"); if (messages.Count > MSG_COUNT) { //display last MSG_COUNT number of messages for (int i = messages.Count - 1; i >= messages.Count - MSG_COUNT; i--) { ConsoleGui.WriteLine("{0} - {1}", i, messages[i]); } } else { //display messages for (int i = messages.Count - 1; i >= 0; i--) { ConsoleGui.WriteLine("{0} - {1}", i, messages[i]); } } ConsoleGui.WriteLine("|| ---------"); }
static void Main(string[] args) { IGui gui = new ConsoleGui(); //IMath mathCalculator = LoadMathCalculatorRigid(); IMath mathCalculator = LoadMathCalculatorDecoupled(); var value = gui.ReadInt("Give me an integer: "); bool isPrime = mathCalculator.IsPrime(value); gui.Write($"The number {value} is {(isPrime ? "" : "not ")}prime."); Console.Read(); }
static void Main(string[] args) { ConsoleGui.WriteGui(); var apexProduct = ApexProduct.Unknown; var apexPath = string.Empty; ConsoleGui.WriteLine("1. ApexSQL Log"); ConsoleGui.WriteLine("2. ApexSQL Recover"); ConsoleGui.WriteLine(); ConsoleGui.Write("请输入产品序号:"); var keyInfo = Console.ReadKey(); ConsoleGui.WriteLine(); ConsoleGui.Write("请输入产品路径:"); switch (keyInfo.KeyChar) { case '1': { apexProduct = ApexProduct.ApexLog; apexPath = Console.ReadLine(); } break; case '2': { apexProduct = ApexProduct.ApexRecover; apexPath = Console.ReadLine(); } break; } ConsoleGui.WriteLine(); if (apexProduct != ApexProduct.Unknown) { try { var dirInfo = new DirectoryInfo(apexPath); if (dirInfo.Exists) { if (apexProduct == ApexProduct.ApexLog || apexProduct == ApexProduct.ApexRecover) { var files = dirInfo.GetFiles("ApexSQL.Engine.Communication.dll", SearchOption.TopDirectoryOnly); if (files != null && files.Any()) { var filePath = files.First().FullName; var filePathBak = $"{filePath}.bak"; if (File.Exists(filePathBak)) { File.Delete(filePathBak); } files.First().MoveTo($"{filePath}.bak"); ReleasePatchFile(filePath); ConsoleGui.Write("成功"); } } } } catch { return; } } Console.ReadKey(); }
public static void Write(string format, params object[] args) { ConsoleGui.Write(String.Format(format, args)); }