Пример #1
0
        private void Delete()
        {
            ILocalSyncTable localSyncTable = new LocalSyncTable(".");
            ILocalFileSystem localFileSystem = new LocalFileSystem();
            IUi ui = new Ui();

            localSyncTable.CollectRepoFiles(repoFile =>
                {
                    repoFile = localFileSystem.EnrichWithRepoRoot(repoFile);
                    localFileSystem.FilterExistingFiles(repoFile, r =>
                        {
                            ui.LogBeginOfOperation(repoFile);
                            r = _remoteSyncTable.DeleteEntry(r);
                            r = _remoteFileStore.Delete(r);
                            r = localSyncTable.DeleteEntry(r);
                            ui.LogEndOfOperation(r);
                        });
                });
        }
Пример #2
0
        private void AddOrUpdate()
        {
            ILocalFileSystem localFileSystem = new LocalFileSystem();
            IIgnoreFilter ignoreFilter = new IgnoreFilter(".");
            IUi ui = new Ui();
            ILocalSyncTable localSyncTable = new LocalSyncTable(".");

            var repoRoot = localFileSystem.GetRepoRoot();
            localFileSystem.CollectRepoFiles(repoRoot,
                                             repoFile => ignoreFilter.Filter(repoFile, r1 =>
                                                 {
                                                     r1 = localFileSystem.EnrichWithMetadata(r1);
                                                     localSyncTable.FilterUnchangedByTimeStamp(r1, r2 =>
                                                         {
                                                             ui.LogBeginOfOperation(r2);
                                                             var stream = localFileSystem.LoadFromFile(r2);
                                                             r2 = _remoteFileStore.Upload(r2, stream);
                                                             r2 = UpdateRemoteSyncTable(r2);
                                                             localSyncTable.AddOrUpdateEntry(r2);
                                                             ui.LogEndOfOperation(r2);
                                                         });
                                                 }));
        }