コード例 #1
0
        public Group AddGetgroup(FilterMask m)
        {
            Group g;

            if (!groups.TryGetValue(m, out g))
            {
                g      = new Group();
                g.mask = m;
                groups.Add(m, g);
                listGroups.Add(g);
                lengthGroups++;
            }

            return(g);
        }
コード例 #2
0
        public void Setup(object b)
        {
            var        type         = b.GetType();
            var        objectFields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            var        length       = objectFields.Length;
            FilterMask mask;
            var        hasAtr = false;

            for (var i = 0; i < length; i++)
            {
                var myFieldInfo = objectFields[i];

                var groupByAttribute = Attribute.GetCustomAttribute(objectFields[i], typeof(GroupByAttribute)) as GroupByAttribute;

                mask = new FilterMask();

                if (groupByAttribute != null)
                {
                    hasAtr           = true;
                    mask.groupFilter = groupByAttribute.filter;
                }

                var groupExcludeAttribute =
                    Attribute.GetCustomAttribute(objectFields[i], typeof(GroupExcludeAttribute)) as GroupExcludeAttribute;
                if (groupExcludeAttribute != null)
                {
                    hasAtr = true;
                    mask.groupFilterExclude = groupExcludeAttribute.filter;
                }


                if (hasAtr)
                {
                    Group g = ProcessingEntities.Default.AddGetgroup(mask);
                    myFieldInfo.SetValue(b, g);
                }

                hasAtr = false;
            }
        }