コード例 #1
0
        public void connect(string ip, string port)
        {
            if (transferManager == null)
            {
                transferManager = new TransferManager();
                transferManager.Connect(ip.Trim(), int.Parse(port.Trim()),
                                        connectCallback);

                //
            }
        }
コード例 #2
0
        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());
        }
コード例 #3
0
ファイル: TransferQueue.cs プロジェクト: 0000duck/bird
        public void Close()
        {
            try
            {
                Client.Transfers.Remove(ID);
            }
            catch
            {
            }
            Running = false;
            FS.Close();
            pauseEvent.Dispose();

            Client = null;
        }
コード例 #4
0
ファイル: TransferQueue.cs プロジェクト: 0000duck/bird
 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);
     }
 }
コード例 #5
0
ファイル: TransferQueue.cs プロジェクト: 0000duck/bird
        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);
            }
        }