public void Run() { var cc = new ConsoleCompanion(2); cc.WriteLineRed(@" /\ /\ "); cc.WriteLineRed(@" ( \\ // ) "); cc.WriteLineRed(@" \ \\ // / "); cc.WriteLineRed(@" \_\\||||//_/ "); cc.WriteLineRed(@" \/ _ _ \ "); cc.WriteLineRed(@" \/|(O)(O)| "); cc.WriteLineRed(@" \/ | | "); cc.WriteLineRed(@" ___________________\/ \ / "); cc.WriteLineRed(@" // // |____| "); cc.WriteLineRed(@" // || / \ "); cc.WriteLineRed(@" //| \| \ 0 0 / "); cc.WriteLineRed(@" // \ ) V / \____/ "); cc.WriteLineRed(@" // \ / ( / "); cc.WriteLineRed(@" "" \ /_________| |_/ "); cc.WriteLineRed(@" / /\ / | || "); cc.WriteLineRed(@" / / / / \ || "); cc.WriteLineRed(@" | | | | | || "); cc.WriteLineRed(@" | | | | | || "); cc.WriteLineRed(@" |_| |_| |_|| "); cc.WriteLineRed(@" \_\ \_\ \_\\ "); cc.Space(); cc.WriteLine("Press 'y' to go to main menu"); cc.AskForKey(new char[] { 'y', 'Y' }); NextPage = new MainMenuPage(); }
public void Run() { var cc = new ConsoleCompanion(2); cc.WriteLineCyan(@" =*=== "); cc.WriteLineCyan(@" $$- - $$$ "); cc.WriteLineCyan(@" $ < D$$ "); cc.WriteLineCyan(@" $ - $$$ "); cc.WriteLineCyan(@" , $$$$ | "); cc.WriteLineCyan(@"///; ,---' _ |----. "); cc.WriteLineCyan(@" \ )( / ) "); cc.WriteLineCyan(@" | \/ \. ' _.| \ $ "); cc.WriteLineCyan(@" | \ /( / /\_ \ $$$$$ "); cc.WriteLineCyan(@" \ / ( / / ) $$$ $$$ "); cc.WriteLineCyan(@" ( , /_/ ,`_,-----.,$$ $$$ "); cc.WriteLineCyan(@" | <----| \---## \ $$ "); cc.WriteLineCyan(@" / \\\ | $ "); cc.WriteLineCyan(@" ' ' | "); cc.WriteLineCyan(@" | \ / "); cc.WriteLineCyan(@" / \_| /______,/ / "); cc.WriteLineCyan(@" / / | / | | / "); cc.WriteLineCyan(@" ( /--| /. \ (\ (_ "); cc.WriteLineCyan(@" `----,( ( _\ \ / / ,/ "); cc.WriteLineCyan(@" | / /,_/,/ "); cc.WriteLineCyan(@" _|/ / / ( "); cc.WriteLineCyan(@" / ( ^-/, | "); cc.WriteLine("Press 'y' to go to main menu"); cc.AskForKey(new char[] { 'y', 'Y' }); NextPage = new MainMenuPage(); }
private void DisplayMenu(INavigationPage navigationPage) { // todo: able to change how menu is displayed foreach (var menuOption in navigationPage.PageMenu.MenuOptions) { cc.WriteLine($"{menuOption.Key}) {menuOption.Description}"); } cc.Space(); }
public void Run() { var cc = new ConsoleCompanion(2); while (true) { double num1 = cc.AskForNumber("Number 1: "); double num2 = cc.AskForNumber("Number 2: "); cc.Space(); cc.Write($"Product of the number is "); cc.WriteLineCyan(num1 * num2); cc.Space(); cc.WriteLine("(A)gain of go back to (C)alculator?"); char answer = cc.AskForKey(new[] { 'a', 'c', 'A', 'C' }); if (answer.ToString().ToUpper() == "C") { break; } cc.Space(); } NextPage = new CalculatorPage(); }
public void Run() { // todo: get "cc" from a central place (using DI?) var cc = new ConsoleCompanion(2); while (true) { double num1 = cc.AskForNumber("Number 1: "); double num2 = cc.AskForNumber("Number 2: "); cc.Space(); cc.Write($"Sum of the number is "); cc.WriteCyan(num1 + num2 + "\n"); cc.Space(); cc.WriteLine("(A)gain of go back to (C)alculator?"); char answer = cc.AskForKey(new[] { 'a', 'c', 'A', 'C' }); if (answer.ToString().ToUpper() == "C") { break; } cc.Space(); } NextPage = new CalculatorPage(); }
public void Run() { var cc = new ConsoleCompanion(2); cc.WriteLine("Thanks for using the app"); }
static void Main(params string[] args) { // todo: namnbyte. Murphy. Morphy. Twins // todo: generell refactor, se över FileInfo, BadCopyConfig etc // todo: kan allt vara en transformation? // todo: skapa klasser för filtering (t.ex inte ha med filer som börjar med "Skip") // todo: se över json-filerna, hur använder jag dem. går det att förenkla? (ex med mappar) // todo: validering av badconfig.json (ex att FromFolders finns) // todo: koppla ihop FromFolder och ToFolder så det blir en variabel. Ett par. // todo: transfomation: [TestMethod] kan vara på andra platser än närmast signaturen // todo: transfomation: klipp på ett smartare sätt så det t.ex går att deklarera saker innan metoder som ska testas // todo: felhantering. skicka mycket exception och kedja ihop dem. visa felmeddelanden och undermeddelanden. // todo: refactor denna supermetod // todo: Microsoft Code Analysis 2019 //try //{ SetWindowSize(); var bcs = new BadCopyService(); CommandArguments commandargs = new CommandArguments(args); BadCopyConfigFile configFile = ReadBadCopyConfigurationFile(commandargs.ConfigFileName); BadCopyConfig config = configFile.MergeConfiguration(); cc.Space(); var batchesToRun = commandargs.OnlyLastBatches == null ? config.Batches : config.Batches.TakeLast((int)commandargs.OnlyLastBatches); foreach (var batch in batchesToRun) { switch (batch.Action) { case Core.Action.DeleteFolder: var countDeletedFolders = bcs.DeleteFolder(batch.FolderToDelete); cc.WriteLineGreen($"Deleted {countDeletedFolders} folders in destination folder."); cc.Space(); break; case Core.Action.Copy: case Core.Action.Transform: var files = bcs.GetFilesToCopy(batch); var result = bcs.Copy(files); if (result.AllSucceded) { var noSolution = result.CopyResultFiles.Where(x => x.State == BadCopyService.CopyResultFileState.SuccessNoSolution); var clonedFiles = result.CopyResultFiles.Where(x => x.State == BadCopyService.CopyResultFileState.SuccessClone); if (noSolution.Count() + clonedFiles.Count() == 0) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"Batch '{batch.Name}' finished but nothing copied."); Console.ForegroundColor = ConsoleColor.White; continue; } cc.WriteLineGreen($"Batch '{batch.Name}' succeeded."); if (noSolution.Any()) { cc.WriteLineGreen($"\n\tWithout solution:\n"); foreach (var file in noSolution) { cc.WriteLineGreen($"\t\t{file.FileInfo.ToFile}"); } } if (clonedFiles.Any()) { cc.WriteLineGreen($"\n\tCloned:\n"); foreach (var file in clonedFiles) { cc.WriteLineGreen($"\t\t{file.FileInfo.ToFile}"); } } cc.Space(); } else { cc.WriteLineRed($"Batch '{batch.Name}' failed. "); // todo: refactor, förkorta var failedReads = result.CopyResultFiles.Where(x => x.State == BadCopyService.CopyResultFileState.FailedRead).ToArray(); var failedWrites = result.CopyResultFiles.Where(x => x.State == BadCopyService.CopyResultFileState.FailedWrite).ToArray(); var unknownCopyStyle = result.CopyResultFiles.Where(x => x.State == BadCopyService.CopyResultFileState.UnknownCopyStyle).ToArray(); var incompleted = result.CopyResultFiles.Where(x => x.State == BadCopyService.CopyResultFileState.Incomplete).ToArray(); if (failedReads.Any()) { cc.WriteLineRed($"\n\tFailed to read:\n"); foreach (var file in failedReads) { cc.WriteLineRed($"\t\t{file.FileInfo.FromFile}"); } } if (failedWrites.Any()) { cc.WriteLineRed($"\n\tFailed to write:\n"); foreach (var file in failedWrites) { cc.WriteLineRed($"\t\t{file.FileInfo.ToFile}"); } } if (unknownCopyStyle.Any()) { cc.WriteLineRed($"\n\tUnknown copy style:\n"); foreach (var file in unknownCopyStyle) { cc.WriteLineRed($"\t\t{file.FileInfo.FromFile}"); } } if (incompleted.Any()) { cc.WriteLineRed($"\n\tIncompleted:\n"); foreach (var file in incompleted) { cc.WriteLineRed($"\t\t{file.FileInfo.FromFile}"); } } cc.Space(); } break; default: throw new Exception("Unknown action"); } } //} //catch (Exception ex) //{ // throw ex; // cc.WriteLineRed(ex.Message); // return; //} // todo: fixa i ConsoleCompanion så att förra färgen automatiskt kommer tillbaka efter t.ex WriteLineRed (då behövs inte denna raden) cc.WriteLine(""); }