使用C#将受密码保护的Zip文件转换为Enc文件

时间:2018-11-22 06:21:45

标签: c# .net entity-framework linq c#-4.0

我已使用下面的以下代码将zip文件转换为enc文件,但无法正常工作,请帮助我解决此问题

此外,如果有任何第三方工具可将zip转换为enc文件,请提及其详细信息。

预先感谢

try
            { 
            string startPath = "";
            string path = @"F:\Augustin\UpTest\Upload\";
            DirectoryInfo objdirinfovikramfile = new DirectoryInfo(path);
            if (objdirinfovikramfile.Exists)
            {
                errorcheck = "a";
                foreach (DirectoryInfo objdirenmvikramfile in objdirinfovikramfile.GetDirectories())
                {
                    string checkvikramfile = "";
                    checkvikramfile = objdirenmvikramfile.Name;
                    startPath = path + checkvikramfile + "\\";
                    string zipPath = path + checkvikramfile + ".zip";

                        string sub = zipPath.Split('\\').Last();

                        Boolean decrypt = false;
                        FileManager obj = new FileManager();

                        Int64 secure_count = 0;

                        while (secure_count <= 3 && !decrypt)

                        {
                            decrypt = obj_viki1.Decryption(zipPath, zipPath.Replace(".zip", ".enc"), "dietcoke1");  //DLL Function
                            secure_count++;
                        }


                        if (secure_count > 3 && !decrypt)
                        {
                            File.Copy(zipPath, path + "\\FAILED\\" + zipPath.Split('\\').Last(),true );
                            File.Copy(zipPath, path + "\\FAILED\\" + zipPath.Split('\\').Last(), true);


                        }
                        else
                        {
                            File.Copy(zipPath, path + "\\SUCCESS\\" + zipPath.Split('\\').Last(), true);

                        }
                    }
                }
            }
            catch (Exception ex)
            {               
                Error_log("FileProcess Enc: " + errorcheck + "                            ", ex.ToString());
                Application.Exit();
            }

0 个答案:

没有答案