예제 #1
0
파일: Form1.cs 프로젝트: int0/Settlers7.BBA
        private int WriteFile(Stream destination, Stream source, FileInfo sourceInfo)
        {
//          int size = 0;
//
//          if( checkBox1.Checked || IsNeedToCompress( sourceInfo ) )
//          {
//              long position = destination.Position;
//              BinaryWriter bw = new BinaryWriter( destination, Encoding.Default );
//              bw.Write( size );
//              bw.Write( ( int )sourceInfo.Length );
//              if( sourceInfo.Length < 100000 )
//              {
//                  size = Compression.Compress( source, destination, 9, true );
//              }
//              else if( sourceInfo.Length < 1000000 )
//              {
//                  size = Compression.Compress( source, destination, 6, true );
//              }
//              else
//              {
//                  size = Compression.Compress( source, destination, 3, true );
//              }
//              destination.Position = position;
//              bw.Write( size );
//              destination.Position += size + 4;
//              size += 8;
//          }
//          else
//          {
//              size = Compression.CopyStream( source, destination );
//          }

            return(Compression.CopyStream(source, destination));;
        }