public object SerializeAndDeserialize <T>(T data)
        {
            var csv = CsvSerializer.SerializeToString(data);

            csv.Print();

            var dto = CsvSerializer.DeserializeFromString <T>(csv);

            AssertEqual(dto, data);

            using (var reader = new StringReader(csv))
            {
                dto = CsvSerializer.DeserializeFromReader <T>(reader);
                AssertEqual(dto, data);
            }

            using (var ms = new MemoryStream(csv.ToUtf8Bytes()))
            {
                dto = CsvSerializer.DeserializeFromStream <T>(ms);
                AssertEqual(dto, data);
            }

            using (var ms = new MemoryStream(csv.ToUtf8Bytes()))
            {
                dto = (T)CsvSerializer.DeserializeFromStream(typeof(T), ms);
                AssertEqual(dto, data);
            }

            return(dto);
        }
示例#2
0
        /// <summary>
        /// 加载服务器Asset.Info
        /// </summary>
        /// <returns></returns>
        async private Task <Tuple <string, List <AssetItem>, string> > DownloadAssetsInfo(string serverAssetInfosUrl)
        {
            var err = "";
            var serverAssetsInfoList = new List <AssetItem>();
            var serverlAssetsContent = "";

            //开始下载
            for (int i = 0; i < RETRY_COUNT; i++)
            {
                try
                {
                    serverlAssetsContent = await webClient.DownloadStringTaskAsync(serverAssetInfosUrl);

                    serverAssetsInfoList = CsvSerializer.DeserializeFromString <List <AssetItem> >(serverlAssetsContent);
                    err = null;
                    break;
                }
                catch (Exception e)
                {
                    err = e.Message;
                    BDebug.LogError(err);
                }
            }

            return(new Tuple <string, List <AssetItem>, string>(err, serverAssetsInfoList, serverlAssetsContent));
        }
        public static T DeserializeCsv <T>(this string data)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return(default(T));
            }

            var result = CsvSerializer.DeserializeFromString <T>(data);

            return(RestoreItem(result));
        }
示例#4
0
        public override List <UIElement> Read()
        {
            StreamReader fs        = new StreamReader(PathToFile);
            string       csvString = fs.ReadToEnd();

            fs.Dispose();

            List <Figure> figures = CsvSerializer.DeserializeFromString <List <Figure> >(csvString);

            return(CreateControlList(figures));
        }
        public static object DeserializeCsv(this string data, Type type)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return(null);
            }

            var result = CsvSerializer.DeserializeFromString(type, data);

            return(RestoreItem(result));
        }
        public static object DeserializeCsv(this byte[] data, Type type)
        {
            if (data == null || data.Length == 0)
            {
                return(null);
            }

            var json   = data?.DecompressText();
            var result = CsvSerializer.DeserializeFromString(type, json);

            return(RestoreItem(result));
        }
示例#7
0
        /// <summary>
        /// 加载本地的Asset.info
        /// </summary>
        private List <AssetItem> LoadLocalAssetInfo(RuntimePlatform platform)
        {
            var retList = new List <AssetItem>();
            //优先加载persistent的Assets.info
            var persistentAssetInfoPath = BResources.GetAssetsInfoPath(BApplication.persistentDataPath, platform);

            if (File.Exists(persistentAssetInfoPath))
            {
                var content = File.ReadAllText(persistentAssetInfoPath);
                retList = CsvSerializer.DeserializeFromString <List <AssetItem> >(content);
            }
            //streaming 和其他的Assets.info
            else
            {
                //根据加载模式不同,寻找不同目录下的其他配置
                //打包时,本地会带一份ServerAssets.info以标记当前包携带的资源
                var loadArtRoot = BDLauncher.Inst.GameConfig.ArtRoot;
                switch (loadArtRoot)
                {
                case AssetLoadPathType.Persistent:
                case AssetLoadPathType.StreamingAsset:
                {
                    //TODO :BSA 读取,不需要Streaming前缀
                    var steamingAssetsInfoPath = IPath.Combine(BApplication.GetPlatformPath(platform), BResources.ASSETS_INFO_PATH);
                    //var steamingAssetsInfoPath = GetAssetsInfoPath(BDApplication.streamingAssetsPath, platform);
                    if (BetterStreamingAssets.FileExists(steamingAssetsInfoPath))
                    {
                        var content = BetterStreamingAssets.ReadAllText(steamingAssetsInfoPath);
                        retList = CsvSerializer.DeserializeFromString <List <AssetItem> >(content);
                    }
                }
                break;

                case AssetLoadPathType.DevOpsPublish:
                {
                    var path = GameConfig.GetLoadPath(loadArtRoot);
                    var devopsAssetInfoPath = BResources.GetAssetsInfoPath(path, platform);
                    if (File.Exists(devopsAssetInfoPath))
                    {
                        var content = File.ReadAllText(devopsAssetInfoPath);
                        retList = CsvSerializer.DeserializeFromString <List <AssetItem> >(content);
                    }
                }
                break;
                }
            }

            return(retList);
        }
        public override List <Control> Read()
        {
            StreamReader fs        = new StreamReader(PathToFile);
            string       csvString = fs.ReadToEnd();

            fs.Dispose();

            string[]                     figures    = csvString.Split('^');
            List <FigureLine>            lines      = CsvSerializer.DeserializeFromString <List <FigureLine> >(figures[0]);
            List <FigureEllipse>         ellipses   = CsvSerializer.DeserializeFromString <List <FigureEllipse> >(figures[1]);
            List <FigureRectangle>       rects      = CsvSerializer.DeserializeFromString <List <FigureRectangle> >(figures[2]);
            List <FigureCurvedRectangle> cRects     = CsvSerializer.DeserializeFromString <List <FigureCurvedRectangle> >(figures[3]);
            List <FigureMultiline>       multilines = CsvSerializer.DeserializeFromString <List <FigureMultiline> >(figures[4]);

            return(CreateControlList(lines, ellipses, rects, cRects, multilines));
        }
        public void LoadFromCSV(string filename)
        {
            string tmp;

            Clear();
            using (Stream fStream = File.OpenRead(filename))
            {
                StreamReader sr = new StreamReader(fStream);
                sr.ReadLine();
                while (!sr.EndOfStream)
                {
                    tmp = sr.ReadLine();
                    Console.WriteLine(tmp);
                    Add(CsvSerializer.DeserializeFromString <T>(tmp));
                }
            }
        }
示例#10
0
        public List <Figure> Open()
        {
            if (File.Exists(path) == false)
            {
                FileStream fs = File.Create(path);
                fs.Close();
            }
            string csvString = File.ReadAllText(path);
            List <FigureMemento> mFigures = new List <FigureMemento>();

            if (csvString.Length != 0)
            {
                mFigures = CsvSerializer.DeserializeFromString <List <FigureMemento> >(csvString);
            }

            return(FigureSerializer.GetFiguresList(mFigures));
        }
示例#11
0
        /// <summary>
        /// 加载SubPacakge的AssetInfo
        /// </summary>
        /// <param name="platform"></param>
        /// <returns></returns>
        private List <AssetItem> LoadLocalSubPacakgeAssetInfo(RuntimePlatform platform, AssetsVersionInfo localVersionInfo)
        {
            var retList = new List <AssetItem>();

            foreach (var kv in localVersionInfo.SubPckMap)
            {
                var subPackageInfoPath = BResources.GetAssetsSubPackageInfoPath(BApplication.persistentDataPath, platform, kv.Key);
                if (File.Exists(subPackageInfoPath))
                {
                    var content    = File.ReadAllText(subPackageInfoPath);
                    var assetItems = CsvSerializer.DeserializeFromString <List <AssetItem> >(content);
                    retList.AddRange(assetItems);
                }
            }


            return(retList);
        }
        protected override List <Person> Load()
        {
            if (File.Exists(path) == false)
            {
                FileStream fs = File.Create(path);
                fs.Close();
            }
            string        csvString = File.ReadAllText(path);
            List <Person> persons   = new List <Person>();

            if (csvString.Length == 0)
            {
                persons = new List <Person>();
            }
            else
            {
                persons = CsvSerializer.DeserializeFromString <List <Person> >(csvString);
            }
            return(persons);
        }
示例#13
0
        async public Task <bool> IsUpdateAvaliable()
        {
            try
            {
                //check if its in the buffer
                OpenArchive gtfsArchive = GetArchiveFromBuffer(this.archiveFileName);
                if (gtfsArchive == null)
                {
                    string     completePath = this.fileMgr.FilePathRoot + this.archiveFileName;
                    ZipArchive zipFile      = this.fileMgr.GetZipFile(this.archiveFileName);
                    gtfsArchive = new OpenArchive(completePath, zipFile);
                    this.bufferedArchives.Add(gtfsArchive);
                }

                //done by checking if the feed version number is different
                List <FeedInfo> feedInfos = null;
                using (Stream infoStream = gtfsArchive.zip.GetEntry("google_transit/feed_info.csv").Open())
                {
                    feedInfos = CsvSerializer.DeserializeFromStream <List <FeedInfo> >(infoStream);
                }

                FeedInfo feedInfo     = feedInfos.First();
                int      localVersion = feedInfo.feed_version;

                //compare this local version with the online version
                byte[] feedFile = await DownloadFile(this.FeedInfoUrl);

                string          feedString      = Encoding.UTF8.GetString(feedFile);
                List <FeedInfo> onlineFeedInfos = CsvSerializer.DeserializeFromString <List <FeedInfo> >(feedString);
                FeedInfo        onlineFeedInfo  = onlineFeedInfos.First();
                int             onlineVersion   = onlineFeedInfo.feed_version;

                return(onlineVersion != localVersion);
            }
            catch
            {
                //failed somewhere with reading local file
                //return true so caller will update local version
                return(true);
            }
        }
        public void Can_deserialize_partial_custom_headers_map()
        {
            CsvConfig <TableItem> .CustomHeadersMap = new Dictionary <string, string> {
                { "Column1Data", "Column 1" },
                { "Column3Data", "Column,3" },
                { "Column5Data", "Column 5" },
            };

            var csv = "Column 1,\"Column,3\",Column 5\r\n"
                      + "I,To,Novels\r\n"
                      + "I am,Cool,Awesome\r\n";

            var data = CsvSerializer.DeserializeFromString <List <TableItem> >(csv);

            Assert.That(data[0].Column1Data, Is.EqualTo("I"));
            Assert.That(data[0].Column3Data, Is.EqualTo("To"));
            Assert.That(data[0].Column5Data, Is.EqualTo("Novels"));

            Assert.That(data[1].Column1Data, Is.EqualTo("I am"));
            Assert.That(data[1].Column3Data, Is.EqualTo("Cool"));
            Assert.That(data[1].Column5Data, Is.EqualTo("Awesome"));
        }
示例#15
0
 public static T FromCsv <T>(this string csv) => CsvSerializer.DeserializeFromString <T>(csv);
        /// <summary>
        /// 文件转hash
        /// </summary>
        /// <param name="outputRootPath"></param>
        /// <param name="platform"></param>
        /// <param name="version"></param>
        /// <returns></returns>
        static public string GenServerHashAssets(string outputRootPath, RuntimePlatform platform, string version)
        {
            Debug.Log($"<color=red>------>生成服务器Hash文件:{BApplication.GetPlatformPath(platform)}</color>");
            outputRootPath = IPath.ReplaceBackSlash(outputRootPath);
            //文件夹准备
            var outputDir = IPath.Combine(outputRootPath, UPLOAD_FOLDER_SUFFIX, BApplication.GetPlatformPath(platform));

            if (Directory.Exists(outputDir))
            {
                Directory.Delete(outputDir, true);
            }

            Directory.CreateDirectory(outputDir);
            //获取资源的hash数据
            var assetItemList = GetAssetItemList(outputRootPath, platform);

            foreach (var assetItem in assetItemList)
            {
                var localpath  = IPath.Combine(outputRootPath, BApplication.GetPlatformPath(platform), assetItem.LocalPath);
                var copytoPath = IPath.Combine(outputDir, assetItem.HashName);
                File.Copy(localpath, copytoPath);
            }

            //服务器版本信息
            var serverAssetsInfo = new AssetsVersionInfo();
            //生成分包信息
            //加载assetbundle配置
            // var abConfigPath = string.Format("{0}/{1}", assetsRootPath, BResources.ASSET_CONFIG_PATH);
            // var abConfigLoader = new AssetbundleConfigLoder();
            // abConfigLoader.Load(abConfigPath, null);
            var path = IPath.Combine(outputRootPath, BApplication.GetPlatformPath(platform), BResources.ASSETS_SUB_PACKAGE_CONFIG_PATH);

            if (File.Exists(path))
            {
                var subpackageList = CsvSerializer.DeserializeFromString <List <SubPackageConfigItem> >(File.ReadAllText(path));
                foreach (var subPackageConfigItem in subpackageList)
                {
                    var subPackageItemList = new List <AssetItem>();
                    //美术资产
                    foreach (var id in subPackageConfigItem.ArtAssetsIdList)
                    {
                        //var assetbundleItem = abConfigLoader.AssetbundleItemList[id];
                        var serverAssetsItem = assetItemList.Find((item) => item.Id == id);
                        subPackageItemList.Add(serverAssetsItem);

                        if (serverAssetsItem == null)
                        {
                            Debug.LogError("不存在art asset:" + id);
                        }
                    }

                    //脚本
                    foreach (var hcName in subPackageConfigItem.HotfixCodePathList)
                    {
                        var serverAssetsItem = assetItemList.Find((item) => item.LocalPath == hcName);
                        subPackageItemList.Add(serverAssetsItem);
                        if (serverAssetsItem == null)
                        {
                            Debug.LogError("不存在code asset:" + hcName);
                        }
                    }

                    //表格
                    foreach (var tpName in subPackageConfigItem.TablePathList)
                    {
                        var serverAssetsItem = assetItemList.Find((item) => item.LocalPath == tpName);
                        subPackageItemList.Add(serverAssetsItem);

                        if (serverAssetsItem == null)
                        {
                            Debug.LogError("不存在table asset:" + tpName);
                        }
                    }

                    //配置
                    foreach (var confName in subPackageConfigItem.ConfAndInfoList)
                    {
                        var serverAssetsItem = assetItemList.Find((item) => item.LocalPath == confName);
                        subPackageItemList.Add(serverAssetsItem);
                        if (serverAssetsItem == null)
                        {
                            Debug.LogError("不存在conf:" + confName);
                        }
                    }

                    //
                    subPackageItemList.Sort((a, b) =>
                    {
                        if (a.Id < b.Id)
                        {
                            return(-1);
                        }
                        else
                        {
                            return(1);
                        }
                    });
                    //写入本地配置
                    var subPackageInfoPath = BResources.GetAssetsSubPackageInfoPath(IPath.Combine(outputRootPath, UPLOAD_FOLDER_SUFFIX), platform, subPackageConfigItem.PackageName);
                    var configContent      = CsvSerializer.SerializeToString(subPackageItemList);
                    FileHelper.WriteAllText(subPackageInfoPath, configContent);
                    Debug.Log("生成分包文件:" + Path.GetFileName(subPackageInfoPath));
                    //写入subPck - version
                    serverAssetsInfo.SubPckMap[Path.GetFileName(subPackageInfoPath)] = version;
                }
            }

            //生成服务器AssetInfo
            var csv        = CsvSerializer.SerializeToString(assetItemList);
            var configPath = IPath.Combine(outputDir, BResources.ASSETS_INFO_PATH);

            FileHelper.WriteAllText(configPath, csv);

            //生成服务器版本号
            serverAssetsInfo.Platfrom = BApplication.GetPlatformPath(platform);
            serverAssetsInfo.Version  = version;
            var json = JsonMapper.ToJson(serverAssetsInfo);

            configPath = IPath.Combine(outputDir, BResources.SERVER_ASSETS_VERSION_INFO_PATH);
            FileHelper.WriteAllText(configPath, json);

            return(outputDir);
        }
示例#17
0
 public static T FromCsv <T>(this string csv)
 {
     return(CsvSerializer.DeserializeFromString <T>(csv));
 }
示例#18
0
 public static T CsvDeserialize <T>(string str)
 {
     return(CsvSerializer.DeserializeFromString <T>(str));
 }
示例#19
0
 public static List <Question> FromCsv(string data) => CsvSerializer.DeserializeFromString <List <Question> >(data);
示例#20
0
 public static T Deserialize <T>(string data)
 {
     return(CsvSerializer.DeserializeFromString <T>(data));
 }
示例#21
0
        /// <summary>
        /// 加载接口
        /// </summary>
        /// <param name="configPath"></param>
        /// <param name="onLoaded"></param>
        public void Load(string configPath, string assetTypePath)
        {
            //资源类型配置
            if (!string.IsNullOrEmpty(assetTypePath) && File.Exists(assetTypePath))
            {
                var content = File.ReadAllText(assetTypePath);
                // var list = CsvSerializer.DeserializeFromString<List<string>>(content);
                // var wlist = new List<AssetTypes>()
                // {
                //     new AssetTypes()
                //     {
                //         AssetTypeList = list,
                //     }
                // };
                // var str = CsvSerializer.SerializeToCsv(wlist);
                // File.WriteAllText(assetTypePath, str);
                // //
                // content = File.ReadAllText(assetTypePath);
                var records = CsvSerializer.DeserializeFromString <List <AssetTypeConfig> >(content);
                this.AssetTypes = records[0];
                //创建不同类型的映射表
                foreach (var assetType in this.AssetTypes.AssetTypeList)
                {
                    this.assetTypeIdxMap[assetType] = new LoadPathIdxMap();
                }
            }
            else
            {
                BDebug.LogError("配置文件不存在:" + configPath);
            }

            //资源配置
            if (!string.IsNullOrEmpty(configPath) && File.Exists(configPath))
            {
                this.configPath = configPath;
#if UNITY_EDITOR
                Stopwatch sw = new Stopwatch();
                sw.Start();
#endif
                var content = File.ReadAllText(configPath);
                this.AssetbundleItemList = CsvSerializer.DeserializeFromString <List <AssetBundleItem> >(content);
#if UNITY_EDITOR
                sw.Stop();
                BDebug.LogFormat("【AssetbundleV2】加载Config耗时{0}ms!", sw.ElapsedTicks / 10000L);
#endif


                foreach (var abItem in this.AssetbundleItemList)
                {
                    //可以被加载的资源
                    if (!string.IsNullOrEmpty(abItem.LoadPath) && this.AssetTypes != null)
                    {
                        var assettype = this.AssetTypes.AssetTypeList[abItem.AssetType];
                        var map       = this.assetTypeIdxMap[assettype];
                        map[abItem.LoadPath] = abItem.Id;
                    }
                }
            }
            else
            {
                BDebug.LogError("配置文件不存在:" + configPath);
            }

            //初始化常用资源类型
            // if (this.AssetTypes != null)
            // {
            //     //Prefab
            //     var clsName = typeof(GameObject).FullName;
            //     AssetType.VALID_TYPE_PREFAB = this.AssetTypes.AssetTypeList.FindIndex((at) => at.Equals(clsName, StringComparison.OrdinalIgnoreCase));
            //     //图集
            //     clsName = typeof(SpriteAtlas).FullName;
            //     AssetType.VALID_TYPE_SPRITE_ATLAS = this.AssetTypes.AssetTypeList.FindIndex((at) => at.Equals(clsName, StringComparison.OrdinalIgnoreCase));
            //     //...
            //     //其他省略,需要时候再加
            // }


            BDebug.Log("【AssetbundleV2】资源加载初始化完成,资源总量:" + this.AssetbundleItemList?.Count);
        }
示例#22
0
        /// <summary>
        /// 开始构建AB
        /// </summary>
        public void StartBuildAssetBundle(BuildTarget buildTarget)
        {
            //-----------------------开始打包AssetBundle逻辑---------------------------
            Debug.Log("【BuildAssetbundle】执行Build...");
            //设置编辑器状态
            BDEditorApplication.EditorStatus = BDFrameworkEditorStatus.BuildAssetBundle;
            var    platform           = BApplication.GetRuntimePlatform(buildTarget);
            var    platformOutputPath = IPath.Combine(BuildParams.OutputPath, BApplication.GetPlatformPath(platform));
            string abOutputPath       = IPath.Combine(platformOutputPath, BResources.ART_ASSET_ROOT_PATH);

            //--------------------------------开始打包----------------------------------
            //1.打包
            Debug.Log("<color=green>----->1.进入打包逻辑</color>");
            //整理abname
            this.MergeABName(BuildingAssetInfos);
            //对比差异文件
            var changedAssetsInfo = GetChangedAssets(BuildingAssetInfos, buildTarget);
            //生成artconfig
            var assetbundleItemList = this.GenAssetBundleConfig(BuildingAssetInfos, BuildParams, platform);

            //打包
            AssetDatabase.StartAssetEditing(); //禁止自动导入
            {
                this.BuildAssetBundle(assetbundleItemList, changedAssetsInfo, BuildParams, platform);
            }
            AssetDatabase.StopAssetEditing(); //恢复自动导入


            //2.清理
            Debug.Log("<color=green>----->2.清理旧ab</color>");
            //移除所有的ab
            RemoveAllAssetbundleName();
            //删除本地没有的资源
            var allABList = Directory.GetFiles(abOutputPath, "*", SearchOption.AllDirectories).Where((p) => string.IsNullOrEmpty(Path.GetExtension(p)));

            foreach (var abpath in allABList)
            {
                var abname = Path.GetFileName(abpath);
                var ret    = assetbundleItemList.FirstOrDefault((abdata) => abdata.AssetBundlePath == abname);
                if (ret == null)
                {
                    //
                    File.Delete(abpath);
                    File.Delete(abpath + ".manifest");
                    //
                    var path = AssetDatabase.GUIDToAssetPath(abname);
                    Debug.Log("【删除旧ab:】" + abname + "  -  " + path);
                }
            }



            //3.BuildInfo配置处理
            Debug.Log("<color=green>----->3.BuildInfo相关生成</color>");
            //设置ab的hash
            foreach (var abi in assetbundleItemList)
            {
                if (string.IsNullOrEmpty(abi.AssetBundlePath))
                {
                    continue;
                }

                var abpath = IPath.Combine(platformOutputPath, BResources.ART_ASSET_ROOT_PATH, abi.AssetBundlePath);
                var hash   = FileHelper.GetMurmurHash3(abpath);
                abi.Hash = hash;
            }

            //获取上一次打包的数据,跟这次打包数据合并
            var configPath = IPath.Combine(platformOutputPath, BResources.ART_ASSET_CONFIG_PATH);

            if (File.Exists(configPath))
            {
                var lastAssetbundleItemList = CsvSerializer.DeserializeFromString <List <AssetBundleItem> >(File.ReadAllText(configPath));
                foreach (var newABI in assetbundleItemList)
                {
                    if (string.IsNullOrEmpty(newABI.AssetBundlePath))
                    {
                        continue;
                    }

                    // //判断是否在当前打包列表中
                    // var ret = changedAssetsInfo.AssetDataMaps.Values.FirstOrDefault((a) => a.ABName.Equals(newABI.AssetBundlePath, StringComparison.OrdinalIgnoreCase));

                    var lastABI = lastAssetbundleItemList.FirstOrDefault((last) =>
                                                                         newABI.AssetBundlePath.Equals(last.AssetBundlePath, StringComparison.OrdinalIgnoreCase)); //AB名相等
                    //&& newABI.Hash == last.Hash); //hash相等
                    //没重新打包,则用上一次的mix信息
                    if (lastABI != null && lastABI.Hash == newABI.Hash)
                    {
                        newABI.Mix = lastABI.Mix;
                    }
                    //否则mix = 0
                }
            }

            //保存artconfig.info
            var csv = CsvSerializer.SerializeToString(assetbundleItemList);

            FileHelper.WriteAllText(configPath, csv);


            //保存BuildInfo配置
            var buildinfoPath = IPath.Combine(platformOutputPath, BResources.EDITOR_ART_ASSET_BUILD_INFO_PATH);
            //缓存buildinfo
            var json = JsonMapper.ToJson(BuildingAssetInfos, true);

            FileHelper.WriteAllText(buildinfoPath, json);


            //4.备份Artifacts
            //this.BackupArtifacts(buildTarget);

            //5.检测本地的Manifest和构建预期对比
            Debug.Log("<color=green>----->5.校验AB依赖</color>");
            var abRootPath       = IPath.Combine(BuildParams.OutputPath, BApplication.GetPlatformPath(platform), BResources.ART_ASSET_ROOT_PATH);
            var previewABUnitMap = BuildingAssetInfos.PreviewAssetbundleUnit();
            var manifestList     = Directory.GetFiles(abRootPath, "*.manifest", SearchOption.AllDirectories);

            //解析 manifestBuildParams.OutputPath
            for (int i = 0; i < manifestList.Length; i++)
            {
                var manifest = manifestList[i].Replace("\\", "/");


                if (manifest.Equals(abRootPath + ".manifest"))
                {
                    continue;
                }

                var           lines = File.ReadLines(manifest);
                List <string> manifestDependList = new List <string>();
                bool          isStartRead        = false;
                foreach (var line in lines)
                {
                    if (!isStartRead && line.Equals("Assets:"))
                    {
                        isStartRead = true;
                    }
                    else if (line.Contains("Dependencies:"))
                    {
                        break;
                    }
                    else if (isStartRead)
                    {
                        var file = line.Replace("- ", "");
                        manifestDependList.Add(file.ToLower());
                    }
                }

                //对比依赖
                var abname = Path.GetFileNameWithoutExtension(manifest);
                if (abname.Equals(BResources.ART_ASSET_ROOT_PATH, StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                previewABUnitMap.TryGetValue(abname, out var previewABDependList);
                if (previewABDependList == null)
                {
                    Debug.LogError("【AssetbundleV2-验证】本地ab的配置不不存在:" + abname);
                    Debug.LogError("path:" + AssetDatabase.GUIDToAssetPath(abname));
                }
                else
                {
                    //求差集
                    var except = manifestDependList.Except(previewABDependList);
                    if (except.Count() != 0)
                    {
                        var local   = JsonMapper.ToJson(manifestDependList, true);
                        var preview = JsonMapper.ToJson(previewABDependList, true);
                        Debug.LogError($"【AssetbundleV2-验证】本地AssetBundle依赖与预期不符:\n 本地:{local} \n 预期:{preview}");
                    }
                }
            }


            //6.资源混淆
            Debug.Log("<color=green>----->6.混淆AB</color>");
            if (BDEditorApplication.BDFrameworkEditorSetting.BuildAssetBundleSetting.IsEnableObfuscation)
            {
                AssetBundleEditorToolsV2.MixAssetBundle(BuildParams.OutputPath, platform);
            }


            //恢复编辑器状态
            BDEditorApplication.EditorStatus = BDFrameworkEditorStatus.Idle;
            //BD生命周期触发
            BDFrameworkPipelineHelper.OnEndBuildAssetBundle(this);


            //GenAssetBundleItemCacheList = abConfigList.ToList();
        }