Esempio n. 1
0
        /// <summary>
        /// Changes the path to the 7-zip native library.
        /// </summary>
        public static void InitLib()
        {
            libraryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "7-Zip", "7z.dll");

            if (!File.Exists(libraryPath))
            {
                try
                {
                    Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "7-Zip"));
                    File.WriteAllBytes(libraryPath, SevenZipLib.X86);
                }
                catch
                {
                    throw new SevenZipException("The 7-Zip library could not be written onto the local machine.");
                }
            }

            SevenZipLibraryManager.SetLibraryPath(libraryPath);
        }
Esempio n. 2
0
 /// <summary>
 /// Changes the path to the 7-zip native library.
 /// </summary>
 /// <param name="libraryPath">The path to the 7-zip native library.</param>
 public static void SetLibraryPath(string libraryPath)
 {
     SevenZipLibraryManager.SetLibraryPath(libraryPath);
 }