Exemple #1
0
        //请求发送文件
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            string filePath = ESBasic.Helpers.FileHelper.GetFileToOpen("打开");

            if (filePath == null)
            {
                return;
            }
            string           fileID;
            SendingFileParas sendingFileParas = new SendingFileParas(20480, 0);//文件数据包大小,可以根据网络状况设定,局网内可以设为204800,传输速度可以达到30M/s以上;公网建议设定为2048或4096或8192

            this.fileOutter.BeginSendFile(this.friendID, filePath, null, sendingFileParas, out fileID);
        }
Exemple #2
0
    public void HnFdepcbbe(string string_1, ulong ulong_0, string string_2, ulong ulong_1)
    {
        TransferingProject project = this.imethod_2(string_1);

        if (project != null)
        {
            SendingFileParas paras = this.class3_0.imethod_0(project.AccepterID);
            int filePackageSize    = paras.FilePackageSize;
            int sendingSpanInMSecs = paras.SendingSpanInMSecs;
            if (project.method_0() != null)
            {
                filePackageSize    = project.method_0().FilePackageSize;
                sendingSpanInMSecs = project.method_0().SendingSpanInMSecs;
            }
            if (filePackageSize > (GlobalUtil.MaxLengthOfMessage - 100))
            {
                filePackageSize = GlobalUtil.MaxLengthOfMessage - 100;
            }
            IFileOutter interface2 = null;
            if (project.IsFolder)
            {
                interface2 = new DirectorySender(this.emptyAgileLogger_0, (IFilePackageHelper)this.object_0, project.OriginPath, project.AccepterID, string_2, ulong_0, ulong_1);
            }
            else if (project.OriginStream == null)
            {
                interface2 = new FileSender(this.emptyAgileLogger_0, (IFilePackageHelper)this.object_0, project.OriginPath, project.AccepterID, ulong_0);
            }
            else
            {
                interface2 = new Class22(this.emptyAgileLogger_0, (IFilePackageHelper)this.object_0, project.OriginPath, project.OriginStream, project.TotalSize, project.AccepterID);
            }
            interface2.imethod_9(filePackageSize);
            interface2.imethod_11(sendingSpanInMSecs);
            interface2.imethod_13(this.int_0);
            interface2.imethod_6(project.ProjectID);
            interface2.FileTransProgress   += new CbFileSendedProgress(this.method_8);
            interface2.FileTransCompleted  += new CbFileTransCompleted(this.method_9);
            interface2.FileTransDisruptted += new CbFileTransDisruptted(this.method_10);
            this.safeDictionary_1.Add(interface2.imethod_5(), interface2);
            if (ulong_0 == 0L)
            {
                this.FileTransStarted(project);
            }
            else
            {
                this.FileTransCompleted(project);
            }
            interface2.HnFdepcbbe(this.bool_0);
        }
    }
Exemple #3
0
    public void imethod_6(string string_1, Stream stream_0, string string_2, ulong ulong_0, string string_3, SendingFileParas sendingFileParas_0, string string_4)
    {
        TransferingProject project = new TransferingProject(string_3, stream_0, string_2, string_1, this.string_0, ulong_0, true, string_4);

        project.method_1(sendingFileParas_0);
        this.safeDictionary_0.Add(project.ProjectID, project);
    }
Exemple #4
0
    public void imethod_5(string string_1, string string_2, bool bool_1, ulong ulong_0, DateTime dateTime_0, string string_3, SendingFileParas sendingFileParas_0, string string_4)
    {
        TransferingProject project = new TransferingProject(string_3, bool_1, string_2, dateTime_0, string_1, this.string_0, ulong_0, true, string_4);

        project.method_1(sendingFileParas_0);
        this.safeDictionary_0.Add(project.ProjectID, project);
    }
Exemple #5
0
    public void BeginSendFile(string accepterID, string fileOrDirPath, string comment, SendingFileParas paras, out string projectID)
    {
        bool flag;

        if (accepterID == null)
        {
            accepterID = "_0";
        }
        if (!(flag = Directory.Exists(fileOrDirPath)))
        {
            FileStream stream = File.Open(fileOrDirPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            stream.Close();
            stream.Dispose();
        }
        projectID = Class23.smethod_0(this.string_0);
        FileSystemInfo info          = null;
        ulong          directorySize = 0L;

        if (flag)
        {
            info          = new DirectoryInfo(fileOrDirPath);
            directorySize = FileHelper.GetDirectorySize(fileOrDirPath);
        }
        else
        {
            info          = new FileInfo(fileOrDirPath);
            directorySize = (ulong)((FileInfo)info).Length;
        }
        string fullName = info.FullName;

        this.fblKqUhvkd.imethod_5(accepterID, fullName, flag, directorySize, info.LastWriteTime, projectID, paras, comment);
        BeginSendFileContract body       = new BeginSendFileContract(fullName, flag, directorySize, info.LastWriteTime, comment, projectID);
        IMessageHandler       interface2 = this.interface9_0.imethod_4 <BeginSendFileContract>(this.string_0, this.fileMessageTypeRoom_0.BeginSendFile, body, accepterID);

        this.SendMessage(interface2, false);
    }
Exemple #6
0
    public void BeginSendFile(string accepterID, Stream stream, string projectName, ulong size, string comment, SendingFileParas paras, out string projectID)
    {
        if (accepterID == null)
        {
            accepterID = "_0";
        }
        projectID = Class23.smethod_0(this.string_0);
        this.fblKqUhvkd.imethod_6(accepterID, stream, projectName, size, projectID, paras, comment);
        BeginSendFileContract body       = new BeginSendFileContract(projectName, false, size, DateTime.Now, comment, projectID);
        IMessageHandler       interface2 = this.interface9_0.imethod_4 <BeginSendFileContract>(this.string_0, this.fileMessageTypeRoom_0.BeginSendFile, body, accepterID);

        this.SendMessage(interface2, false);
    }