Пример #1
0
        public UploaderClient1(DownloaderClient1 downloaderClient, UploaderCfg uploaderCfg) : base(uploaderCfg)
        {
            _upCfg     = uploaderCfg;
            _downloadr = downloaderClient;
            OnError    = ex => MessageBox.Show(ex.Info());

            EmbeddedResrc.ExtractToFile <UploaderClient1>
                ("7za.dll", "Archivers", SevenZipper1.GetLocalBinariesDir());
        }
Пример #2
0
        private static bool SetLibraryPath(string libFilename)
        {
            var bDir = GetLocalBinariesDir();
            var libF = Path.Combine(bDir, libFilename);

            if (!File.Exists(libF))
            {
                EmbeddedResrc.ExtractToFile <SevenZipper1>
                    (libFilename, "Archivers", bDir);
            }

            //  To fix "The path is not of a legal form" error:
            //    -  add tag in FodyWeavers.xml
            //    -  <Costura CreateTemporaryAssemblies='true' />


            //  To fix "Can not load 7-zip library or internal COM error! Message: failed to load library."
            //    = proj. properties > Build > Prefer 32-bit

            SevenZipCompressor.SetLibraryPath(libF);

            return(true);
        }
Пример #3
0
        private static SevenZipExtractor GetExtractor(string archivePath)
        {
            var libPath = GetLibPath(EXTRACTOR_LIB);

            if (!File.Exists(libPath))
            {
                EmbeddedResrc.ExtractToFile <SevenZipper2>
                    (EXTRACTOR_LIB, "Compression", LibDir);
            }

            //  To fix "The path is not of a legal form" error:
            //    -  add tag in FodyWeavers.xml
            //    -  <Costura CreateTemporaryAssemblies='true' />


            //  To fix "Can not load 7-zip library or internal COM error! Message: failed to load library."
            //    = proj. properties > Build > Prefer 32-bit

            SevenZipCompressor.SetLibraryPath(libPath);

            return(new SevenZipExtractor
                       (archivePath, InArchiveFormat.SevenZip));
        }