Ejemplo n.º 1
0
        public void DownloadControl(DownloadControlCode controlCode, Guid guid)
        {
            Logger.Default.Trace("DownloadControl: " + controlCode + "  " + guid);
            var down = GetDownloadManager(guid);

            if (down != null)
            {
                if (controlCode == DownloadControlCode.Start)
                {
                    down.Start();
                }
                else if (controlCode == DownloadControlCode.Pause)
                {
                    down.Pause();
                }
                else if (controlCode == DownloadControlCode.Delete)
                {
                    down.Delete();
                }
                else if (controlCode == DownloadControlCode.GoTop)
                {
                    lock (_downloads)
                    {
                        _downloads.Remove(down);
                        _downloads.Insert(0, down);
                    }
                    onPart(down, nameof(DownloadControlCode.GoTop));
                }
            }
        }
Ejemplo n.º 2
0
 public void DownloadControl(DownloadControlCode code, byte[] buffer)
 {
     using (MemoryStream ms = new MemoryStream())
     {
         PacketBase.WriteBytes(ms, (int)code);
         PacketBase.WriteBytes(ms, buffer);
         Send((int)ParamCode.DownloadControl, ms.ToArray());
     }
 }
Ejemplo n.º 3
0
        void onDownloadControl(DownloadControlCode code, byte[] buffer)
        {
            var handle = DownloadControlEvent;

            if (handle != null)
            {
                handle(code, buffer);
            }
        }
Ejemplo n.º 4
0
        private void onDownloadControl(Guid guid, DownloadControlCode control)
        {
            var handle = DownloadControlEvent;

            if (handle != null)
            {
                handle(control, guid);
            }
        }
Ejemplo n.º 5
0
        private void onDownloadControl(DownloadControlCode controlCode, MemoryStream ms)
        {
            switch (controlCode)
            {
            case DownloadControlCode.Add:
                IDownloadInfo[] param = DownloadInfoParam.DecodeArray(ms);
                OnlineDownloadsManager.Instance.AddRange(false, true, param);
                break;

            case DownloadControlCode.Start:
            case DownloadControlCode.Pause:
            case DownloadControlCode.Delete:
            case DownloadControlCode.GoTop:
                Guid guid = PacketBase.ReadGuid(ms);
                OnlineDownloadsManager.Instance.DownloadControl(controlCode, guid);
                break;
            }
        }
Ejemplo n.º 6
0
 public void DownloadControl(DownloadControlCode code, byte[] buffer)
 {
     _downProxy?.DownloadControl(code, buffer);
 }
Ejemplo n.º 7
0
 private void onDownloadControl(DownloadControlCode code, byte[] buffer)
 {
     _downloader?.DownloadControl(code, buffer);
 }
Ejemplo n.º 8
0
 private void onDownloadControl(DownloadControlCode code, Guid guid)
 {
     Console.WriteLine(code);
     onDownloadControl(code, guid.ToByteArray());
 }