2013-04-17 24 views

回答

1
private void button1_Click(object sender, EventArgs e) 
    { 
     SevenZipCompressor comp = new SevenZipCompressor(@"c\Temp\"); 
     SevenZipCompressor.SetLibraryPath(@"C:\Users\i.cil\Desktop\7zip\SevenZip\7z.dll"); 
     comp.ArchiveFormat = OutArchiveFormat.SevenZip; 
     comp.CompressionLevel = CompressionLevel.Ultra; 
     comp.CompressionMethod = CompressionMethod.Lzma; 
     comp.CompressionMode = CompressionMode.Create; 
     comp.CompressFiles(@"c:\Temp\Temp.7z", @"C:\Temp\CentAppLOG13-Sep-13010004.bak"); 

     SfxModule mdl = SfxModule.Extended; 

     SevenZipSfx sfx = new SevenZipSfx(mdl); 

     sfx.ModuleFileName = @"C:\Users\i.cil\Desktop\7zip\SevenZip\sfx\7zxSD_LZMA.sfx"; 
     sfx.MakeSfx(@"c:\Temp\Temp.7z", 
        new Dictionary<string, string> 
        { 
         { "Title", "ATIG Platform" }, 
         { "InstallPath", ProgramFilesx86() + "\\ATIG Platform" }, 
         { "BeginPrompt", "Yükleme işlemi başlatılsın mı?" }, 
         { "CancelPrompt", "Yükleme işlemi iptal edilecek?" }, 
         { "OverwriteMode", "2" }, 
         { "GUIMode", "1" }, 
         { "ExtractDialogText", "Dosyalar ayıklanıyor" }, 
         { "ExtractTitle", "Ayıklama İşlemi" }, 
         { "ErrorTitle", "Hata!" } 
        }, 
        @"c:\Temp\Temp.exe"); 
    } 

    static string ProgramFilesx86() 
    { 
     if (8 == IntPtr.Size 
      || (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")))) 
     { 
      return Environment.GetEnvironmentVariable("ProgramFiles(x86)"); 
     } 

     return Environment.GetEnvironmentVariable("ProgramFiles"); 
    } 
+0

你願意張貼您的答案代碼的解釋?代碼本身並不是很具描述性。 –

+0

啓用SFX的方法是在源代碼中添加項目屬性中的一些參數,這些參數在編譯前我不記得了,但我接受該答案,原因是如何使用字典類型設置SFX模塊參數的示例,那個信息在任何地方都找不到!謝謝。 – ElektroStudios

相關問題