// Token: 0x06000006 RID: 6 RVA: 0x000021D8 File Offset: 0x000003D8
        public static AssetBundleManifest2 Load(string path)
        {
            if (!File.Exists(path))
            {
                return(new AssetBundleManifest2());
            }
            string[]             array = File.ReadAllLines(path);
            AssetBundleManifest2 assetBundleManifest = new AssetBundleManifest2();

            assetBundleManifest.Name   = Path.GetFileNameWithoutExtension(path);
            assetBundleManifest.Path   = path;
            assetBundleManifest.Assets = new List <string>(array.Length);
            AssetBundleManifestParser.Category category = AssetBundleManifestParser.Category.None;
            for (int i = 0; i < array.Length; i++)
            {
                string text = array[i].Trim();
                if (!string.IsNullOrEmpty(text))
                {
                    if (text.StartsWith("Assets:", StringComparison.OrdinalIgnoreCase))
                    {
                        category = AssetBundleManifestParser.Category.Assets;
                    }
                    else if (text.StartsWith("ClassTypes:", StringComparison.OrdinalIgnoreCase))
                    {
                        category = AssetBundleManifestParser.Category.ClassTypes;
                    }
                    else if (text.StartsWith("Dependencies:", StringComparison.OrdinalIgnoreCase))
                    {
                        category = AssetBundleManifestParser.Category.Dependencies;
                    }
                    else if (text.StartsWith("AssetBundleInfos:", StringComparison.OrdinalIgnoreCase))
                    {
                        category = AssetBundleManifestParser.Category.AssetBundleInfos;
                    }
                    else
                    {
                        switch (category)
                        {
                        case AssetBundleManifestParser.Category.Assets:
                            AssetBundleManifestParser.ReadAssets(array, ref i, assetBundleManifest);
                            break;

                        case AssetBundleManifestParser.Category.Dependencies:
                            assetBundleManifest.Dependencies.Add(text);
                            break;

                        case AssetBundleManifestParser.Category.AssetBundleInfos:
                            AssetBundleManifestParser.ReadAssetBundleInfos(array, ref i, assetBundleManifest);
                            break;
                        }
                    }
                }
            }
            return(assetBundleManifest);
        }
Exemplo n.º 2
0
        // Token: 0x06000015 RID: 21 RVA: 0x0000275C File Offset: 0x0000095C
        private void OnListboxSelectionChanged(GUIListView sender)
        {
            List <AssetBundleManifest2> list = new List <AssetBundleManifest2>();

            if (sender.SelectedItemsCount > 0)
            {
                foreach (object obj in sender.SelectedItems)
                {
                    AssetBundleManifestUI.Listbox.Model model = obj as AssetBundleManifestUI.Listbox.Model;
                    if (model == null || string.IsNullOrEmpty(model.Name))
                    {
                        return;
                    }
                    string path = string.Format("{0}/{1}.manifest", this.Directory, model.Name);
                    AssetBundleManifest2 item = AssetBundleManifestParser.Load(path);
                    list.Add(item);
                }
            }
            this._dependencyListbox.Clear();
            this._dependencyListbox.EmptyText = "The list is empty.";
            if (list.Count == 1)
            {
                this._dependencyListbox.EmptyText = string.Format("'{0}' has no AssetBundle dependencies.", list[0].Name);
                AssetBundleManifest2 assetBundleManifest = list[0];
                List <string>        list2 = new List <string>();
                foreach (string str in assetBundleManifest.Dependencies)
                {
                    string item2 = Path.Combine(Path.GetDirectoryName(assetBundleManifest.Path), str + ".manifest").Replace('\\', '/');
                    list2.Add(item2);
                }
                this._dependencyListbox.SetItems(list2);
            }
            else if (list.Count > 1)
            {
                this._dependencyListbox.EmptyText = "Select only one bundle to display dependencies.";
            }
            if (this.SelectionChange != null)
            {
                Action <List <AssetBundleManifest2> > selectionChange = this.SelectionChange;
                selectionChange(list);
            }
        }