コード例 #1
0
    public void BeginReceiveFile(string projectID, Stream saveStream)
    {
        if (saveStream == null)
        {
            throw new Exception("The value of saveStream can't be null !");
        }
        TransferingProject project = this.object_0.imethod_3(projectID);

        if (project != null)
        {
            project.LocalSaveStream = saveStream;
            project.TimeStarted     = DateTime.Now;
            project.IsTransfering   = true;
            RejectOrAcceptFileContract body = new RejectOrAcceptFileContract(projectID, true, 0L, null);
            this.object_0.imethod_4(project, null, false);
            IMessageHandler interface2 = this.interface9_0.imethod_4 <RejectOrAcceptFileContract>(this.string_0, this.fileMessageTypeRoom_0.RejectOrAcceptFile, body, project.SenderID);
            this.SendMessage(interface2, false);
        }
    }
コード例 #2
0
    public void BeginReceiveFile(string projectID, string savePath, bool allowResume)
    {
        if (savePath == null)
        {
            throw new Exception("The value of saveFilePath can't be null !");
        }
        TransferingProject project = this.object_0.imethod_3(projectID);

        if (project != null)
        {
            project.LocalSavePath = savePath;
            project.TimeStarted   = DateTime.Now;
            project.IsTransfering = true;
            ResumedProjectItem         item = this.object_0.imethod_0(project);
            RejectOrAcceptFileContract body = null;
            if (project.IsFolder)
            {
                if (!((item != null) && allowResume))
                {
                    body = new RejectOrAcceptFileContract(projectID, true, 0L, null);
                }
                else
                {
                    body = new RejectOrAcceptFileContract(projectID, true, item.ReceivedCount, null, item.DisrupttedFileRelativePath, item.DisrupttedFileSize, item.DisrupttedFileReceivedCount);
                }
            }
            else
            {
                ulong num = (!allowResume || (item == null)) ? ((ulong)0L) : item.ReceivedCount;
                body = new RejectOrAcceptFileContract(projectID, true, num, null);
            }
            this.object_0.imethod_4(project, item, allowResume);
            IMessageHandler interface2 = this.interface9_0.imethod_4 <RejectOrAcceptFileContract>(this.string_0, this.fileMessageTypeRoom_0.RejectOrAcceptFile, body, project.SenderID);
            this.SendMessage(interface2, false);
        }
    }
コード例 #3
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);
    }