private AssetBundleState.BundleInfo.TreeItem CreateFolder(AssetBundleState.BundleInfo.TreeItem p, string f)
        {
            if (f.Length == 0)
            {
                return(p);
            }

            string[] folders = f.Split('/');
            int      index   = 0;

            while (index < folders.Length)
            {
                bool found = false;
                if (p.hasChildren)
                {
                    foreach (var c in p.children)
                    {
                        if (c.displayName == folders[index])
                        {
                            p     = c as AssetBundleState.BundleInfo.TreeItem;
                            found = true;
                            break;
                        }
                    }
                }
                if (!found)
                {
                    var c = new AssetBundleState.BundleInfo.TreeItem((f + index).GetHashCode(), index, folders[index]);
                    p.AddChild(c);
                    p = c;
                }
                index++;
            }
            return(p);
        }
 private void GatherAllNodes(AssetBundleState.BundleInfo.TreeItem item, List <AssetBundleState.BundleInfo.TreeItem> res)
 {
     res.Add(item);
     if (!item.hasChildren)
     {
         return;
     }
     foreach (var c in item.children)
     {
         GatherAllNodes(c as AssetBundleState.BundleInfo.TreeItem, res);
     }
 }
        protected override TreeViewItem BuildRoot()
        {
            var root = new AssetBundleState.BundleInfo.TreeItem();

            root.children = new List <TreeViewItem>();

            foreach (var b in AssetBundleState.m_bundles)
            {
                if (b.Key.Length == 0)
                {
                    continue;
                }

                var parent = CreateFolder(root, b.Value.Folder);

                bool hasBundle = false;
                if (parent.hasChildren)
                {
                    foreach (var c in parent.children)
                    {
                        var childItem = c as AssetBundleState.BundleInfo.TreeItem;
                        if (childItem.GetPath() == b.Key)
                        {
                            childItem.bundle = b.Value;
                            hasBundle        = true;
                            break;
                        }
                    }
                }
                if (hasBundle)
                {
                    continue;
                }
                var item = new AssetBundleState.BundleInfo.TreeItem(b.Value, parent.depth + 1);
                parent.AddChild(item);
                if (b.Key == AssetBundleState.m_editBundleName)
                {
                    BeginRename(item, .25f);
                }
            }
            AssetBundleState.m_editBundleName = string.Empty;

            return(root);
        }
 private void GatherAllBundlesFromNode(AssetBundleState.BundleInfo.TreeItem item, List <AssetBundleState.BundleInfo> res)
 {
     if (item == null)
     {
         return;
     }
     if (item.bundle != null)
     {
         res.Add(item.bundle);
     }
     if (!item.hasChildren)
     {
         return;
     }
     foreach (var c in item.children)
     {
         GatherAllBundlesFromNode(c as AssetBundleState.BundleInfo.TreeItem, res);
     }
 }
        protected override TreeViewItem BuildRoot()
        {
            var root = new AssetBundleState.BundleInfo.TreeItem();

            root.children = new List <TreeViewItem>();

            foreach (var b in AssetBundleState.m_bundles)
            {
                if (b.Key.Length == 0)
                {
                    continue;
                }
                var item = new AssetBundleState.BundleInfo.TreeItem(b.Value, 0);
                root.AddChild(item);
                if (b.Key == AssetBundleState.m_editBundleName)
                {
                    BeginRename(item, .25f);
                }
            }
            AssetBundleState.m_editBundleName = string.Empty;

            return(root);
        }