public void connect(string ip, string port) { if (transferManager == null) { transferManager = new TransferManager(); transferManager.Connect(ip.Trim(), int.Parse(port.Trim()), connectCallback); // } }
private void AcceptListenerAccepted(object sender, SocketAcceptedEventArgs e) { // acceptListener.Stop(); transferManager = new TransferManager(e.Accepted); transferManager.OutputFolder = outputFolder; transferManager.audioMessageFolder = audioMessageFolder; registerEvents(); transferManager.Run(); OnConnected(transferManager.EndPoint.ToString()); }
public void Close() { try { Client.Transfers.Remove(ID); } catch { } Running = false; FS.Close(); pauseEvent.Dispose(); Client = null; }
public static TransferQueue CreateDownloadQueue(TransferManager 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(TransferManager 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(); ///Random int generator queue.Length = queue.FS.Length; return(queue); } catch { return(null); } }