Ejemplo n.º 1
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));
        };
Ejemplo n.º 2
0
        public Subsystem <Config> FetchConfig(string configPath)
        {
            Subsystem <Config> ParseConfig(FileInfo info) => () => {
                if (!info.Exists)
                {
                    ConsoleW.Write("Dangerous ", ConsoleColor.Red);
                    ConsoleW.WriteLine($"Config {info.FullName} is not existed.");
                    return(Out <Config> .FromValue(new Config()));
                }
                else
                {
                    var expr = from context in fs.ReadAllText(info.FullName)
                               let cfg = JsonConvert.DeserializeObject <Config>(context)
                                         select cfg;

                    return(expr());
                }
            };

            return(from info in fs.GetFileInfo(configPath)
                   from cfg  in ParseConfig(info)
                   select cfg);
        }