Exemplo n.º 1
0
 public static TransferQueue CreateDownloadQueue(TransferClient client, int id, string saveName, long length)
 {
     try
     {
         //Same as above with some changes.
         var queue = new TransferQueue();
         queue.Filename = Path.GetFileName(saveName);
         queue.Client   = client;
         queue.Type     = QueueType.Download;
         //Create our file stream for writing.
         queue.FS = new FileStream(saveName, FileMode.Create);
         //Fill the stream will 0 bytes based on the real size. So we can index write.
         queue.FS.SetLength(length);
         queue.Length = length;
         //Instead of generating an ID, we will set the ID that has been sent.
         queue.ID = id;
         return(queue);
     }
     catch
     {
         return(null);
     }
 }