コード例 #1
0
ファイル: Integration.cs プロジェクト: ralfw/sync
        private void AddOrUpdate()
        {
            ILocalFileSystem localFileSystem = new LocalFileSystem();
            ILocalSyncTable localSyncTable = new LocalSyncTable(".");

            _remoteSyncTable.CollectRepoFiles(remoteFile =>
                {
                    remoteFile = localFileSystem.EnrichWithRepoRoot(remoteFile);
                    localSyncTable.FilterUnchangedById(remoteFile, changedRemoteFile =>
                        {
                            changedRemoteFile = ResolveConflicts(changedRemoteFile);
                            _ui.LogBeginOfOperation(changedRemoteFile);
                            var result = _remoteFileStore.Download(changedRemoteFile);
                            changedRemoteFile = localFileSystem.SaveToFile(result.Item1, result.Item2);
                            localSyncTable.AddOrUpdateEntry(changedRemoteFile);
                            _ui.LogEndOfOperation(changedRemoteFile);
                        });
                });
        }
コード例 #2
0
ファイル: Integration.cs プロジェクト: ralfw/sync
        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);
                                                         });
                                                 }));
        }