Exemplo n.º 1
0
    /// <summary>
    /// 压缩修改部分
    /// </summary>
    public static void CompressDiff()
    {
        if (!File.Exists(GetOldHashPath()))
        {
            Debug.LogError("无法找到上次打包hash文件,无法差异压缩,已转为全部压缩");
            CompressAll();
            return;
        }
        //压缩差异资源
        List <string> diffList = GetDiffHashList(GetOldHashPath(), GetNewHashPath());
        string        command  = "a -tzip " + AssetBundleLoad.ZipName + " -aoa";

        foreach (var item in diffList)
        {
            command += " ";
            //记得用引号啊,被坑了,有的美术资源带空格
            command += ("\"" + item + "\"");
        }
        EditorTools.RunCommand("7z", command, AssetBundleLoad.GetAbParentPath());

        //从压缩包中删除已经没有的文件
        command = "d " + AssetBundleLoad.ZipName;
        List <string> deleteList = GetZipDeleteList(GetOldHashPath(), GetNewHashPath());

        foreach (var item in deleteList)
        {
            command += " ";
            command += ("\"" + item + "\"");
        }
        EditorTools.RunCommand("7z", command, AssetBundleLoad.GetAbParentPath());
        Debug.Log("差异压缩完成");
    }
Exemplo n.º 2
0
    /// <summary>
    /// 全部压缩
    /// </summary>
    public static void CompressAll()
    {
        string command =
            "a -tzip " + AssetBundleLoad.ZipName + " -aoa "
            + AssetBundleLoad.FolderName + "/" + AssetBundleLoad.FolderName + " "
            + AssetBundleLoad.FolderName + "/*.ab -r";

        //EditorTools.RunCommand(@"D:\7z\7-Zip\7z.exe", command, AssetBundleLoad.GetAbParentPath(), true);
        EditorTools.RunCommand("7z", command, AssetBundleLoad.GetAbParentPath(), true);
    }
Exemplo n.º 3
0
    /// <summary>
    /// 比较hash文件,把差异单独压缩
    /// </summary>
    public static void CompressForHotfix(bool isUpdateHash)
    {
        List <string> diffList = GetDiffHashList(isUpdateHash ? GetRemoteHashPath() : GetOldHashPath(), GetNewHashPath());

        EditorTools.RunCommand("7z", @"d " + GetHotfixZipPath(), AssetBundleLoad.GetAbParentPath());
        string command = @"a -tzip " + hotfixZipName;

        for (int i = 0; i < diffList.Count; i++)
        {
            command += " ";
            command += ("\"" + diffList[i] + "\"");
        }
        EditorTools.RunCommand("7z", command, AssetBundleLoad.GetAbParentPath());
        Debug.Log("热更压缩完成");
    }
Exemplo n.º 4
0
 public static string GetVersionPath()
 {
     return(AssetBundleLoad.GetAbParentPath() + versionName);
 }
Exemplo n.º 5
0
 public static string GetHotfixZipPath()
 {
     return(AssetBundleLoad.GetAbParentPath() + hotfixZipName);
 }
Exemplo n.º 6
0
 public static string GetRemoteHashPath()
 {
     return(AssetBundleLoad.GetAbParentPath() + remoteHashName);
 }
Exemplo n.º 7
0
 public static string GetOldHashPath()
 {
     return(AssetBundleLoad.GetAbParentPath() + oldHashName);
 }