/// <summary>
        /// 添加子项视图到窗口上
        /// </summary>
        /// <param name="config">子项的具体配置数据</param>
        void AddItemView(KitConfig config)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(config.DisplayedName, EditorStyles.boldLabel, GUILayout.Height(kitItemViewHeight));
            GUILayout.FlexibleSpace();

            var buttonName           = "安装";
            var isComponentInstalled = window.IsComponentInstalled(config);

            if (isComponentInstalled)
            {
                buttonName = "重新安装";
            }

            if (GUILayout.Button(buttonName, GUILayout.Width(120), GUILayout.Height(kitItemViewHeight)))
            {
                var error = window.InstallComponent(config, buttonName == "重新安装");
                AssetDatabase.Refresh();
                EditorUtility.DisplayDialog("安装组件 '" + config.DisplayedName + "' ", string.IsNullOrEmpty(error) ? "安装成功!" : "安装失败: \n" + error, "确定");
            }

            EditorGUI.BeginDisabledGroup(!isComponentInstalled);
            if (GUILayout.Button("卸载", GUILayout.Width(120), GUILayout.Height(kitItemViewHeight)))
            {
                var error = window.UninstallComponent(config);
                AssetDatabase.Refresh();
                EditorUtility.DisplayDialog("卸载组件 '" + config.DisplayedName + "' ", string.IsNullOrEmpty(error) ? "卸载成功!" : "卸载失败: \n" + error, "确定");
            }
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndHorizontal();
        }
        /// <summary>
        /// 组件是否已安装
        /// </summary>
        /// <param name="config">组件配置数据</param>
        /// <returns>返回true,表示该组件已安装;否则,组件未安装。</returns>
        bool IsComponentInstalled(KitConfig config)
        {
            var installRootDir      = System.IO.Path.Combine(windowData.KitComponentInstallRootDirectory, config.Classification);
            var componentInstallDir = System.IO.Path.Combine(installRootDir, config.DisplayedName);

            if (!System.IO.Directory.Exists(componentInstallDir))
            {
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 卸载组件
        /// </summary>
        /// <param name="config">组件配置数据</param>
        /// <returns>返回null或字符串,null表示卸载成功,字符串则表示卸载失败的描述。</returns>
        string UninstallComponent(KitConfig config)
        {
            try
            {
                DirectoryDelete(config.LocalInstallationResourceDirectory);
                foreach (var filesetting in config.FileSettings)
                {
                    if (System.IO.File.Exists(filesetting.DestPath))
                    {
                        FileDelete(filesetting.DestPath);
                    }
                    else if (System.IO.Directory.Exists(filesetting.DestPath))
                    {
                        DirectoryDelete(filesetting.DestPath);
                    }
                }
            }
            catch (System.Exception e)
            {
                return(e.Message);
            }

            return(null);
        }
        /// <summary>
        /// 窗口打开显示函数
        /// </summary>
        /// <param name="data">窗口数据</param>
        public static void Open(KitManagementEditorWindowData data)
        {
            windowData = data;

            var windowTitle = windowData.TitleString + ": " + windowData.SubTitleString;

            window         = GetWindow <KitManagementEditorMakeNewWindow>(true, windowTitle);
            window.minSize = new Vector2(800, 500);

            var tempfilePath = System.IO.Path.Combine(Application.temporaryCachePath, kitTempFileName);

            if (System.IO.File.Exists(tempfilePath))
            {
                System.IO.File.Delete(tempfilePath);
            }
            System.IO.File.WriteAllText(tempfilePath, windowTitle + "\n" + windowData.SubTitleString);

            var kit_new_config_tmpfile = System.IO.Path.Combine(Application.temporaryCachePath, kitNewConfigTempFileName);
            var parse_success          = false;

            if (System.IO.File.Exists(kit_new_config_tmpfile))
            {
                try
                {
                    var json = System.IO.File.ReadAllText(kit_new_config_tmpfile);
                    newConfig = JsonUtility.FromJson <KitConfig>(json);
                    if (!string.IsNullOrWhiteSpace(newConfig.Name))
                    {
                        kitUserInputNewConfigName = newConfig.Name;
                    }
                    if (!string.IsNullOrWhiteSpace(newConfig.Author))
                    {
                        kitUserInputNewConfigAuthor = newConfig.Author;
                    }
                    if (!string.IsNullOrWhiteSpace(newConfig.Contact))
                    {
                        kitUserInputNewConfigContact = newConfig.Contact;
                    }
                    if (!string.IsNullOrWhiteSpace(newConfig.HomePage))
                    {
                        kitUserInputNewConfigHomePage = newConfig.HomePage;
                    }
                    if (!string.IsNullOrWhiteSpace(newConfig.Version))
                    {
                        kitUserInputNewConfigVersion = newConfig.Version;
                    }
                    if (!string.IsNullOrWhiteSpace(newConfig.Description))
                    {
                        kitUserInputNewConfigDescription = newConfig.Description;
                    }
                    var dependencies = "";
                    foreach (var d in newConfig.Dependencies)
                    {
                        if (!string.IsNullOrWhiteSpace(d))
                        {
                            dependencies += d + ";";
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(dependencies))
                    {
                        kitUserInputNewConfigDependencies = dependencies;
                    }

                    parse_success = true;
                }
                catch
                {
                    Debug.LogWarning("打开新组建配置文件失败!");
                    System.IO.File.Delete(kit_new_config_tmpfile);
                }
            }

            if (!parse_success)
            {
                newConfig = new KitConfig();
                newConfig.Dependencies = new List <string>();
                newConfig.FileSettings = new List <KitConfigFileSetting>();
            }

            var kit_new_config_srcpath_tmpfile = System.IO.Path.Combine(Application.temporaryCachePath, kitNewConfigSrcPathTempFileName);

            if (System.IO.File.Exists(kit_new_config_srcpath_tmpfile))
            {
                kitUserSelectedComponentSrcPath = System.IO.File.ReadAllText(kit_new_config_srcpath_tmpfile);
            }
            var kit_new_config_class_tmpfile = System.IO.Path.Combine(Application.temporaryCachePath, kitNewConfigClassificationTempFileName);

            if (System.IO.File.Exists(kit_new_config_class_tmpfile))
            {
                kitUserSelectedComponentClassification = System.IO.File.ReadAllText(kit_new_config_class_tmpfile);
                componentClassificationEnum            = kitUserSelectedComponentClassification == kitUserSelectedComponentClassification_Basic ? ComponentClassificationEnum.Basic : ComponentClassificationEnum.Framework;
            }

            window.Show();
        }
        /// <summary>
        /// 安装组件到Unity项目中
        /// </summary>
        /// <param name="kitConfig">组件具体的配置数据</param>
        /// <returns>返回null或字符串,null表示安装成功,字符串则表示安装失败的描述。</returns>
        string InstallComponent(KitConfig config, bool isReinstall)
        {
            if (isReinstall)
            {
                var error = UninstallComponent(config);
                if (!string.IsNullOrEmpty(error))
                {
                    return(error);
                }
                AssetDatabase.Refresh();
            }

            var installRootDir      = System.IO.Path.Combine(windowData.KitComponentInstallRootDirectory, config.Classification);
            var componentInstallDir = System.IO.Path.Combine(installRootDir, config.DisplayedName);

            try
            {
                window.DirectoryCopy(config.LocalResourceDirectory, componentInstallDir, true);
                var installedConfigFilePath = System.IO.Path.Combine(componentInstallDir, windowData.KitConfigFileName);
                if (System.IO.File.Exists(installedConfigFilePath))
                {
                    System.IO.File.Delete(installedConfigFilePath);
                }
                foreach (var fileSetting in config.FileSettings)
                {
                    var fileSettingSourcePath = System.IO.Path.Combine(componentInstallDir, fileSetting.SourcePath);
                    if (System.IO.File.Exists(fileSettingSourcePath))
                    {
                        System.IO.File.Copy(fileSettingSourcePath, fileSetting.DestPath, true);
                        System.IO.File.Delete(fileSettingSourcePath);
                    }
                    else if (System.IO.Directory.Exists(fileSettingSourcePath))
                    {
                        DirectoryCopy(fileSettingSourcePath, fileSetting.DestPath, true);
                        DirectoryDelete(fileSettingSourcePath);
                    }
                }
                config.LocalInstallationResourceDirectory = componentInstallDir;
                foreach (var dependency in config.Dependencies)
                {
                    foreach (var _config in windowData.KitConfigList)
                    {
                        if (dependency == _config.Name || dependency == _config.DisplayedName)
                        {
                            if (_config.DisplayedName == config.DisplayedName)
                            {
                                continue;
                            }
                            if (!IsComponentInstalled(_config))
                            {
                                InstallComponent(_config, false);
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                return(e.Message);
            }
            return(null);
        }