Exemple #1
0
    void MergeFromPatch(string from, string to, string patchs)
    {
        List <string>             files   = new List <string>();
        Dictionary <string, bool> abdicts = new Dictionary <string, bool>();

        SelectionTools.ParseSelectionHandler handler = delegate(string file, string ext)
        {
            if (ext == "patch")
            {
                files.Add(file);
            }
            abdicts[SelectionTools.SpliteFilePath(file)] = true;
        };
        SelectionTools.GetSelectionFileList(patchs, handler, "正在遍历补丁文件列表");

        int count = files.Count;

        AssetBundleParser.MergeProgress progress = delegate(string bundlename, int index, int size)
        {
            EditorUtility.DisplayProgressBar("正在应用补丁", bundlename, (float)index / size);
        };

        for (int index = 0; index < count; index++)
        {
            string patchfile = files[index];
            AssetBundleParser.assetbundle_merge(patchfile, from, to, progress);
        }
        EditorUtility.ClearProgressBar();
    }
Exemple #2
0
    static void CompareAndBuildPatch(string from, string to, string patchs)
    {
        Dictionary <string, bool> abdicts = new Dictionary <string, bool>();

        SelectionTools.ParseSelectionHandler handler = delegate(string file, string ext)
        {
            if (AssetBundleParser.assetbundle_check(file))
            {
                abdicts[SelectionTools.SpliteFileNameWithExt(file)] = true;
            }
        };
        SelectionTools.GetSelectionFileList(from, handler, "读取之前版本AssetBundle文件列表");
        SelectionTools.GetSelectionFileList(to, handler, "读取新版本AssetBundle文件列表");

        SelectionTools.ParseSelectionHandler handler1 = delegate(string file, string ext)
        {
            File.Delete(file);
        };
        SelectionTools.GetSelectionFileList(patchs, handler1, "清理旧补丁文件");

        int index = 0;
        int count = abdicts.Count;

        System.IntPtr ctx = AssetBundleParser.assetbundle_diff_init(string.Format("{0}/bundle.patch", patchs));
        Dictionary <string, bool> .Enumerator em = abdicts.GetEnumerator();
        while (em.MoveNext())
        {
            string bundlename = em.Current.Key;
            EditorUtility.DisplayProgressBar("正在生成补丁", bundlename, (float)index++ / count);
            AssetBundleParser.assetbundle_diff_update(ctx, string.Format("{0}/{1}", from, bundlename), string.Format("{0}/{1}", to, bundlename), bundlename);
        }
        AssetBundleParser.assetbundle_diff_final(ctx);
        EditorUtility.ClearProgressBar();
    }
Exemple #3
0
    public static void AsignBatch(string path)
    {
        List <string> files = new List <string>();

        SelectionTools.ParseSelectionHandler handler = delegate(string file, string ext)
        {
            if (ext != "manifest")
            {
                files.Add(file);
            }
        };
        SelectionTools.GetSelectionFileList(path, handler);

        int count = files.Count;

        for (int index = 0; index < count; index++)
        {
            string file = files[index];
            EditorUtility.DisplayProgressBar("正在更新签名", file, (float)index / count);
            if (AssetBundleParser.assetbundle_sign(file) == false)
            {
                Debug.LogFormat("{0}更新签名失败。", file);
            }
        }
        EditorUtility.ClearProgressBar();
    }
Exemple #4
0
 private void OnEnable()
 {
     AssetBundleParser.set_messagehandler(delegate(string message)
     {
         Debug.LogWarning(message);
     });
 }
Exemple #5
0
 private void OnDisable()
 {
     AssetBundleParser.set_messagehandler(null);
 }