private void OnGetRemoteVersion(bool flag, Loader.Loader ld)
        {
            ResDataVersion remoteVers = default;

            if (flag)
            {
                //string data = ld.TextData;
                string data = System.Text.Encoding.UTF8.GetString(ld.ResultData);
                if (data.Contains("}{"))
                {
                    Debug.Log("Match the '}{'");
                    data = data.Split(new string[] { "}{" }, System.StringSplitOptions.None)[0].Append("}");
                }
                remoteVers = JsonUtility.FromJson <ResDataVersion>(data);

                if (remoteVers == default)
                {
                    Debug.Log("Do not exists remote versions.");
                }
                ld.Dispose();
            }
            else
            {
                Debug.Log("Do not get remote versions.");
            }
            BuildVersionConfig(ref remoteVers);
        }
        /// <summary>
        /// 创建资源版本
        /// </summary>
        /// <param name="remoteVers"></param>
        private void BuildVersionConfig(ref ResDataVersion remoteVers)
        {
            string         versions       = default;
            ResDataVersion resDataVersion = default;

            GetVersionDataFromRemote(ref remoteVers, ref versions, ref resDataVersion);

            string[] abNamesValue = ABNamesWillBuild != default ? ABNamesWillBuild.ToArray() : new string[0];
            resDataVersion.CreateNewResVersion(ref resRemoteGateWay, isUpdateVersion, isUpdateResVersion, isSyncAppVersion, ref remoteVers, ref abNamesValue);
            resDataVersion.Refresh();

            bool applyClientGateway = false;

            if (isSyncClientVersions)
            {
                List <ScriptableObject> list = default;
                ShipDockEditorUtils.FindAssetInEditorProject(ref list, "t:ScriptableObject", @"Assets\Prefabs");
                ClientResVersion clientRes = default;// = (ClientResVersion)list[0];
                foreach (ScriptableObject i in list)
                {
                    if (i.name == ClientVersionFileName)
                    {
                        clientRes = (ClientResVersion)i;
                        break;
                    }
                    else
                    {
                    }
                }

                applyClientGateway = clientRes.ApplyCurrentResGateway;
                if (applyClientGateway)
                {
                    resDataVersion.res_gateway = clientRes.ClientResVersionGateway();
                }

                clientRes.Versions.CloneVersionsFrom(ref resDataVersion);
                clientRes.SetChanges(resDataVersion.ResChanges);
                UnityEditor.EditorUtility.SetDirty(clientRes);
            }
            versions = JsonUtility.ToJson(resDataVersion);
            string stamp = "_".Append(System.DateTime.Now.ToShortDateString().Replace("/", "_"));

            FileOperater.WriteUTF8Text(versions, Application.dataPath.Append("/Prefabs/ClientResVersions_Previews/", ResDataVersion.FILE_RES_DATA_VERSIONS_NAME, stamp, ".json")); //仅用于查看
            FileOperater.WriteBytes(versions, AppPaths.ABBuildOutputRoot.Append(ResDataVersion.FILE_RES_DATA_VERSIONS_NAME));                                                      //位于资源主目录里的正式文件

            resDataVersion.Clean();
            remoteVers?.Clean();
        }
 private void GetVersionDataFromRemote(ref ResDataVersion remoteVers, ref string versions, ref ResDataVersion resDataVersion)
 {
     if (remoteVers == default)
     {
         versions       = FileOperater.ReadUTF8Text(AppPaths.ABBuildOutputRoot.Append(ResDataVersion.FILE_RES_DATA_VERSIONS_NAME));
         resDataVersion = JsonUtility.FromJson <ResDataVersion>(versions);
         if (resDataVersion == default)
         {
             resDataVersion = new ResDataVersion
             {
                 app_version = Application.version,
                 res_version = remoteVers != default ? remoteVers.res_version : 0,//根据是否存在线上版本同步资源号
             };
         }
     }
     else
     {
         resDataVersion = new ResDataVersion();
         resDataVersion.CloneVersionsFrom(ref remoteVers);
     }
 }