Ejemplo n.º 1
0
 public void StartDownload(Queue.QueueEntry.Source source, Queue.QueueEntry entry)
 {
     this.queue_entry = entry;
     this.source = source;
     StartDownload();
 }
Ejemplo n.º 2
0
 public void StartDownload(string filename, string output_filename, long output_file_length)
 {
     //this.output_filename = output_filename;
     //this.filename = filename;
     queue_entry = new Queue.QueueEntry();
     queue_entry.OutputFilename = output_filename;
     queue_entry.Filesize = output_file_length;
     source = new Queue.QueueEntry.Source();
     source.Filename = filename;
     StartDownload();
 }
Ejemplo n.º 3
0
        public void GetFileList(Queue.QueueEntry entry)
        {
            //try to download a filelist that the peer offers by his supports
            //it would be fine to have these converted on the spot to our standard filelist format (files.xml.bz2)
            this.queue_entry = entry;
            this.source = entry.Sources[0];//filelist queue entry have exactly one source , no more no less
            direction = ConnectionDirection.Download;
            long start_pos = 1;
            if (File.Exists(queue_entry.OutputFilename))
            {
                File.Delete(queue_entry.OutputFilename);//delete old filelist if happen to be there
            }

            string filename = "MyList.DcLst";
            if (CheckForExtension("XmlBZList"))
                filename = "files.xml.bz2";
            else if (CheckForExtension("BZList"))
                filename = "MyList.bz2";

            source.Filename = filename;

            if (CheckForExtension("ADCGet"))
            {
                start_pos = start_pos - 1;
                SendCommand("ADCGET", "file " + source.Filename + " " + start_pos + " -1");
                Console.WriteLine("Trying to adc-fetch filelist(" + filename + ") from: '" + entry.Sources[0].UserName + "'");
            }
            else
            {
                SendCommand("Get", filename + "$" + start_pos);
                Console.WriteLine("Trying to fetch filelist(" + filename + ") from: '" + entry.Sources[0].UserName + "'");
            }
        }