コード例 #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 <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);
        }