コード例 #1
0
        private Subsystem <Node> TryGetNode(DirectoryInfo info) => () =>
        {
            ConsoleW.Write(info.FullName + "\n", ConsoleColor.Yellow);

            var expr = from targetNode in WalkDirectoryTree(info)
                       let _3 = ConsoleW.PrintNode(targetNode, "", true)
                                select targetNode;

            return(expr());
        };
コード例 #2
0
        public Subsystem <Node> ShowUpgradePlan(Node sourceNode, string sourceDir, string targetDir) => () =>
        {
            foreach (var node in sourceNode.Enumerate().Tail())
            {
                MarkKUpgradePlanColor(node, sourceDir, targetDir);
            }

            ConsoleW.WriteLine(@"Please Check your upgrade plan", ConsoleColor.Black, ConsoleColor.White);
            ConsoleW.PrintNode(sourceNode, "", true);

            return(Out <Node> .FromValue(sourceNode));
        };
コード例 #3
0
        public Subsystem <Unit> SelectUpgradePlanDiff(Node sourceNode, string sourceDir, string targetDir) => () =>
        {
            var nodeList = (from node in sourceNode.Enumerate().Tail()
                            let colorNode = MarkKUpgradePlanColor(node, sourceDir, targetDir)
                                            select colorNode)
                           .ToList();

            var index = 0;

            Console.WriteLine("Press (Top/Donw/Enter/End) to select file and diff...");
            while (true)
            {
                ConsoleKeyInfo ckey = Console.ReadKey();
                Console.Clear();

                switch (ckey.Key)
                {
                case ConsoleKey.DownArrow:
                    index = index + 1 < nodeList.Count() ? index + 1 : 0;
                    break;

                case ConsoleKey.RightArrow:
                    index = index + 5 < nodeList.Count() ? index + 5 : index + 5 - nodeList.Count();
                    break;

                case ConsoleKey.UpArrow:
                    index = index - 1 >= 0 ? index - 1 : nodeList.Count() - 1;
                    break;

                case ConsoleKey.LeftArrow:
                    index = index - 5 >= 0 ? index - 5 : nodeList.Count() + index - 5;
                    break;

                case ConsoleKey.Enter:
                    Diff(nodeList[index], sourceDir, targetDir);
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case ConsoleKey.Escape:
                    return(Out <Unit> .FromValue(unit));
                }
                ConsoleW.PrintNode(sourceNode, "", true, nodeList[index]);
            }
        };