예제 #1
0
        //发送者上传离线文件完成
        void FileReceivingEvents_FileTransCompleted(ESPlus.FileTransceiver.TransferingProject project)
        {
            string accepterID = Comment4OfflineFile.ParseUserID(project.Comment);

            if (accepterID == null)
            {
                return;
            }

            OfflineFileItem item = new OfflineFileItem();

            item.AccepterID    = accepterID;
            item.FileLength    = project.TotalSize;
            item.FileName      = project.ProjectName;
            item.SenderID      = project.SenderID;
            item.RelayFilePath = project.LocalSavePath;

            if (this.rapidServerEngine.UserManager.IsUserOnLine(accepterID)) //如果接收者在线,则直接转发离线文件
            {
                string newProjectID = null;
                this.rapidServerEngine.FileController.BeginSendFile(item.AccepterID, item.RelayFilePath, Comment4OfflineFile.BuildComment(item.SenderID), out newProjectID);
            }
            else
            {
                this.globalCache.StoreOfflineFileItem(item);
            }
        }
예제 #2
0
        /// <summary>
        /// 向目标用户发送离线文件。
        /// </summary>
        public void SendOfflineFile(string accepterID)
        {
            List <OfflineFileItem> list = this.globalCache.PickupOfflineFileItem(accepterID);

            if (list != null)
            {
                foreach (OfflineFileItem item in list)
                {
                    string projectID = null;
                    this.rapidServerEngine.FileController.BeginSendFile(item.AccepterID, item.RelayFilePath, Comment4OfflineFile.BuildComment(item.SenderID), out projectID);
                }
            }
        }