2016-08-01 3 views
2

xamarinでの仕事とCompressionLevel.NoCompressionZipArchiveEntry.CompressionLevelを設定しないで、 私はリリースモードで私のアンドロイドAPKを実行すると、すべてのZipArchiveEntriesは圧縮され、比率を持っています> 0%。
私はアンドロイド4.1.1.3にxamarinを使い、lenovoタブ4 A7-30GCとasus Z00VDでapkをテストします。
サンプルコード:設定CompressionLevel.NoCompressionにZipArchiveEntry.CompressionLevel私はストアファイル用のzipアーカイブを作成するアンドロイド

public void AddToArchive(string EntryName, string Path, DateTime TimeStamp) 
    { 
     ZipArchiveEntry zipEntry = this.Archive.CreateEntry(EntryName, CompressionLevel.NoCompression); 
     zipEntry.LastWriteTime = TimeStamp; 
     using (Stream entryStream = zipEntry.Open()) 
     { 
      using (Stream fileStream = File.Open(Path, FileMode.Open, FileAccess.Read, FileShare.Read)) 
      { 
       fileStream.CopyTo(entryStream); 
       fileStream.Close(); 
      } 
      entryStream.Close(); 
     } 
    } 

ありがとうございました。

答えて

0

Microsoftの.Net参照ソース(Monoソース経由)に基づいて、CompressionLevelを設定すると、下にある圧縮コードにのみヒントが提供されます。

"ゼロ"圧縮レベルで圧縮されたファイルの中には、要求された圧縮レベルに関係なく実行されるファイル最適化のために圧縮がいくつか見えることがあります。これはMono、Xamarin.Android、Xamarin.iOS、.Netなどで見つけられます。

これは抽象的な概念であり、ZLib圧縮レベルではありません。 デフラータの実装固有の可能なレベルパラメータに対応するものがあるかもしれません。

///------------------------------------------------------------------------------ 
/// <copyright file="CompressionLevel.cs" company="Microsoft"> 
///  Copyright (c) Microsoft Corporation. All rights reserved. 
/// </copyright>        
/// 
/// <owner>gpaperin</owner> 
///------------------------------------------------------------------------------ 
// This is an abstract concept and NOT the ZLib compression level. 
// There may or may not be any correspondance with the a possible implementation-specific level-parameter of the deflater. 
public enum CompressionLevel { 
    Optimal = 0, 
    Fastest = 1, 
    NoCompression = 2 
} 
関連する問題