예제 #1
0
        private static List <DecoratedTextLine> GetColDiffLines(TableTuple table_tup, List <DecoratedTextLine> lines = null)
        {
            if (lines is null)
            {
                lines = new List <DecoratedTextLine>();
            }

            var added_cols   = new SortedSet <string>();
            var removed_cols = new SortedSet <string>();

            foreach (var diff_col_tup in table_tup.UnmatchedCols)
            {
                if (diff_col_tup.Names[1] is null)
                {
                    removed_cols.Add(diff_col_tup.Names[0]);
                }
                else
                {
                    added_cols.Add(diff_col_tup.Names[1]);
                }
            }

            foreach (var tup in new Tuple <SortedSet <string>, bool>[] {
                new Tuple <SortedSet <string>, bool>(added_cols, true),
                new Tuple <SortedSet <string>, bool>(removed_cols, false)
            })
            {
                var set      = tup.Item1;
                var b_is_add = tup.Item2;
                if (set.Count > 0)
                {
                    foreach (var col_name in set)
                    {
                        string prefix;
                        string color;
                        if (b_is_add)
                        {
                            prefix = "+   ";
                            color  = "green";
                        }
                        else
                        {
                            prefix = "-   ";
                            color  = "red";
                        }
                        lines.Add(new DecoratedTextLine(new DecoratedTextBlock($"{prefix}{col_name}").WithDecoration("color", color)));
                    }
                }
            }

            return(lines);
        }
예제 #2
0
 public ColumnTuple(TableTuple parent, string orig_name, string dest_name)
 {
     OrigName   = orig_name;
     DestName   = dest_name;
     TableTuple = parent;
 }