internal static bool HandleBundleRename(BundleTreeItem item, string newName)
        {
            var originalName = new BundleNameData(item.bundle.m_Name.fullNativeName);

            var findDot    = newName.LastIndexOf('.');
            var findSlash  = newName.LastIndexOf('/');
            var findBSlash = newName.LastIndexOf('\\');

            if (findDot == 0 || findSlash == 0 || findBSlash == 0)
            {
                return(false); //can't start a bundle with a / or .
            }
            bool result = item.bundle.HandleRename(newName, 0);

            if (findDot > 0 || findSlash > 0 || findBSlash > 0)
            {
                item.bundle.parent.HandleChildRename(newName, string.Empty);
            }

            ExecuteAssetMove();

            var node = FindBundle(originalName);

            if (node != null)
            {
                var message = "Failed to rename bundle named: ";
                message += originalName.fullNativeName;
                message += ".  Most likely this is due to the bundle being assigned to a folder in your Assets directory, AND that folder is either empty or only contains assets that are explicitly assigned elsewhere.";
                Debug.LogError(message);
            }

            return(result);
        }
 internal override BundleTreeItem CreateTreeView(int depth)
 {
     RefreshMessages();
     var result = new BundleTreeItem(this, depth, Model.GetFolderIcon());
     foreach (var child in m_Children)
     {
         result.AddChild(child.Value.CreateTreeView(depth + 1));
     }
     return result;
 }
            internal DragAndDropData(DragAndDropArgs a)
            {
                args         = a;
                draggedNodes = DragAndDrop.GetGenericData("AssetBundleModel.BundleInfo") as List <BundleInfo>;
                targetNode   = args.parentItem as BundleTreeItem;
                paths        = DragAndDrop.paths;

                if (draggedNodes != null)
                {
                    foreach (var bundle in draggedNodes)
                    {
                        if ((bundle as BundleFolderInfo) != null)
                        {
                            hasBundleFolder = true;
                        }
                        else
                        {
                            var dataBundle = bundle as BundleDataInfo;
                            if (dataBundle != null)
                            {
                                if (dataBundle.isSceneBundle)
                                {
                                    hasScene = true;
                                }
                                else
                                {
                                    hasNonScene = true;
                                }

                                if ((dataBundle as BundleVariantDataInfo) != null)
                                {
                                    hasVariantChild = true;
                                }
                            }
                        }
                    }
                }
                else if (paths != null)
                {
                    foreach (var assetPath in paths)
                    {
                        if (AssetDatabase.GetMainAssetTypeAtPath(assetPath) == typeof(SceneAsset))
                        {
                            hasScene = true;
                        }
                        else
                        {
                            hasNonScene = true;
                        }
                    }
                }
            }
        protected override void RenameEnded(RenameEndedArgs args)
        {
            base.RenameEnded(args);
            if (args.newName.Length > 0 && args.newName != args.originalName)
            {
                args.acceptedRename = true;

                AssetBundleModel.BundleTreeItem renamedItem = FindItem(args.itemID, rootItem) as AssetBundleModel.BundleTreeItem;
                args.acceptedRename = AssetBundleModel.Model.HandleBundleRename(renamedItem, args.newName);
                ReloadAndSelect(renamedItem.bundle.nameHashCode, false);
            }
            else
            {
                args.acceptedRename = false;
            }
        }
        internal override BundleTreeItem CreateTreeView(int depth)
        {
            RefreshMessages();
            Texture2D icon = null;
            if ((m_Children.Count > 0) &&
                ((m_Children.First().Value as BundleVariantDataInfo).IsSceneVariant()))
            {
                icon = Model.GetSceneIcon();
            }
            else
                icon = Model.GetBundleIcon();

            var result = new BundleTreeItem(this, depth, icon);
            foreach (var child in m_Children)
            {
                result.AddChild(child.Value.CreateTreeView(depth + 1));
            }
            return result;
        }