示例#1
0
        /// <summary>
        /// 追加宏.
        /// </summary>
        /// <param name="iNames">宏定义列表</param>
        /// <param name="iAndroid">安卓标识位</param>
        /// <param name="iIOS">iOS标识位</param>
        public void AddDefines(string[] iNames, bool iAndroid, bool iIOS)
        {
            if (null == iNames || 0 >= iNames.Length ||
                null == defines)
            {
                return;
            }
            foreach (var defineName in iNames)
            {
                var isExist = false;
                foreach (var define in defines)
                {
                    if (string.IsNullOrEmpty(define.name))
                    {
                        continue;
                    }
                    if (!defineName.Equals(define.name))
                    {
                        continue;
                    }
                    if (iAndroid)
                    {
                        define.android = iAndroid;
                    }
                    if (iIOS)
                    {
                        define.iOS = iIOS;
                    }
                    isExist = true;
                    break;
                }

                if (isExist)
                {
                    continue;
                }

                // 追加宏定义设定
                {
                    var define = DefineInfo.Create(defineName, iAndroid, iIOS);
                    defines.Add(define);
                    this.Info("AddDefine -> Name:{0} Andorid:{1} iOS:{2}",
                              defineName, iAndroid, iIOS);
                }
            }

            // 按名字排序
            defines.Sort((iX, iY) => (string.Compare(iX.name, iY.name, StringComparison.Ordinal)));
        }
示例#2
0
        /// <summary>
        /// 追加宏.
        /// </summary>
        /// <param name="iName">宏定义</param>
        /// <param name="iAndroid">安卓标识位</param>
        /// <param name="iIOS">iOS标识位</param>
        private void AddDefine(string iName, bool iAndroid, bool iIOS)
        {
            if (string.IsNullOrEmpty(iName) || null == Defines)
            {
                return;
            }
            var isExist = false;

            foreach (var define in data.defines)
            {
                if (string.IsNullOrEmpty(define.name))
                {
                    continue;
                }

                if (!iName.Equals(define.name))
                {
                    continue;
                }
                define.android = iAndroid;
                define.iOS     = iIOS;
                isExist        = true;
                break;
            }
            if (false == isExist)
            {
                var define = DefineInfo.Create(iName, iAndroid, iIOS);
                Defines.Add(define);
            }

            // 按名字排序
            Defines.Sort((iX, iY) => (string.Compare(iX.name, iY.name, StringComparison.Ordinal)));

            this.Info("AddDefine -> Name:{0} Andorid:{1} iOS:{2}",
                      iName, iAndroid, iIOS);
        }