public void ProcessQueue() { lock (this.Padlock) { int counter = 0; while (this.Queue.Count > counter) { PutioFileHandle h = this.Queue.ElementAt(counter); if (h.PutioFile.Cache.GetNextBufferRange(h.Position) == null) { counter++; continue; } this.Downloader.Download(h); break; } if (this.Queue.Count == 0) { logger.Debug("There are zero handles, stopping download."); this.Downloader.Stop(); } } }
public void Download(PutioFileHandle h) { lock (this.Padlock) { if (this.DLThread != null && this.DLThread.IsAlive) { if (this.Handle == h) { return; } this.Stop(); this.Handle = h; this.ContinueDownloading = true; this.DLThread = new Thread(DownloadJob); this.DLThread.Start(); } else { this.Handle = h; this.DLThread = new Thread(DownloadJob); this.ContinueDownloading = true; this.DLThread.Start(); } } }
public Boolean UpdatePosition(PutioFileHandle handle) { lock (this.Padlock) { this.ProcessQueue(); return(true); } }
public Boolean Unregister(PutioFileHandle handle) { lock (this.Padlock) { if (!this.Queue.Contains(handle)) return false; logger.Debug("UNRegistering handle {0}", handle); this.Queue.Remove(handle); this.ProcessQueue(); return true; } }
public Boolean Unregister(PutioFileHandle handle) { lock (this.Padlock) { if (!this.Queue.Contains(handle)) { return(false); } logger.Debug("UNRegistering handle {0}", handle); this.Queue.Remove(handle); this.ProcessQueue(); return(true); } }
public Boolean IsValidHandle(PutioFileHandle handle) { return(this.OpenHandles.ContainsKey(handle.Guid)); }
public void RemoveHandle(PutioFileHandle handle) { this.OpenHandles.Remove(handle.Guid); }
public void AddHandle(PutioFileHandle handle) { this.OpenHandles.Add(handle.Guid, handle); }
public Boolean UpdatePosition(PutioFileHandle handle) { lock (this.Padlock) { this.ProcessQueue(); return true; } }
public void Download(PutioFileHandle h) { lock (this.Padlock) { if (this.DLThread != null && this.DLThread.IsAlive) { if (this.Handle == h) return; this.Stop(); this.Handle = h; this.ContinueDownloading = true; this.DLThread = new Thread(DownloadJob); this.DLThread.Start(); } else { this.Handle = h; this.DLThread = new Thread(DownloadJob); this.ContinueDownloading = true; this.DLThread.Start(); } } }
public void RemoveHandle(PutioFileHandle handle) { this.OpenHandles.Remove(handle.Guid); }
public Boolean IsValidHandle(PutioFileHandle handle) { return this.OpenHandles.ContainsKey(handle.Guid); }
public void AddHandle(PutioFileHandle handle) { this.OpenHandles.Add(handle.Guid, handle); }