/// <summary>
        /// 重命名AB包
        /// </summary>
        public void RenameBundle(string name)
        {
            for (int i = 0; i < _filePaths.Count; i++)
            {
                AssetFileInfo file = AssetBundleEditorUtility.GetFileInfoByPath(_filePaths[i]);
                file.ReadDependenciesFile();
                file.Bundled = name;
                AssetImporter import = AssetImporter.GetAtPath(_filePaths[i]);
                import.assetBundleName = name;

                for (int j = 0; j < file.Dependencies.Count; j++)
                {
                    AssetFileInfo depenFile = AssetBundleEditorUtility.GetFileInfoByPath(file.Dependencies[j]);
                    if (depenFile.IndirectBundled.ContainsKey(Name))
                    {
                        int number = depenFile.IndirectBundled[Name];
                        depenFile.IndirectBundled.Remove(Name);
                        depenFile.IndirectBundled.Add(name, number);
                    }
                    if (depenFile.IndirectBundledRelation.ContainsKey(_filePaths[i]))
                    {
                        depenFile.IndirectBundledRelation[_filePaths[i]] = name;
                    }
                }
            }

            AssetDatabase.RemoveAssetBundleName(Name, true);
            Name = name;
        }
        /// <summary>
        /// 添加资源到AB包中
        /// </summary>
        public void AddAsset(string filePath)
        {
            AssetFileInfo file = AssetBundleEditorUtility.GetFileInfoByPath(filePath);

            if (file.Bundled != Name)
            {
                file.Bundled = Name;
                MemorySize  += file.MemorySize;
                file.ReadDependenciesFile();
                file.UpdateRedundantState();
                _filePaths.Add(filePath);

                for (int i = 0; i < file.Dependencies.Count; i++)
                {
                    AssetFileInfo depenFile = AssetBundleEditorUtility.GetFileInfoByPath(file.Dependencies[i]);
                    if (depenFile.IsValid)
                    {
                        if (!depenFile.IndirectBundled.ContainsKey(Name))
                        {
                            depenFile.IndirectBundled.Add(Name, 0);
                            MemorySize += depenFile.MemorySize;
                        }
                        depenFile.IndirectBundled[Name] = depenFile.IndirectBundled[Name] + 1;
                        if (!depenFile.IndirectBundledRelation.ContainsKey(filePath))
                        {
                            depenFile.IndirectBundledRelation.Add(filePath, Name);
                        }
                        depenFile.UpdateRedundantState();
                    }
                }
                MemorySizeFormat = EditorUtility.FormatBytes(MemorySize);
            }

            AssetImporter import = AssetImporter.GetAtPath(filePath);

            import.assetBundleName = Name;
        }
        /// <summary>
        /// 从AB包中移除资源
        /// </summary>
        public void RemoveAsset(string filePath)
        {
            AssetFileInfo file = AssetBundleEditorUtility.GetFileInfoByPath(filePath);

            if (file.Bundled == Name)
            {
                file.Bundled = "";
                MemorySize  -= file.MemorySize;
                file.ReadDependenciesFile();
                file.UpdateRedundantState();
                _filePaths.Remove(filePath);

                for (int i = 0; i < file.Dependencies.Count; i++)
                {
                    AssetFileInfo depenFile = AssetBundleEditorUtility.GetFileInfoByPath(file.Dependencies[i]);
                    if (depenFile.IndirectBundled.ContainsKey(Name))
                    {
                        depenFile.IndirectBundled[Name] = depenFile.IndirectBundled[Name] - 1;
                        if (depenFile.IndirectBundled[Name] <= 0)
                        {
                            depenFile.IndirectBundled.Remove(Name);
                            MemorySize -= depenFile.MemorySize;
                        }
                    }
                    if (depenFile.IndirectBundledRelation.ContainsKey(filePath))
                    {
                        depenFile.IndirectBundledRelation.Remove(filePath);
                    }
                    depenFile.UpdateRedundantState();
                }
                MemorySizeFormat = EditorUtility.FormatBytes(MemorySize);
            }

            AssetImporter import = AssetImporter.GetAtPath(filePath);

            import.assetBundleName = "";
        }
        private void AssetPropertyGUI()
        {
            if (_currentFile != null)
            {
                _currentFile.ReadDependenciesFile();

                GUI.color = (_currentFile.IsRedundant ? Color.red : Color.white);

                _assetPropertyViewRect   = new Rect((int)position.width - 420, 50, 400, 400);
                _assetPropertyScrollRect = new Rect((int)position.width - 420, 50, 400, _assetPropertyViewHeight);
                _assetPropertyScroll     = GUI.BeginScrollView(_assetPropertyViewRect, _assetPropertyScroll, _assetPropertyScrollRect);
                GUI.BeginGroup(_assetPropertyScrollRect, _helpBox);

                _assetPropertyViewHeight = 5;

                GUIContent content = EditorGUIUtility.ObjectContent(null, _currentFile.AssetType);
                content.text = _currentFile.Name;
                GUI.Label(new Rect(5, _assetPropertyViewHeight, 40, 15), "Asset:");
                if (GUI.Button(new Rect(50, _assetPropertyViewHeight, 280, 15), content, _prefabLabel))
                {
                    Selection.activeObject = _currentFile.AssetObject;
                    EditorGUIUtility.PingObject(_currentFile.AssetObject);
                }
                GUI.enabled = (_currentAB != null && _currentFile.Bundled == "");
                if (GUI.Button(new Rect(340, _assetPropertyViewHeight, 50, 15), "Bundle", _preButton))
                {
                    _currentAB.AddAsset(_currentFile.AssetPath);
                    _currentFile = null;
                    return;
                }
                GUI.enabled = true;
                _assetPropertyViewHeight += 20;

                GUI.Label(new Rect(5, _assetPropertyViewHeight, 330, 15), "Path: " + _currentFile.AssetPath);
                if (GUI.Button(new Rect(340, _assetPropertyViewHeight, 50, 15), "Copy", _preButton))
                {
                    GUIUtility.systemCopyBuffer = _currentFile.AssetPath;
                }
                _assetPropertyViewHeight += 20;

                if (_currentFile.Dependencies.Count > 0)
                {
                    _isShowDependencies       = EditorGUI.Foldout(new Rect(5, _assetPropertyViewHeight, 390, 15), _isShowDependencies, "Dependencies:", true);
                    _assetPropertyViewHeight += 20;
                    if (_isShowDependencies)
                    {
                        for (int i = 0; i < _currentFile.Dependencies.Count; i++)
                        {
                            AssetFileInfo file = AssetBundleEditorUtility.GetFileInfoByPath(_currentFile.Dependencies[i]);
                            content      = EditorGUIUtility.ObjectContent(null, file.AssetType);
                            content.text = file.Name;
                            if (GUI.Button(new Rect(45, _assetPropertyViewHeight, 350, 15), content, _prefabLabel))
                            {
                                Selection.activeObject = file.AssetObject;
                                EditorGUIUtility.PingObject(file.AssetObject);
                            }
                            _assetPropertyViewHeight += 20;
                        }
                    }
                }

                if (_currentFile.IndirectBundledRelation.Count > 0)
                {
                    _isShowIndirectBundled    = EditorGUI.Foldout(new Rect(5, _assetPropertyViewHeight, 390, 15), _isShowIndirectBundled, "Indirect Bundled:", true);
                    _assetPropertyViewHeight += 20;
                    if (_isShowIndirectBundled)
                    {
                        foreach (KeyValuePair <string, string> bundle in _currentFile.IndirectBundledRelation)
                        {
                            AssetFileInfo file = AssetBundleEditorUtility.GetFileInfoByPath(bundle.Key);
                            content      = EditorGUIUtility.ObjectContent(null, file.AssetType);
                            content.text = file.Name + "  >>  " + bundle.Value;
                            if (GUI.Button(new Rect(45, _assetPropertyViewHeight, 350, 15), content, _prefabLabel))
                            {
                                Selection.activeObject = file.AssetObject;
                                EditorGUIUtility.PingObject(file.AssetObject);
                            }
                            _assetPropertyViewHeight += 20;
                        }
                    }
                }

                _assetPropertyViewHeight += 5;
                if (_assetPropertyViewHeight < _assetPropertyViewRect.height)
                {
                    _assetPropertyViewHeight = (int)_assetPropertyViewRect.height;
                }

                GUI.EndGroup();
                GUI.EndScrollView();

                GUI.color = Color.white;
            }
        }