public BxCompoundAttribute(Type type, string version)
        {
            FieldInfo info = type.GetField("s_instance", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);

            _core    = (BxCompoundCore)info.GetValue(null);
            _version = version;
        }
Beispiel #2
0
        public FieldInfo[] GetFieldsInfo(bool bDeclaredOnly)
        {
            if (bDeclaredOnly)
            {
                return(DeclaredFieldsInfo);
            }

            Stack <FieldInfo[]> all  = new Stack <FieldInfo[]>();
            BxCompoundCore      core = this;
            int count = 0;

            while (core != null)
            {
                all.Push(core.DeclaredFieldsInfo);
                count += core.DeclaredFieldsInfo.Length;
                core   = core.BaseCore;
            }
            List <FieldInfo> outVal = new List <FieldInfo>(count);

            FieldInfo[] one;
            while (all.Count > 0)
            {
                one = all.Pop();
                outVal.AddRange(one);
            }
            return(outVal.ToArray());
        }
Beispiel #3
0
        public BxCompoundInstanceData(IBxStaticUIConfigProvider suicProvider, BxCompoundCore core)
        {
            _suicProvider   = suicProvider;
            _instanceFields = new BxCompoundFieldData[core.FieldsCount];
            int index = 0;
            IEnumerable <BxCompoundCoreFieldData> fieldsInfo = core.GetAllFieldsInfo();

            foreach (BxCompoundCoreFieldData one in fieldsInfo)
            {
                _instanceFields[index] = new BxCompoundFieldData(one, _suicProvider);
                index++;
            }
        }
Beispiel #4
0
        private void _InitCore()
        {
            Type type = this.GetType();

            while (type != typeof(BxCompound))
            {
                object[] attribs = type.GetCustomAttributes(typeof(BxCompoundAttribute), false);
                if (attribs.Length > 0)
                {
                    _core = ((BxCompoundAttribute)attribs[0]).Core;
                    return;
                }
            }
        }
Beispiel #5
0
            public FieldsInfoEnumerator(BxCompoundCore core)
            {
                _core = core;

                _coreList = new List <BxCompoundCore>();
                BxCompoundCore curCore = _core;

                while (curCore != null)
                {
                    _coreList.Insert(0, curCore);
                    curCore = curCore._baseCore;
                }
                Reset();
            }
Beispiel #6
0
        //public void InitSite(IBxElementSiteEx site)
        //{
        //    _site = site;
        //}
        public virtual void InitCarrier(IBxElementCarrier carrier)
        {
            _carrier = carrier;
            BxCompoundCore          core       = Core;
            IEnumerable <FieldInfo> fieldsInfo = core.GetAllFieldsInfo();

            foreach (FieldInfo one in fieldsInfo)
            {
                object field = one.GetValue(this);
                if (field is IBxElementSiteInit)
                {
                    (field as IBxElementSiteInit).InitCarrier(_carrier);
                }
            }
        }
Beispiel #7
0
        private void _InitSubElements()
        {
            BxCompoundCore          core       = Core;
            IEnumerable <FieldInfo> fieldsInfo = core.GetAllFieldsInfo();

            foreach (FieldInfo one in fieldsInfo)
            {
                object field = one.GetValue(this);
                if (field is IBxElementSiteInit)
                {
                    //if (_carrier != null)
                    //    (field as IBxElementSiteInit).InitCarrier(_carrier);
                    (field as IBxElementSiteInit).InitFieldInfo(this, one);
                }
            }
        }
Beispiel #8
0
 public bool MoveNext()
 {
     _index++;
     if (_index >= _curCore.DeclaredFieldsInfo.Length)
     {
         _curCore = _curCore.BaseCore;
         _index   = 0;
         if (_curCore == null)
         {
             return(false);
         }
         if (_curCore.DeclaredFieldsInfo.Length == 0)
         {
             return(MoveNext());
         }
     }
     return(true);
 }
Beispiel #9
0
            public bool MoveNext()
            {
                _index++;
                if (_index >= _curCore.DeclaredFieldsInfo.Length)
                {
                    _coreIndex++;
                    if (_coreIndex >= _coreList.Count)
                    {
                        return(false);
                    }
                    _curCore = _coreList[_coreIndex];
                    _index   = 0;

                    if (_curCore.DeclaredFieldsInfo.Length == 0)
                    {
                        return(MoveNext());
                    }
                }
                return(true);
            }
Beispiel #10
0
        private void _InitSubElements()
        {
            BxCompoundCore core = Core;
            IEnumerable <BxCompoundCoreFieldData> fieldsInfo = core.GetAllFieldsInfo();

            foreach (BxCompoundCoreFieldData one in fieldsInfo)
            {
                object field = one.FieldInfo.GetValue(this);
                if (field is IBxElementSiteInit)
                {
                    (field as IBxElementSiteInit).InitContainer(this);
                    (field as IBxElementSiteInit).InitSUICPregnant(one);
                }
                if (field is IBxElementSiteVertionType)
                {
                    (field as IBxElementSiteVertionType).VertionType = one.VersionType;
                    (field as IBxElementSiteVertionType).Version     = one.Version;
                }
            }
        }
Beispiel #11
0
        public BxCompoundCore(Type type)
        {
            _type = type;
            Type baseType = type.BaseType;

            object[] attribs = baseType.GetCustomAttributes(typeof(BxCompoundAttribute), false);
            if (attribs.Length > 0)
            {
                _baseCore = ((BxCompoundAttribute)attribs[0]).Core;
            }

            //while (baseType != typeof(BxCompoundValue))
            //{
            //    baseType = baseType.BaseType;
            //    object[] attribs = baseType.GetCustomAttributes(typeof(BSCompoundAttribute), false);
            //    if (attribs.Length > 0)
            //    {
            //        m_baseCore = ((BSCompoundAttribute)attribs[0]).Core;
            //        break;
            //    }
            //}
            //Init();
        }
Beispiel #12
0
        public virtual void InitCarrier(IBxElementCarrier carrier)
        {
            if (carrier == null)
            {
                throw new NullReferenceException();
            }
            if (_carrier == carrier)
            {
                return;
            }
            bool bFirstInit = (_carrier == null);

            _carrier = carrier;


            BxCompoundCore          core       = Core;
            IEnumerable <FieldInfo> fieldsInfo = core.GetAllFieldsInfo();
            IBxElementSiteInit      temp       = null;

            foreach (FieldInfo one in fieldsInfo)
            {
                object field = one.GetValue(this);
                if (field is IBxElementSiteInit)
                {
                    temp = field as IBxElementSiteInit;
                    if (bFirstInit)
                    {
                        temp.InitFieldInfo(this, one);
                    }
                    temp.InitCarrier(_carrier);
                }
            }
            if (bFirstInit)
            {
                OnInit();
            }
        }
Beispiel #13
0
 public void Reset()
 {
     _curCore = _core;
     _index   = -1;
 }
Beispiel #14
0
 public void Reset()
 {
     _curCore   = _coreList[0];
     _coreIndex = 0;
     _index     = -1;
 }
Beispiel #15
0
 public FieldsInfoEnumerable(BxCompoundCore core)
 {
     _core = core;
 }
Beispiel #16
0
 public BxElementCarrier()
 {
     _core = new BxCompoundCore(this.GetType());
 }
Beispiel #17
0
 public FieldsInfoEnumerator(BxCompoundCore core)
 {
     _core = core; Reset();
 }