public override string ToString() { return(String.Format("C={0}, M={1}, Y={2}, K={3}", new string[] { Cyan.ToString(), Magenta.ToString(), Yellow.ToString(), Black.ToString(), })); }
private void Man(string[] args) { switch (args.Length) { case 1: if (args[0].ToLower().Equals("list")) { foreach (string key in Documentation.Keys) { WriteLineColor(key, Cyan); } return; } string topic = args[0]; if (Documentation.ContainsKey(topic)) { try { ManualObject obj = JsonConvert.DeserializeObject <ManualObject>(Documentation[topic]); Console.WriteLine("7Sharp Manual"); Console.WriteLine(); Console.WriteLine(obj.title); Console.WriteLine(); Console.WriteLine($"{new string('=', Console.WindowWidth)}\n"); foreach (ManualSection s in obj.sections) { Console.WriteLine(s.header); Console.WriteLine(); foreach (ManualTextComponent c in s.text) { if (c.color == null) { c.color = Gray.ToString(); } if (c.back == null) { c.back = Black.ToString(); } Console.BackgroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), c.back); Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), c.color); Console.Write(c.text); Console.ResetColor(); } Console.WriteLine($"\n{new string('-', Console.WindowWidth)}\n"); } } catch (Exception e) { Utils.PrintError(e); } } else { WriteLineColor("Topic not found!\nType man list for a list of topics!", Red); return; } break; default: WriteLineColor("Invalid syntax! man <topic>\nType man list for a list of topics!", Red); break; } }