Example #1
0
        private List <ABUnit> CalculateDeleteList(AssetDataTable local, AssetDataTable remote)
        {
            if (remote == null || local == null)
            {
                return(null);
            }

            var remoteABList = remote.GetAllABUnit();

            //防止远程清单文件下载失败导致本地被删光
            if (remoteABList.Count == 0)
            {
                return(null);
            }

            List <ABUnit> localABList = local.GetAllABUnit();

            List <ABUnit> deleteABList = new List <ABUnit>();

            for (int i = localABList.Count - 1; i >= 0; --i)
            {
                ABUnit localABUnit  = localABList[i];
                ABUnit remoteABUnit = remote.GetABUnit(localABUnit.abName);

                if (remoteABUnit == null)
                {
                    deleteABList.Add(localABUnit);
                    continue;
                }
            }

            return(deleteABList);
        }
Example #2
0
        //计算成成更新的资源列表
        public static List <ABUnit> CalculateLateList(AssetDataTable oldData, AssetDataTable newData, bool addNew)
        {
            if (newData == null || oldData == null)
            {
                return(null);
            }

            List <ABUnit> newABUnitList = newData.GetAllABUnit();

            List <ABUnit> lateABList = new List <ABUnit>();

            for (int i = newABUnitList.Count - 1; i >= 0; --i)
            {
                ABUnit newUnit = newABUnitList[i];
                ABUnit oldUnit = oldData.GetABUnit(newUnit.abName);

                if (oldUnit == null)
                {
                    //更新的新资源
                    if (addNew)
                    {
                        lateABList.Add(newUnit);
                    }
                    continue;
                }

                if (oldUnit.md5.Equals(newUnit.md5))
                {
                    continue;
                }

                if (oldUnit.buildTime < newUnit.buildTime)
                {
                    lateABList.Add(newUnit);
                }
            }

            return(lateABList);
        }
Example #3
0
        public void ModifyAssetDataTable(AssetDataTable table)
        {
            RecordCell       cell    = null;
            AssetDataPackage package = null;

            for (int i = 0; i < m_UpdateRecordList.Count; ++i)
            {
                cell = m_UpdateRecordList[i];
                ABUnit unit = table.GetABUnit(cell.name);
                if (unit == null)
                {
                    table.AddAssetBundleName(cell.name, null, cell.md5, 1, cell.buildTime, out package);
                    continue;
                }
                else
                {
                    unit.buildTime = cell.buildTime;
                    unit.md5       = cell.md5;
                    unit.fileSize  = cell.fileSize;
                }
            }
        }