예제 #1
0
 public void FileReceive(FilePackage filePackage_0)
 {
     try
     {
         if (filePackage_0.PackageType == PackageType.NewChildFolder)
         {
             Directory.CreateDirectory(this.string_0 + Encoding.UTF8.GetString(filePackage_0.Data));
         }
         else if (filePackage_0.PackageType == PackageType.FoldTransferingNextFile)
         {
             if ((this.enisnmwGbe != null) && (this.enisnmwGbe.imethod_6() > this.enisnmwGbe.imethod_9()))
             {
                 this.emptyAgileLogger_0.LogWithTime(string.Format("当前文件[{0}]还未接收完,就收到了准备接收下个文件的指令!", this.enisnmwGbe.imethod_5()));
             }
             FoldTransferingNextFileInfo info = CompactPropertySerializer.Default.Deserialize <FoldTransferingNextFileInfo>(filePackage_0.Data, 0);
             string str = this.string_0 + info.RelativeFilePath;
             this.enisnmwGbe = new FileReceiver(this.emptyAgileLogger_0, this.string_3, str, info.FileLength, this.string_4);
             this.enisnmwGbe.FileTransDisruptted += new CbFileTransDisruptted(this.method_5);
             this.enisnmwGbe.FileTransCompleted  += new CbGeneric <string>(this.OnFileTransCompleted);
             this.enisnmwGbe.FileTransProgress   += new CbFileSendedProgress(this.method_3);
         }
         else if (filePackage_0.PackageType == PackageType.FileTransferingPackage)
         {
             this.enisnmwGbe.FileReceive(filePackage_0);
         }
         else
         {
             this.FileTransReceived(this.string_3);
         }
     }
     catch (Exception exception)
     {
         this.emptyAgileLogger_0.Log(exception, "CJPlus.FileTransceiver.DirectoryReceiver.Receive", ErrorLevel.Standard);
     }
 }
예제 #2
0
 private void DoSend(string string_4)
 {
     try
     {
         int num;
         if (!(this.bool_1 && !this.bool_2))
         {
             string      s        = string_4.Substring(this.string_0.Length);
             byte[]      bytes    = Encoding.UTF8.GetBytes(s);
             FilePackage package2 = new FilePackage(this.string_3, 0, bytes, PackageType.NewChildFolder);
             this.interface35_0.sendMessage(this.string_1, package2);
         }
         DirectoryInfo info4 = new DirectoryInfo(string_4);
         FileInfo[]    files = info4.GetFiles();
         if (comparison_0 == null)
         {
             comparison_0 = new Comparison <FileInfo>(DirectorySender.smethod_3);
         }
         Array.Sort <FileInfo>(files, comparison_0);
         for (num = 0; num < files.Length; num++)
         {
             this.bool_3 = false;
             FileInfo info = files[num];
             string   str  = info.FullName.Substring(this.string_0.Length);
             if (this.bool_1 && (str == this.string_2))
             {
                 this.bool_2 = true;
                 this.bool_3 = true;
             }
             if (!this.bool_1 || this.bool_2)
             {
                 if (this.bool_3)
                 {
                     this.class107_0 = new FileSender(this.emptyAgileLogger_0, this.interface35_0, info.FullName, this.string_1, this.ulong_3);
                 }
                 else
                 {
                     FoldTransferingNextFileInfo info2 = new FoldTransferingNextFileInfo(str, (ulong)info.Length);
                     byte[]      buffer  = CompactPropertySerializer.Default.Serialize <FoldTransferingNextFileInfo>(info2);
                     FilePackage package = new FilePackage(this.string_3, 0, buffer, PackageType.FoldTransferingNextFile);
                     this.interface35_0.sendMessage(this.string_1, package);
                     this.class107_0 = new FileSender(this.emptyAgileLogger_0, this.interface35_0, info.FullName, this.string_1, 0L);
                 }
                 this.class107_0.imethod_9(this.int_0);
                 this.class107_0.imethod_11(this.int_1);
                 this.class107_0.imethod_13(this.int_2);
                 this.class107_0.imethod_6(this.string_3);
                 this.class107_0.FileTransDisruptted += new CbFileTransDisruptted(this.OnFileTransDisruptted);
                 this.class107_0.FileTransProgress   += new CbFileSendedProgress(this.method_3);
                 this.class107_0.HnFdepcbbe(this.thread_0 == null);
                 this.manualResetEvent_0.WaitOne();
                 this.manualResetEvent_0.Reset();
                 if (this.bool_0)
                 {
                     return;
                 }
             }
         }
         DirectoryInfo[] directories = info4.GetDirectories();
         if (comparison_1 == null)
         {
             comparison_1 = new Comparison <DirectoryInfo>(DirectorySender.smethod_4);
         }
         Array.Sort <DirectoryInfo>(directories, comparison_1);
         for (num = 0; num < directories.Length; num++)
         {
             DirectoryInfo info3 = directories[num];
             this.DoSend(info3.FullName);
             if (this.bool_0)
             {
                 return;
             }
         }
     }
     catch (Exception exception)
     {
         this.emptyAgileLogger_0.Log(exception, "CJPlus.FileTransceiver.DirectorySender.DoSend", ErrorLevel.Standard);
     }
 }