Exemplo n.º 1
0
        public static ResVersion CreateNew(string resName, int resVersion, long resFileSize)
        {
            ResVersion result = new ResVersion
            {
                name      = resName,
                version   = resVersion,
                file_size = resFileSize
            };

            return(result);
        }
Exemplo n.º 2
0
 private void NewResVersion(int baseVersion, bool isUpdateVersion, ref ResVersion item, ref string name)
 {
     if (item == default)
     {
         item = AddNewRes(name, DEFAULT_VERSION);
         mResIndexMapper[name] = mRes.Count;
     }
     else
     {
         int version = isUpdateVersion ? baseVersion + 1 : baseVersion;
         item.version = version;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 迭代资源总依赖文件的版本
        /// </summary>
        /// <param name="abNames"></param>
        private void CheckMainManifestVersion(ref string[] abNames)
        {
            ResVersion resData = GetResVersion(AppPaths.resData);

            if (resData == default)
            {
                AddNewRes(AppPaths.resData, DEFAULT_VERSION);
            }
            else
            {
                if (abNames.Length > 0)
                {
                    resData.version++;
                }
                else
                {
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 从另一个资源版本对象复制数据
        /// </summary>
        /// <param name="copyFrom"></param>
        public void CloneVersionsFrom(ref ResDataVersion copyFrom)
        {
            Clean(false, true);

            if (copyFrom.IsVersionsEmpty())
            {
                copyFrom.Init();
            }
            else
            {
            }

            app_version = copyFrom.app_version;
            res_version = copyFrom.res_version;
            res_gateway = copyFrom.res_gateway;

            ResVersion item;
            int        resSize = copyFrom.res.Length;

            res = new ResVersion[resSize];
            for (int i = 0; i < resSize; i++)
            {
                item   = copyFrom.res[i];
                res[i] = ResVersion.CreateNew(item.name, item.version, item.file_size);
            }

            int updatingsSize = copyFrom.updatings != default ? copyFrom.updatings.Length : 0;

            updatings = new ResUpdating[updatingsSize];
            for (int i = 0; i < updatingsSize; i++)
            {
                updatings[i] = new ResUpdating()
                {
                    name    = copyFrom.updatings[i].name,
                    version = copyFrom.updatings[i].version,
                };
            }

            res_total      = res.Length;
            updating_total = updatings.Length;
        }
Exemplo n.º 5
0
        private void CheckResVersions(int max, ref string[] abNames, ref ResDataVersion remoteVers, bool isUpdateVersion, ref List <string> changeds)
        {
            string     abName = string.Empty;
            ResVersion item, remote = default;

            for (int i = 0; i < max; i++)
            {
                abName = abNames[i];
                item   = GetResVersion(abName);
                int baseVersion = item == default ? DEFAULT_VERSION : item.version;//若未找到对应的资源版本,基于默认的版本号进行设置

                if (remoteVers != default)
                {
                    remote      = remoteVers.GetResVersion(abName);
                    baseVersion = remote != default ? remote.version : baseVersion;//若已存在线上版本,基于线上版本号进行设置
                }
                else
                {
                }

                NewResVersion(baseVersion, isUpdateVersion, ref item, ref abName);
                UpdateVersionChange(ref changeds, ref abName, ref item);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 检查版本差异
        /// </summary>
        /// <param name="clientVersions"></param>
        /// <param name="remoteVersions"></param>
        /// <returns></returns>
        public List <ResVersion> CheckUpdates(ResDataVersion clientVersions, ref ResDataVersion remoteVersions)
        {
            if (clientVersions.resVersionType != ResDataVersionType.Client ||
                remoteVersions.resVersionType != ResDataVersionType.Remote)
            {
                return(new List <ResVersion>(0));
            }
            else
            {
            }

            bool isVersionsEmpty = IsVersionsEmpty();

            if (isVersionsEmpty)
            {
                CloneVersionsFrom(ref clientVersions);//复制安装包中默认的资源版本
            }
            else
            {
            }

            Init();

            ResVersion remoteItem = default, cachedItem = default;
Exemplo n.º 7
0
 private void UpdateVersionChange(ref List <string> changeds, ref string abName, ref ResVersion item)
 {
     if (changeds.Contains(abName))
     {
         int index = changeds.IndexOf(abName);
         mResChanged[index].version = item.version;
     }
     else
     {
         if (item != default)
         {
             mResChanged.Add(item);
         }
         else
         {
             Debug.LogError("Version item is null");
         }
     }
 }