示例#1
0
 /// <summary>
 /// 移除一个文件的版本号
 /// </summary>
 /// <param name="name"></param>
 public void RemoveVer(string name)
 {
     for (int i = 0; i < _vo.items.Length; i++)
     {
         if (_vo.items[i].name == name)
         {
             ResVerVO.Item[] items = new ResVerVO.Item[_vo.items.Length - 1];
             if (i == 0)
             {
                 Array.Copy(_vo.items, 1, items, 0, items.Length);
             }
             else if (i == items.Length)
             {
                 Array.Copy(_vo.items, 0, items, 0, items.Length);
             }
             else
             {
                 //拷贝前部分
                 Array.Copy(_vo.items, 0, items, 0, i);
                 //拷贝后部分
                 Array.Copy(_vo.items, i + 1, items, i, items.Length - i);
             }
             _vo.items = items;
             break;
         }
     }
 }
示例#2
0
 /// <summary>
 /// 是否含有资源文件
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool Contains(ResVerVO.Item item)
 {
     foreach (var selfItem in _vo.items)
     {
         if (selfItem.Equals(item))
         {
             return(true);
         }
     }
     return(false);
 }
示例#3
0
        /// <summary>
        /// 设置文件版本号
        /// </summary>
        /// <returns>The ver.</returns>
        /// <param name="name">Name.</param>
        public void SetVer(string name, string version)
        {
            //如果存在则更新
            for (int i = 0; i < _vo.items.Length; i++)
            {
                if (_vo.items[i].name == name)
                {
                    _vo.items[i].version = version;
                    return; //添加并返回函数
                }
            }

            //如果不存在则添加
            ResVerVO.Item[] items = new ResVerVO.Item[_vo.items.Length + 1];
            Array.Copy(_vo.items, items, _vo.items.Length);
            ResVerVO.Item newItem = new ResVerVO.Item();
            newItem.name            = name;
            newItem.version         = version;
            items[_vo.items.Length] = newItem;
            _vo.items = items;
        }