public FileReceiveBufferEventArgs(
     ReceiveFileManager receiveFileManager,
     int size)
     : base()
 {
     _receiveFileManager = receiveFileManager;
     _size = size;
 }
예제 #2
0
        public void AcceptReceive(RequestSendFileEventArgs e)
        {
            TraFransfersFileStart traFransfersFileStart = e.TraFransfersFileStart;
            IPEndPoint remoteIP = e.RemoteIP;
            ResponeTraFransfersFile responeTraFransfersFile;
            if (e.Cancel)
            {
                responeTraFransfersFile = new ResponeTraFransfersFile(
                    traFransfersFileStart.MD5, 0, -1);
                Send((int)Command.ResponeSendFile, responeTraFransfersFile, remoteIP);
            }
            else
            {
                ReceiveFileManager receiveFileManager;
                if (!ReceiveFileManagerList.TryGetValue(
                    traFransfersFileStart.MD5,
                    out receiveFileManager))
                {
                    receiveFileManager = new ReceiveFileManager(
                       traFransfersFileStart.MD5,
                       e.Path,
                       traFransfersFileStart.FileName,
                       traFransfersFileStart.PartCount,
                       traFransfersFileStart.PartSize,
                       traFransfersFileStart.Length,
                       remoteIP);

                    receiveFileManager.ReceiveFileComplete += new FileReceiveCompleteEventHandler(ReceiveFileManagerReceiveFileComplete);
                    receiveFileManager.ReceiveFileTimeout +=new EventHandler(ReceiveFileManagerReceiveFileTimeout);
                    ReceiveFileManagerList.Add(traFransfersFileStart.MD5,receiveFileManager);
                    receiveFileManager.Start();
                }
                responeTraFransfersFile = new ResponeTraFransfersFile(traFransfersFileStart.MD5, 0, 0);
                Send((int)Command.ResponeSendFile, responeTraFransfersFile, remoteIP);
            }
        }
예제 #3
0
 public FileReceiveEventArgs(
     ReceiveFileManager receiveFileManager)
     : base()
 {
     _receiveFileManager = receiveFileManager;
 }