MyOAExx/ZipClass.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ICSharpCode.SharpZipLib;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Checksums;


namespace SharpZipLib
{
    public static class ZipClass
    {
        public static string BackUpPath;

        private static bool ZipFileDictory(string FolderToZip, ZipOutputStream s, string ParentFolderName, bool separate, string[] files, string[] dirs)
        {
            bool res = true;
            string[] folders, filenames;
            ZipEntry entry = null;
            FileStream fs = null;
            Crc32 crc = new Crc32();

            try
            {
                //创建当前文件夹
                entry = new ZipEntry(Path.Combine(ParentFolderName, Path.GetFileName(FolderToZip) + "/")); //加上 “/” 才会当成是文件夹创建
                s.PutNextEntry(entry);
                s.Flush();

                //先压缩文件,再递归压缩文件夹 
                if (separate)
                {
                    filenames = files;
                }
                else
                {
                    filenames = Directory.GetFiles(FolderToZip);
                }

                foreach (string file in filenames)
                {
                    //打开压缩文件
                    fs = File.OpenRead(file);

                    byte[] buffer = new byte[fs.Length];
                    fs.Read(buffer, 0, buffer.Length);
                    string p = Path.GetFileName(FolderToZip);

                    if (p.Length < 1)
                    {
                        p = Path.GetFileName(file);
                    }
                    else
                    {
                        p += "/" + Path.GetFileName(file);
                    }

                    entry = new ZipEntry(Path.Combine(ParentFolderName, p));

后面还有 242 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。