Example #1
0
    private static void CompressFirstUPK()
    {
        // 版本路径
        string versionPath = GetVersionBundlePath();

        // 资源路径
        string firstUpkPath = Replace(string.Format("{0}{1}{2}", versionPath, Path.DirectorySeparatorChar, "first_upk"));

        //UPK资源路径
        string UPKPath = Replace(string.Format("{0}{1}{2}", firstUpkPath, Path.DirectorySeparatorChar, "first.upk"));

        //UPK资源路径
        string CompressUPKPah = Replace(string.Format("{0}{1}{2}", firstUpkPath, Path.DirectorySeparatorChar, "first.zupk"));

        RCompress.CompressFileLZMA(UPKPath, CompressUPKPah);

        // 替换之前文件
        if (File.Exists(UPKPath))
        {
            File.Delete(UPKPath);
        }

        File.Copy(CompressUPKPah, UPKPath);

        File.Delete(CompressUPKPah);
    }
Example #2
0
    // 压缩 streaming upk
    private static void CompressStreamingUPK()
    {
        // 资源路径
        string assetPath = Replace(string.Format("{0}{1}{2}", Application.dataPath, Path.DirectorySeparatorChar, "StreamingAssets"));

        // UPK资源路径
        string UPKPath = Replace(string.Format("{0}{1}{2}", assetPath, Path.DirectorySeparatorChar, "streaming.upk"));

        // UPK资源路径
        string CompressUPKPath = Replace(string.Format("{0}{1}{2}", assetPath, Path.DirectorySeparatorChar, "streaming.zupk"));

        RCompress.CompressFileLZMA(UPKPath, CompressUPKPath);

        //替换之前文件
        if (File.Exists(UPKPath))
        {
            File.Delete(UPKPath);
        }

        File.Copy(CompressUPKPath, UPKPath);

        File.Delete(CompressUPKPath);
    }