예제 #1
0
    private void method_5(TransferingProject transferingProject_0, FileTransDisrupttedType fileTransDisrupttedType_0)
    {
        CancelFileContract contract;
        IMessageHandler    interface2;

        if (fileTransDisrupttedType_0 == FileTransDisrupttedType.InnerError)
        {
            contract   = new CancelFileContract(transferingProject_0.ProjectID, true, transferingProject_0.FileTransDisrupttedCause);
            interface2 = this.interface9_0.imethod_4 <CancelFileContract>(this.string_0, this.fileMessageTypeRoom_0.CancelFileSending, contract, transferingProject_0.AccepterID);
            this.SendMessage(interface2, false);
        }
        else if (fileTransDisrupttedType_0 == FileTransDisrupttedType.ReliableP2PChannelClosed)
        {
            contract   = new CancelFileContract(transferingProject_0.ProjectID, false, "ReliableP2PChannelClosed");
            interface2 = this.interface9_0.imethod_4 <CancelFileContract>(this.string_0, this.fileMessageTypeRoom_0.CancelFileSending, contract, transferingProject_0.AccepterID);
            this.SendMessage(interface2, false);
        }
        else if (fileTransDisrupttedType_0 == FileTransDisrupttedType.NetworkSpeedSlow)
        {
            contract   = new CancelFileContract(transferingProject_0.ProjectID, false, "NetworkSpeedSlow");
            interface2 = this.interface9_0.imethod_4 <CancelFileContract>(this.string_0, this.fileMessageTypeRoom_0.CancelFileSending, contract, transferingProject_0.AccepterID);
            this.SendMessage(interface2, true);
        }
    }
예제 #2
0
        private void AddFileTransItem(TransferingProject project, bool offlineFile, bool doneAgreed)
        {
            if (this.projectFilter != null)
            {
                if (!this.projectFilter(project))
                {
                    return;
                }
            }

            var fileTransItem = this.GetExistedItem(project.ProjectID);

            if (fileTransItem != null)
            {
                return;
            }
            fileTransItem = new FileTransferItem();
            fileTransItem.FileCanceled += new CbFileCanceled(fileTransItem_FileCanceled);
            fileTransItem.FileReceived += new CbFileReceived(fileTransItem_FileReceived);
            fileTransItem.FileRejected += new CbFileRejected(fileTransItem_FileRejected);
            fileTransItem.Initialize(project, offlineFile, doneAgreed);
            this.flowLayoutPanel1.Controls.Add(fileTransItem);
            this.FileTransStarted(project.ProjectName, project.IsSender);
        }
예제 #3
0
        void fileSenderManager_FileResumedTransStarted(TransferingProject info)
        {
            if (this.projectFilter != null)
            {
                if (!this.projectFilter(info))
                {
                    return;
                }
            }

            if (this.InvokeRequired)
            {
                this.Invoke(new CbGeneric <TransferingProject>(this.fileSenderManager_FileResumedTransStarted), info);
            }
            else
            {
                this.AddFileTransItem(info, false, true);
                var item = this.GetExistedItem(info.ProjectID);
                if (item != null)
                {
                    this.FileResumedTransStarted(info.ProjectName, true);
                }
            }
        }
        void fileTransDisruptted(TransferingProject info, FileTransDisrupttedType disrupttedType)
        {
            //if (!this.IsHandleCreated)
            //{
            //    return;
            //}

            if (this.InvokeRequired)
            {
                this.Invoke(new CbGeneric<TransferingProject, FileTransDisrupttedType>(this.fileTransDisruptted), info, disrupttedType);
            }
            else
            {
                FileTransferItem item = this.GetExistedItem(info.ProjectID);
                if (item != null)
                {
                    this.flowLayoutPanel1.Controls.Remove(item);
                    this.FileTransDisruptted(info.ProjectName, info.IsSender, disrupttedType);
                }
            }
        }
        void fileTransCompleted(TransferingProject info)
        {
            //if (!this.IsHandleCreated)
            //{
            //    return;
            //}

            if (this.InvokeRequired)
            {
                this.Invoke(new CbGeneric<TransferingProject>(this.fileTransCompleted), info);
            }
            else
            {
                FileTransferItem item = this.GetExistedItem(info.ProjectID);
                if (item != null)
                {
                    this.flowLayoutPanel1.Controls.Remove(item);
                    this.FileTransCompleted(info.ProjectName, info.IsSender, info.Comment ,info.IsFolder);
                }
            }
        }
        void fileSenderManager_FileResumedTransStarted(TransferingProject info)
        {
            if (this.projectFilter != null)
            {
                if (!this.projectFilter(info))
                {
                    return;
                }
            }

            if (this.InvokeRequired)
            {
                this.Invoke(new CbGeneric<TransferingProject>(this.fileSenderManager_FileResumedTransStarted), info);
            }
            else
            {
                this.AddFileTransItem(info ,false, true);
                FileTransferItem item = this.GetExistedItem(info.ProjectID);
                if (item != null)
                {
                    this.FileResumedTransStarted(info.ProjectName ,true);
                }
            }
        }
        private void AddFileTransItem(TransferingProject project, bool offlineFile, bool doneAgreed)
        {
            if (this.projectFilter != null)
            {
                if (!this.projectFilter(project))
                {
                    return;
                }
            }

            FileTransferItem fileTransItem = this.GetExistedItem(project.ProjectID);
            if (fileTransItem != null)
            {
                return;
            }
            fileTransItem = new FileTransferItem();
            fileTransItem.FileCanceled += new CbFileCanceled(fileTransItem_FileCanceled);
            fileTransItem.FileReceived += new CbFileReceived(fileTransItem_FileReceived);
            fileTransItem.FileRejected += new CbFileRejected(fileTransItem_FileRejected);
            fileTransItem.Initialize(project, offlineFile ,doneAgreed);
            this.flowLayoutPanel1.Controls.Add(fileTransItem);
            this.FileTransStarted(project.ProjectName, project.IsSender);
        }
예제 #8
0
        private bool FilterTransferingProject(TransferingProject pro)
        {
            NDiskParameters para = Comment4NDisk.Parse(pro.Comment);
            if (para == null)
            {
                return false;
            }

            return this.ownerID == pro.DestUserID && para.NetDiskID == this.netDiskID;
        }
예제 #9
0
파일: Class2.cs 프로젝트: jollitycn/JGNet
 public void imethod_1(TransferingProject transferingProject_0)
 {
     this.iobjectManager_2.Add(transferingProject_0.ProjectID, transferingProject_0);
 }
예제 #10
0
        void fileOutter_FileResponseReceived(TransferingProject project, bool agreeReceive)
        {
            if (project.Comment != null) //表示为网盘或远程磁盘
            {
                return;
            }

            GlobalResourceManager.UiSafeInvoker.ActionOnUI<TransferingProject, bool>(this.do_fileOutter_FileResponseReceived, project, agreeReceive);
        }
예제 #11
0
    protected IMessageHandler method_5(IMessageHandler interface37_0)
    {
        TransferingProject      project;
        CancelFileContract      contract2;
        FileTransDisrupttedType type;

        if (interface37_0.Header.MessageType == this.object_0.BeginSendFile)
        {
            BeginSendFileContract contract3 = this.interface9_0.imethod_1 <BeginSendFileContract>(interface37_0);
            project = new TransferingProject(contract3.ProjectID, contract3.IsFolder, contract3.OriginPath, contract3.LastUpdateTime, interface37_0.Header.DestUserID, interface37_0.Header.UserID, contract3.TotalSize, false, contract3.Comment);
            ResumedProjectItem item = this.interface1_0.imethod_0(project);
            this.interface1_0.imethod_1(project);
            this.class26_0.method_9(contract3.ProjectID, interface37_0.Header.UserID, FileHelper.GetFileNameNoPath(contract3.OriginPath), contract3.TotalSize, item, contract3.Comment);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.RejectOrAcceptFile)
        {
            RejectOrAcceptFileContract contract = this.interface9_0.imethod_1 <RejectOrAcceptFileContract>(interface37_0);
            project = this.interface7_0.imethod_2(contract.ProjectID);
            if (project != null)
            {
                project.method_2(contract.RejectCause);
                this.class26_0.method_7(project, contract.Agree);
                if (contract.Agree)
                {
                    project.TimeStarted   = DateTime.Now;
                    project.IsTransfering = true;
                    this.interface7_0.HnFdepcbbe(contract.ProjectID, contract.ReceivedCount, contract.DisrupttedFileRelativePath, contract.DisrupttedFileReceivedCount);
                }
                else
                {
                    this.interface7_0.imethod_7(contract.ProjectID, FileTransDisrupttedType.RejectAccepting, null);
                }
            }
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.FilePackageData)
        {
            FilePackage package = this.interface9_0.imethod_1 <FilePackage>(interface37_0);
            this.interface1_0.ocqOcyhOmB(interface37_0.Header.UserID, package);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.CancelFileSending)
        {
            contract2 = this.interface9_0.imethod_1 <CancelFileContract>(interface37_0);
            type      = contract2.InnerError ? FileTransDisrupttedType.DestInnerError : FileTransDisrupttedType.DestCancel;
            this.interface1_0.imethod_5(contract2.ProjectID, type, contract2.Cause);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.CancelFileReceiving)
        {
            contract2 = this.interface9_0.imethod_1 <CancelFileContract>(interface37_0);
            type      = contract2.InnerError ? FileTransDisrupttedType.DestInnerError : FileTransDisrupttedType.DestCancel;
            this.interface7_0.imethod_7(contract2.ProjectID, type, contract2.Cause);
            return(null);
        }
        if (interface37_0.Header.MessageType == this.object_0.SingleFileRevFinishedNotify)
        {
            SingleFileNotifyContract contract4 = this.interface9_0.imethod_1 <SingleFileNotifyContract>(interface37_0);
            this.interface7_0.imethod_12(contract4.ProjectID);
            return(null);
        }
        return(null);
    }
예제 #12
0
 private void AddFileTransItem(TransferingProject project)
 {
     this.AddFileTransItem(project, false);
 }
예제 #13
0
        public void Initialize(TransferingProject info, bool offlineFile, bool doneAgreed)
        {
            this.transmittingFileInfo = info;
            this.ShowIcon(info.ProjectName ,info.IsFolder);

            this.skinLabel_FileName.Text = this.transmittingFileInfo.ProjectName;
            this.toolTip1.SetToolTip(this.skinLabel_FileName, this.transmittingFileInfo.ProjectName);
            if (info.IsSender)
            {
                this.pictureBox_send.Visible = true;
                this.pictureBox_receive.Visible = false;
                this.skinLabel_receive.Visible = false;
                this.skinLabel_receive.Enabled = false;
                this.skinLabel_cancel.Visible = true;
                this.skinLabel_cancel.Enabled = true;
            }
            else
            {
                this.pictureBox_send.Visible = false;
                this.pictureBox_receive.Visible = true;
                this.skinLabel_receive.Visible = true;
                this.skinLabel_receive.Enabled = true;
                this.skinLabel_cancel.Visible = true;
                this.skinLabel_cancel.Enabled = true;
                this.skinLabel_cancel.Text = "�ܾ�";

                if (doneAgreed)
                {
                    this.skinLabel_receive.Enabled = false;
                    this.skinLabel_receive.Visible = false;
                    this.skinLabel_cancel.Text = "ȡ��";
                }
            }
            this.label_speed.Visible = false;
            this.skinLabel_speedTitle.Visible = false;

            string sizeStr = PublicHelper.GetSizeString((ulong)this.transmittingFileInfo.TotalSize);
            this.label_fileSize.Text = sizeStr;
        }
예제 #14
0
 public ResumedProjectItem GetResumedProjectItem(TransferingProject transferingProject_0)
 {
     return(null);
 }
예제 #15
0
        void fileTransStarted(TransferingProject info)
        {
            //if (!this.IsHandleCreated)
            //{
            //    return;
            //}

            if (this.projectFilter != null)
            {
                if (!this.projectFilter(info))
                {
                    return;
                }
            }

            if (this.InvokeRequired)
            {
                this.BeginInvoke(new CbGeneric<TransferingProject>(this.fileTransStarted), info);
            }
            else
            {
                this.AddFileTransItem(info ,false ,true);
                FileTransferItem item = this.GetExistedItem(info.ProjectID);
                if (item != null)
                {
                    item.IsTransfering = true;
                }
            }
        }
예제 #16
0
 //对方同意或拒绝接收文件
 public void OnFileResponse(TransferingProject transferingProject, bool agreeReceive)
 {
     this.textChatControl1.ShowSystemMessage(transferingProject, agreeReceive);
 }
예제 #17
0
 void do_fileOutter_FileResponseReceived(TransferingProject project, bool agreeReceive)
 {
     ChatForm form = this.GetChatForm(project.DestUserID);
     form.FlashChatWindow(true);
 }
예제 #18
0
 /// <summary>
 /// File transmission start.
 /// </summary>
 /// <param name="transferingProject">transfering project</param>
 void FileReceivingEvents_FileTransStarted(TransferingProject transferingProject)
 {
     Event_FileToBeUpdated?.Invoke(mFileCountAlreadyUpdated, transferingProject.ProjectName, transferingProject.TotalSize);
 }
예제 #19
0
        void do_fileOutter_FileResponseReceived(TransferingProject project, bool agreeReceive)
        {
            ChatForm form = this.GetChatForm(project.DestUserID);

            form.FlashChatWindow(true);
        }
예제 #20
0
파일: Class2.cs 프로젝트: jollitycn/JGNet
 public ResumedProjectItem imethod_0(TransferingProject transferingProject_0)
 {
     return(this.class93_0.GetResumedProjectItem(transferingProject_0));
 }