private async Task RemoveItem(IServerSyncProvider provider,
                                      ISyncDataProvider dataProvider,
                                      string serverId,
                                      string syncJobItemId,
                                      SyncTarget target,
                                      CancellationToken cancellationToken)
        {
            var localItems = await dataProvider.GetItemsBySyncJobItemId(target, serverId, syncJobItemId);

            foreach (var localItem in localItems)
            {
                var files = localItem.AdditionalFiles.ToList();

                foreach (var file in files)
                {
                    _logger.Debug("Removing {0} from {1}.", file, target.Name);
                    await provider.DeleteFile(file, target, cancellationToken).ConfigureAwait(false);
                }

                _logger.Debug("Removing {0} from {1}.", localItem.FileId, target.Name);
                await provider.DeleteFile(localItem.FileId, target, cancellationToken).ConfigureAwait(false);

                await dataProvider.Delete(target, localItem.Id).ConfigureAwait(false);
            }
        }
Esempio n. 2
0
        private async Task RemoveItem(IServerSyncProvider provider,
                                      ISyncDataProvider dataProvider,
                                      string serverId,
                                      string syncJobItemId,
                                      SyncTarget target,
                                      CancellationToken cancellationToken)
        {
            var localItems = await dataProvider.GetItemsBySyncJobItemId(target, serverId, syncJobItemId);

            foreach (var localItem in localItems)
            {
                var files = localItem.AdditionalFiles.ToList();

                // TODO: Remove this. Have to check it for now since this is a new property
                if (!string.IsNullOrWhiteSpace(localItem.FileId))
                {
                    files.Insert(0, localItem.FileId);
                }

                foreach (var file in files)
                {
                    _logger.Debug("Removing {0} from {1}.", file, target.Name);
                    await provider.DeleteFile(file, target, cancellationToken).ConfigureAwait(false);
                }

                await dataProvider.Delete(target, localItem.Id).ConfigureAwait(false);
            }
        }
Esempio n. 3
0
        private async Task RemoveItem(IServerSyncProvider provider,
                                      ISyncDataProvider dataProvider,
                                      string serverId,
                                      string itemId,
                                      SyncTarget target,
                                      CancellationToken cancellationToken)
        {
            var localItems = await dataProvider.GetCachedItems(target, serverId, itemId);

            foreach (var localItem in localItems)
            {
                var files = await GetFiles(provider, localItem, target, cancellationToken);

                foreach (var file in files)
                {
                    await provider.DeleteFile(file.Path, target, cancellationToken).ConfigureAwait(false);
                }

                await dataProvider.Delete(target, localItem.Id).ConfigureAwait(false);
            }
        }
Esempio n. 4
0
        private async Task RemoveItem(IServerSyncProvider provider,
            ISyncDataProvider dataProvider,
            string serverId,
            string syncJobItemId,
            SyncTarget target,
            CancellationToken cancellationToken)
        {
            var localItems = await dataProvider.GetItemsBySyncJobItemId(target, serverId, syncJobItemId);

            foreach (var localItem in localItems)
            {
                var files = localItem.AdditionalFiles.ToList();

                foreach (var file in files)
                {
                    _logger.Debug("Removing {0} from {1}.", file, target.Name);
                    await provider.DeleteFile(file, target, cancellationToken).ConfigureAwait(false);
                }

                await dataProvider.Delete(target, localItem.Id).ConfigureAwait(false);
            }
        }
Esempio n. 5
0
        private async Task RemoveItem(IServerSyncProvider provider,
            ISyncDataProvider dataProvider,
            string serverId,
            string syncJobItemId,
            SyncTarget target,
            CancellationToken cancellationToken)
        {
            var localItems = await dataProvider.GetItemsBySyncJobItemId(target, serverId, syncJobItemId);

            foreach (var localItem in localItems)
            {
                var files = localItem.AdditionalFiles.ToList();

                // TODO: Remove this. Have to check it for now since this is a new property
                if (!string.IsNullOrWhiteSpace(localItem.FileId))
                {
                    files.Insert(0, localItem.FileId);
                }

                foreach (var file in files)
                {
                    _logger.Debug("Removing {0} from {1}.", file, target.Name);
                    await provider.DeleteFile(file, target, cancellationToken).ConfigureAwait(false);
                }

                await dataProvider.Delete(target, localItem.Id).ConfigureAwait(false);
            }
        }