void SendToServer(HardFile h)
 {
     if (Connected)
     {
         while (h.NeedToStream)
         {
             byte[] buff = h.StreamBytes();
             Array.Resize(ref buff, sck.SendBufferSize);
             sck.Send(buff);
             Debug.WriteLine("Sent: {0}/{1} ( {2} % )", h.BytesSent, h.Information.Length,
                             ((float)h.BytesSent / (float)h.Information.Length) * 100);
             Program.pMain.SetStatusText("Sent " +
                                         ((float)h.BytesSent / (float)h.Information.Length) * 100 +
                                         " % of file " + h.ShortName);
         }
         lvQueue.Items.RemoveByKey(h.Information.Name);
     }
 }
 private void SendToServer(object h)
 {
     if (Connected && h is HardFile)
     {
         HardFile _h = (HardFile)h;
         while (_h.NeedToStream)
         {
             byte[] buff = _h.StreamBytes();
             Array.Resize(ref buff, sck.SendBufferSize);
             sck.Send(buff);
             Debug.WriteLine("Sent: {0}/{1} ( {2} % )", _h.BytesSent, _h.Information.Length,
                             ((float)_h.BytesSent / (float)_h.Information.Length) * 100);
             Program.pMain.SetStatusText("Sent " +
                                         ((float)_h.BytesSent / (float)_h.Information.Length) * 100 +
                                         " % of file " + _h.ShortName);
         }
         lvQueue.Items.RemoveByKey(_h.Information.Name);
     }
     else
     {
         throw new Exception("Either not connected, or tried to send something that wasnt of type <HardFile>");
     }
 }