コード例 #1
0
        /// <summary>
        /// 合并目标.
        /// </summary>
        /// <param name="iNewTarget">I new target.</param>
        private void MergeTarget(BundleMap iNewTarget)
        {
            BundleMap _oldTarget = null;
            bool      isChanged  = this.isTargetChanged(iNewTarget, ref _oldTarget);

            if (true == isChanged)
            {
                if (null == _oldTarget)
                {
                    this.Maps.Add(iNewTarget);
                }
                else
                {
                    _oldTarget.Type = iNewTarget.Type;
                    _oldTarget.Path = iNewTarget.Path;

                    foreach (string newPath in iNewTarget.Targets)
                    {
                        bool _isExist = false;
                        foreach (string path in _oldTarget.Targets)
                        {
                            if (true == newPath.Equals(path))
                            {
                                _isExist = true;
                                break;
                            }
                        }
                        if (false == _isExist)
                        {
                            _oldTarget.Targets.Add(newPath);
                        }
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// 判断目标存不存在.
 /// </summary>
 /// <returns><c>true</c>, 存在, <c>false</c> 不存在.</returns>
 /// <param name="iTargetID">目标ID.</param>
 /// <param name="iTarget">目标.</param>
 private bool isTargetExist(string iTargetID, out BundleMap iTarget)
 {
     iTarget = null;
     foreach (BundleMap loop in this.Maps)
     {
         if (loop.ID.Equals(iTargetID) == true)
         {
             iTarget = loop;
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
        /// <summary>
        /// 目标是否改变了.
        /// </summary>
        /// <returns><c>true</c>, 已改变, <c>false</c> 未改变.</returns>
        /// <param name="iNewTarget">新目标.</param>
        /// <param name="iExist">既存标志位.</param>
        private bool isTargetChanged(BundleMap iNewTarget, ref BundleMap iOldTarget)
        {
            iOldTarget = null;
            bool isExist = this.isTargetExist(iNewTarget.ID, out iOldTarget);

            if (true == isExist)
            {
                // Type
                if (iOldTarget.Type != iNewTarget.Type)
                {
                    return(true);
                }

                // Path
                if (false == iOldTarget.Path.Equals(iNewTarget.Path))
                {
                    return(true);
                }

                // Targets
                if (iOldTarget.Targets.Count != iNewTarget.Targets.Count)
                {
                    return(true);
                }
                foreach (string newPath in iNewTarget.Targets)
                {
                    bool _isExist = false;
                    foreach (string path in iOldTarget.Targets)
                    {
                        if (true == newPath.Equals(path))
                        {
                            _isExist = true;
                            break;
                        }
                    }
                    if (false == _isExist)
                    {
                        return(true);
                    }
                }
            }
            else
            {
                return(true);
            }
            return(false);
        }
コード例 #4
0
        /// <summary>
        /// 取得或者创建一个BundleMap.
        /// </summary>
        /// <returns>BundleMap.</returns>
        /// <param name="iBundleId">BundleId.</param>
        public BundleMap GetOrCreateBundlesMap(string iBundleId)
        {
            BundleMap objRet = null;

            if (this.isTargetExist(iBundleId, out objRet) == true)
            {
                if (objRet == null)
                {
                    objRet = new BundleMap();
                }
            }
            else
            {
                objRet = new BundleMap();
            }
            return(objRet);
        }