public static TransferQueue CreateDownloadQueue(TransferClient client, int id, string saveName, long length)
 {
     try
     {
         var queue = new TransferQueue();
         queue.FileName = Path.GetFileName(saveName);
         queue.Client   = client;
         queue.type     = QueueType.Download;
         queue.Fs       = new FileStream(saveName, FileMode.Create);
         queue.Fs.SetLength(length);
         queue.Length = length;
         queue.ID     = id;
         return(queue);
     }
     catch
     {
         return(null);
     }
 }
 public static TransferQueue createUploadQueue(TransferClient client, string fileName)
 {
     try
     {
         var queue = new TransferQueue();
         queue.FileName            = Path.GetFileName(fileName);
         queue.Client              = client;
         queue.type                = QueueType.upload;
         queue.Fs                  = new FileStream(fileName, FileMode.Open);
         queue.Thread              = new Thread(new ParameterizedThreadStart(transferProc));
         queue.Thread.IsBackground = true;
         queue.ID                  = Program.Rand.Next();
         queue.Length              = queue.Fs.Length;
         return(queue);
     }
     catch
     {
         return(null);
     }
 }