Пример #1
0
        /// <summary>
        /// 找到目标资源中和我方资源不同版本的内容
        /// <para>已方有而对方没有的资源被忽略</para>
        /// <para>对方有而已方没有的资源被包括</para>
        /// </summary>
        /// <param name="name"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public List <ResVerVO.Item> FindGroupDifferent(string name, ResVerModel target)
        {
            var selfGroup   = FindGroup(name);
            var targetGroup = target.FindGroup(name);

            var targetIdx = targetGroup.Count;

            while (--targetIdx > -1)
            {
                var targetItem = targetGroup[targetIdx];

                var selfIdx = selfGroup.Count;
                while (--selfIdx > -1)
                {
                    var selfItem = selfGroup[selfIdx];

                    if (selfItem.Equals(targetItem))
                    {
                        //两边都有的对象,从两边的数组移除,减少之后的运算开销
                        targetGroup.RemoveAt(targetIdx);
                        selfGroup.RemoveAt(selfIdx);
                        break;
                    }
                }
            }
            return(targetGroup);
        }
Пример #2
0
 /// <summary>
 /// 和目标比较资源是否版本相同
 /// </summary>
 /// <param name="name"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public bool IsSameVer(string name, ResVerModel target)
 {
     if (GetVer(name) == target.GetVer(name))
     {
         return(true);
     }
     return(false);
 }