Example #1
0
        public static void Print(TextWriter writer, LogInfo[] logs)
        {
            var count = 0;

            writer.WriteLine();
            writer.WriteLine(string.Empty.PadRight(Console.BufferWidth - 1, '='));

            foreach (var item in logs)
            {
                if (LogProperties.Limit >= 0 && LogProperties.Limit <= count)
                {
                    break;
                }

                using (TerminalColor.SetForeground(ConsoleColor.Cyan))
                {
                    writer.WriteLine($"Revision: {item.Revision}");
                }
                writer.WriteLine($"Author  : {item.UserID}");
                writer.WriteLine($"Date    : {item.DateTime}");
                if (IsQuiet == false)
                {
                    writer.WriteLine();
                    writer.WriteLine(item.Comment);
                }
                writer.WriteLine(string.Empty.PadRight(Console.BufferWidth - 1, '='));
                count++;
            }
            writer.WriteLine();
        }
Example #2
0
 public void Print(Action action)
 {
     if (this.isCategory == true)
     {
         using (TerminalColor.SetForeground(ConsoleColor.Cyan))
         {
             action();
         }
     }
     else
     {
         action();
     }
 }
Example #3
0
 public void Print(Action action)
 {
     if (this.isLoaded == false)
     {
         using (TerminalColor.SetForeground(ConsoleColor.DarkGray))
         {
             action();
         }
     }
     else
     {
         action();
     }
 }
Example #4
0
 protected override void OnDrawPrompt(TextWriter writer, string prompt)
 {
     if (this.IsCommandMode == false)
     {
         base.OnDrawPrompt(writer, prompt);
     }
     else
     {
         if (prompt == string.Empty)
         {
             return;
         }
         var postfixPattern = string.Join(string.Empty, this.Postfix.Select(item => $"[{item}]"));
         if (this.commandContext.IsOnline == false)
         {
             var match = Regex.Match(prompt, $"(.+)(?<postfix>{postfixPattern})$");
             using (TerminalColor.SetForeground(ConsoleColor.Green))
             {
                 writer.Write(match.Groups[1].Value);
             }
             Console.ResetColor();
             writer.Write(match.Groups[2].Value);
         }
         else
         {
             var uri = new Uri(prompt);
             //var match = Regex.Match(prompt, $"(.+)([:])({PathUtility.Separator}.*)({postfixPattern})$");
             using (TerminalColor.SetForeground(ConsoleColor.Green))
             {
                 writer.Write(uri.Scheme);
             }
             writer.Write(Uri.SchemeDelimiter);
             using (TerminalColor.SetForeground(ConsoleColor.Cyan))
             {
                 writer.Write(uri.UserInfo);
             }
             writer.Write("@");
             using (TerminalColor.SetForeground(ConsoleColor.Cyan))
             {
                 writer.Write(uri.Host);
             }
             Console.ResetColor();
             writer.Write(uri.LocalPath);
         }
     }
 }
Example #5
0
 private void PrintItem(UserMetaData item, Action action)
 {
     if (item.BanInfo.Path != string.Empty)
     {
         using (TerminalColor.SetForeground(ConsoleColor.Red))
         {
             action();
         }
     }
     else if (item.UserState != UserState.Online)
     {
         //using (TerminalColor.SetForeground(ConsoleColor.Gray))
         {
             action();
         }
     }
     else
     {
         using (TerminalColor.SetForeground(ConsoleColor.Blue))
         {
             action();
         }
     }
 }