示例#1
0
 public VFSEditorGroup(VFSGroupOption option) : base(option)
 {
 }
示例#2
0
        /// <summary>
        /// 配置规范化
        /// </summary>
        /// <param name="config"></param>
        public static void NormalizationConfig(IVFSConfig config)
        {
            if (config == null)
            {
                return;
            }
            //全局配置

            //后缀名配置 补全缺失的“框架内部定义的必须存在的”配置项
            #region 全局 后缀名 内部配置项
            if (config.PGlobalVFS_Ignore_ExtName == null)
            {
                config.PGlobalVFS_Ignore_ExtName = new string[0];
            }
            List <string> ext_list = new List <string>();
            foreach (var item in TinaX.VFSKitInternal.InternalVFSConfig.GlobalIgnoreExtName)
            {
                if (!config.PGlobalVFS_Ignore_ExtName.Contains(item))
                {
                    ext_list.Add(item);
                }
            }
            if (ext_list.Count > 0)
            {
                config.PGlobalVFS_Ignore_ExtName = ArrayUtil.Combine(config.PGlobalVFS_Ignore_ExtName, ext_list.ToArray());
            }
            #endregion

            //后缀名配置必须要以点开头,并小写
            #region 全局 后缀名 格式规范
            if (config.PGlobalVFS_Ignore_ExtName != null && config.PGlobalVFS_Ignore_ExtName.Length > 0)
            {
                for (var i = 0; i < config.PGlobalVFS_Ignore_ExtName.Length; i++)
                {
                    if (!config.PGlobalVFS_Ignore_ExtName[i].StartsWith("."))
                    {
                        config.PGlobalVFS_Ignore_ExtName[i] = "." + config.PGlobalVFS_Ignore_ExtName[i];
                    }

                    config.PGlobalVFS_Ignore_ExtName[i] = config.PGlobalVFS_Ignore_ExtName[i].ToLower();
                }
            }
            #endregion

            //后缀名配置 重复项
            #region 全局 后缀名 重复项
            if (config.PGlobalVFS_Ignore_ExtName != null && config.PGlobalVFS_Ignore_ExtName.Length > 0)
            {
                List <string> list = new List <string>(config.PGlobalVFS_Ignore_ExtName).Distinct().ToList();
                if (list.Count != config.PGlobalVFS_Ignore_ExtName.Length)
                {
                    config.PGlobalVFS_Ignore_ExtName = list.ToArray();
                }
            }
            #endregion


            #region 全局 忽略 路径 item

            //补全内部设定
            if (config.PGlobalVFS_Ignore_Path_Item == null)
            {
                config.PGlobalVFS_Ignore_Path_Item = new string[0];
            }
            List <string> tmp_path_item_list = new List <string>(config.PGlobalVFS_Ignore_Path_Item);
            foreach (var item in TinaX.VFSKitInternal.InternalVFSConfig.GlobalIgnorePathItem)
            {
                if (!tmp_path_item_list.Contains(item))
                {
                    tmp_path_item_list.Add(item);
                }
            }
            List <string> temp_2 = new List <string>();
            //查重和空白项目
            for (int i = tmp_path_item_list.Count - 1; i >= 0; i--)
            {
                if (!tmp_path_item_list[i].IsNullOrEmpty())
                {
                    if (!temp_2.Any(item => item.ToLower() == tmp_path_item_list[i].ToLower()))
                    {
                        temp_2.Add(tmp_path_item_list[i]);
                    }
                }
            }

            config.PGlobalVFS_Ignore_Path_Item = temp_2.ToArray();


            #endregion

            #region 全局 Assetbundle细节
            if (config.PAssetBundleFileExtension.IsNullOrEmpty() || config.PAssetBundleFileExtension.IsNullOrWhiteSpace())
            {
                config.PAssetBundleFileExtension = InternalVFSConfig.default_AssetBundle_ExtName;
            }

            if (!config.PAssetBundleFileExtension.StartsWith("."))
            {
                config.PAssetBundleFileExtension = "." + config.PAssetBundleFileExtension;
            }
            config.PAssetBundleFileExtension = config.PAssetBundleFileExtension.ToLower();

            #endregion

            #region WebVFS
            if (config.PDefaultWebVFSBaseUrl.IsNullOrEmpty() || config.PDefaultWebVFSBaseUrl.IsNullOrWhiteSpace())
            {
                config.PDefaultWebVFSBaseUrl = VFSKit.VFSKit.DefaultDownloadWebAssetUrl;
            }
            if (!config.PDefaultWebVFSBaseUrl.EndsWith("/"))
            {
                config.PDefaultWebVFSBaseUrl += "/";
            }
            #endregion


            #region 至少包含一个Group
            if (config.PGroups == null || config.PGroups.Length == 0)
            {
                config.PGroups = new VFSGroupOption[] { VFSGroupOption.New() };
            }
            #endregion
        }