Пример #1
0
        private void SetKeyCount(BackgroundUploadItem item)
        {
            lock (this.ThisLock)
            {
                foreach (var key in item.UploadKeys.ToArray())
                {
                    if (!_connectionsManager.IsUploadWaiting(key))
                    {
                        item.UploadedKeys.Add(key);
                        item.UploadKeys.Remove(key);
                    }
                }

                if (item.State == BackgroundUploadState.Uploading)
                {
                    if (item.UploadKeys.Count == 0)
                    {
                        item.State = BackgroundUploadState.Completed;
                    }
                }
            }
        }
Пример #2
0
        private void CheckState(UploadItem item)
        {
            lock (this.ThisLock)
            {
                foreach (var key in item.UploadKeys.ToArray())
                {
                    if (!_connectionsManager.IsUploadWaiting(key))
                    {
                        item.UploadedKeys.Add(key);
                        item.UploadKeys.Remove(key);
                    }
                }

                if (item.State == UploadState.Uploading)
                {
                    if (item.UploadKeys.Count == 0)
                    {
                        item.State = UploadState.Completed;

                        _settings.UploadedSeeds.Add(item.Seed.Clone());
                    }
                }
            }
        }