0

I'v been using the DotNetZip library for uncompressing some files from a ZIP file, compressed using the same library. That ZIP file contains exe files, but once decompressed, some of the exe file decompressed is not opening anymore. That problem is not happening if i decompress the file manually with WinRAR.

The code i'm using is this one...

if (!System.IO.File.Exists("ApplicationSample.zip")) { MessageBox.Show("No data found", "Warning"); return false; }
            var Archive = ZipFile.Open(DatFilePath, ZipArchiveMode.Read);
            var InstallPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"/ApplicationSample";
            if (Directory.Exists(InstallPath))
            Directory.Delete(InstallPath, true);
            Directory.CreateDirectory(InstallPath);
            Archive.ExtractToDirectory(InstallPath);
            var ArchiveEd = new Ionic.Zip.ZipFile("ApplicationSample.zip");
            ArchiveEd.UseUnicodeAsNecessary = true;
            ArchiveEd.ZipError += ApplicationSample_ZipError;
            ArchiveEd.ExtractAll(InstallPath);
            ArchiveEd.Dispose();
            ShellLink link = new ShellLink();
            link.WorkingDirectory = InstallPath;
            link.Target = InstallPath + "/ApplicationSample.exe";
            link.IconPath = InstallPath + "/ApplicationSample.ico";
            link.Save(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/ApplicationSample.lnk");

The exe file i'm trying to open is an WPF application that works correctly if i do the same operation manually.

I don't know what's happening here and i would like to know what's the problem.

Thanks!!

  • By "not opening anymore", do you mean the shortcut is invalid or the the .exe is corrupted? What is the error you get? Also which assembly is ShellLink located in? – Volkan Paksoy Jul 16 '15 at 12:32
  • If it's a permission rights problem on InstallPath, update DirectoryInfo of InstallPath by setting accessrules (Google "C# DirectorySecurity getAccessControl SetAccessControl"). – Graffito Jul 16 '15 at 12:41

0 Answers0