コード例 #1
0
        public void CheckFolderExistOrCreate_New_Folder()
        {
            string path = $@"{fs.GetTmpPath()}\\{new Random().Next(0, 2000)}";
            var    expr = mainValidation.CheckFolderExistOrCreate(path);

            expr();

            Assert.IsTrue(Directory.Exists(path));
            Directory.Delete(path, true);
        }
コード例 #2
0
 public Subsystem <Unit> Upgrade(string source, string target) =>
 from info       in mainValidation.ValidateSource(source)
 from upzipPath  in CopyToTempPath(info)
 from _1         in Subsystem.WriteLine($"Unzip to {upzipPath}")
 from targetDic  in mainValidation.CheckFolderExistOrCreate(target)
 from _2         in Subsystem.WriteLine($"Target Directory {targetDic.FullName} is existed.")
 from targetNode in WalkDirectoryTree(targetDic)
 from cfg        in FetchConfig(Path.Combine(target, @"UpgradeSetting.json"))
 let upzipDic = new DirectoryInfo(upzipPath)
                from _3         in DeleteIgnoreList(upzipPath, cfg.IgnoreList)
                from sourceNode in WalkDirectoryTree(upzipDic)
                from renameNode in FullRename(upzipPath, cfg)
                from _4         in ReplaceFileContent(renameNode, cfg.ReplaceList)
                from planedNode in ShowUpgradePlan(renameNode, upzipPath, target)
                from _5         in SelectUpgradePlanDiff(renameNode, upzipPath, target)
                from _6         in ShowUpgradePlan(renameNode, upzipPath, target)
                from _7         in CheckYorN("Continue to upgrade? (y/N)")
                from _8         in CopyDirectory(upzipPath, target)
                select unit;