示例#1
0
        public void AppendRelativePathTest()
        {
            const string fullPath = @"H:\Onedrive_Decrypted\";
            const string toAppend = @"hello\file.txt";

            Assert.AreEqual(PathUtils.AppendRelativePath(fullPath, toAppend), @"H:\Onedrive_Decrypted\hello\file.txt");
        }
示例#2
0
        public void Sync(string decryptedFolderPath, string encryptedFolderPath)
        {
            var decryptedFolderChildren = PathUtils.GetAllChildrenRelative(decryptedFolderPath);
            var encryptedFolderChildren = PathUtils.GetAllChildrenRelative(encryptedFolderPath);

            var filesToProcess = new HashSet <string>(decryptedFolderChildren);

            // Eliminate the duplicates...
            filesToProcess.UnionWith(encryptedFolderChildren);

            Parallel.ForEach(filesToProcess, currentRelativePath =>
            {
                var decryptedFilePath = PathUtils.AppendRelativePath(decryptedFolderPath, currentRelativePath);
                var encryptedFilePath = PathUtils.AppendRelativePath(encryptedFolderPath, currentRelativePath);
                _fileWorker.ProcessFile(new CryptoFile(decryptedFilePath), new CryptoFile(encryptedFilePath));
            });
        }