private void BrowseForFolder()
 {
     using (var fbd = new FolderBrowserDialog())
     {
         DialogResult result = fbd.ShowDialog();
         if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
         {
             LocalFolderPath = fbd.SelectedPath;
             ClientAge       = DirUtils.GetLatestFileWriteTimeInDir(mapping.ClientSidePath);
         }
     }
 }
Exemple #2
0
        private ObservableCollection <MappingViewModel> CreateMappingVms(List <FolderMapping> mappings)
        {
            var results = new ObservableCollection <MappingViewModel>();

            if (mappings == null)
            {
                return(results);
            }

            foreach (FolderMapping mapping in mappings)
            {
                var vm = new MappingViewModel();
                vm.Mapping   = mapping;
                vm.ClientAge = DirUtils.GetLatestFileWriteTimeInDir(mapping.ClientSidePath);
                results.Add(vm);
            }

            return(results);
        }
        private async Task UploadFolderImpl(FolderMapping mapping, ProgressBarStepper stepper)
        {
            string[] files     = GetLocalFiles(mapping.ClientSidePath);
            var      filePaths = from f in files
                                 select f.Substring(mapping.ClientSidePath.Length);

            DateTime uploadDateTime       = DirUtils.GetLatestFileWriteTimeInDir(mapping.ClientSidePath);
            string   datetimeFolderString = DateTimeDirUtils.GetDirDateTimeString(uploadDateTime);
            string   serverSideFolderPath = folderRoot + mapping.FriendlyName + "/" + datetimeFolderString;

            client.CreateDirectory(serverSideFolderPath);

            foreach (string file in filePaths)
            {
                string uploadPath = serverSideFolderPath + file.Replace(@"\", "/");
                await client.UploadFileAsync(mapping.ClientSidePath + file, uploadPath, FtpExists.Overwrite, true, FtpVerify.Retry);

                progressUpdateAction.Invoke(stepper.Step());
            }
        }
 public async Task UpdateLocalAndServerAge()
 {
     ClientAge = DirUtils.GetLatestFileWriteTimeInDir(mapping.ClientSidePath);
     ServerAge = await connection.LatestSync(mapping);
 }