Exemple #1
0
        public async Task ListAsync()
        {
            var items = await this.DataBaseContext.Dispatcher.InvokeAsync(() =>
            {
                var query = from item in this.DataBaseContext
                            where StringUtility.GlobMany(item.Name, FilterProperties.FilterExpression)
                            select new { item.IsLoaded, item.Name };
                return(query.ToArray());
            });

            var tb = new TerminalStringBuilder();

            foreach (var item in items)
            {
                if (item.IsLoaded == false)
                {
                    tb.Foreground = TerminalColor.BrightBlack;
                    tb.AppendLine(item.Name);
                    tb.Foreground = null;
                }
                else
                {
                    tb.AppendLine(item.Name);
                }
            }
            tb.AppendEnd();
            this.Out.WriteLine(tb.ToString());
        }
Exemple #2
0
        public static void Print(TextWriter writer, LogInfo[] logs)
        {
            var count = 0;

            var tb = new TerminalStringBuilder();

            tb.AppendLine();
            tb.AppendLine(string.Empty.PadRight(Console.BufferWidth - 1, '='));

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

                tb.Foreground = TerminalColor.Red;
                tb.AppendLine($"Revision: {item.Revision}");
                tb.Foreground = null;
                tb.AppendLine($"Author  : {item.UserID}");
                tb.AppendLine($"Date    : {item.DateTime}");
                if (IsQuiet == false)
                {
                    tb.AppendLine();
                    tb.AppendLine(item.Comment);
                }
                tb.AppendLine(string.Empty.PadRight(Console.BufferWidth - 1, '='));
                count++;
            }
            tb.AppendLine();

            writer.Write(tb.ToString());
        }