Example #1
0
    private static void ZipRes()
    {
        if (_verRes <= 1)
        {
            return;
        }

        string pathPlatVerLast = VerPath(_verRes - 1);
        string zipPath         = Config.WwwRootPath + "res/" + _platform + "/";
        string zipFile         = zipPath + _verRes + ".zip";

        List <string> listResInfoDiff = GetFileInfoDiff(_pathPlatVer + "resourcesinfo", pathPlatVerLast + "resourcesinfo");

        Dictionary <string, string> dictZipFile = new Dictionary <string, string>();

        dictZipFile.Add(_pathPlatVer + "v" + _verRes, "AssetBundle");
        foreach (string diffFile in listResInfoDiff)
        {
            string diffFile2 = _pathPlatVer + diffFile;
            dictZipFile.Add(diffFile2, diffFile);
        }

        UtilIO.CreateDir(zipPath);
        UtilZip.Zip(dictZipFile, zipFile);
    }
Example #2
0
    void Start()
    {
        _zipSrcPath  = Application.dataPath + "/Examples/Zip/Src/";
        _zipSrcFile  = Application.dataPath + "/Examples/Zip/Src.zip";
        _zipDestPath = Application.dataPath + "/Examples/Zip/Dest/";

        Dictionary <string, string> dictFile = new Dictionary <string, string>();

        DirectoryInfo dirInfo = new DirectoryInfo(_zipSrcPath);

        FileInfo[] filesInfo = dirInfo.GetFiles("*", SearchOption.AllDirectories);
        for (int i = 0; i < filesInfo.Length; i++)
        {
            var fileInfo = filesInfo[i];
            if (fileInfo.Name.EndsWith(".meta"))
            {
                continue;
            }
            Debug.Log("fileInfo.FullName: " + fileInfo.FullName);
            string relativeName = fileInfo.FullName.Substring(_zipSrcPath.Length);
            Debug.Log("relativeName:" + relativeName);
            dictFile.Add(fileInfo.FullName, relativeName);
        }

        UtilZip.Zip(dictFile, _zipSrcFile);

        UtilZip.UnZip(_zipSrcFile, _zipDestPath);
    }