public void                         getItemValues(out int[] aItemHandles, out object[] aItemValues)
        {
            mValueChanged = false;

            List <int>    lHandles = new List <int>();
            List <object> lValues  = new List <object>();

            if (mDataFlow.HasFlag(EDataFlow.TO) && mArrayValueChanged)
            {
                mArrayValueChanged = false;
                object lValue = mItemBrowser.readItemOrInitValue(mArrayValueItemHandle);
                Type   lType;
                Array  lArray = lValue as Array;
                if (lArray != null)
                {
                    lType = lArray.GetType().GetElementType();
                    if (lArray.Length < mArrayValue.Length)
                    {
                        lArray = Array.CreateInstance(lType, mArrayValue.Length);
                    }
                }
                else
                {
                    lType  = lValue.GetType();
                    lArray = Array.CreateInstance(lType, mArrayValue.Length);
                }

                for (int i = 0; i < mArrayValue.Length; i++)
                {
                    lArray.SetValue(MiscUtils.convertValue(lType, mArrayValue[i]), i);
                }

                lHandles.Add(mArrayValueItemHandle);
                lValues.Add(lArray);
            }

            if (mDataFlow.HasFlag(EDataFlow.FROM))
            {
                for (int i = 0; i < mElementItemHandles.Length; i++)
                {
                    if (mElementValueChanged[i] == true && mElementItemHandles[i] != -1 && mArrayValue[i] != null)
                    {
                        mElementValueChanged[i] = false;
                        lHandles.Add(mElementItemHandles[i]);
                        lValues.Add(mArrayValue[i]);
                    }
                }
            }

            aItemHandles = lHandles.ToArray();
            aItemValues  = lValues.ToArray();
        }
Ejemplo n.º 2
0
        public void                         getItemValues(out int[] aItemHandles, out object[] aItemValues)
        {
            mValueChanged = false;

            List <int>    lHandles = new List <int>();
            List <object> lValues  = new List <object>();

            if (mDataFlow.HasFlag(EDataFlow.TO) && mBitsValueChanged)
            {
                mBitsValueChanged = false;
                object lValueObject = mItemBrowser.readItemOrInitValue(mBitsValueItemHandle);
                Type   lValueType   = lValueObject.GetType();
                checkType(lValueType);

                ulong lValueUInt64 = Converters.ToUInt64(lValueObject);
                for (int i = 0; i < mBitsValue.Length; i++)
                {
                    setBitValue(ref lValueUInt64, i, mBitsValue[i]);
                }

                lHandles.Add(mBitsValueItemHandle);
                lValues.Add(Converters.FromUInt64(lValueType, lValueUInt64));
            }

            if (mDataFlow.HasFlag(EDataFlow.FROM))
            {
                for (int i = 0; i < mBitItemHandles.Length; i++)
                {
                    if (mBitValueChanged[i] && mBitItemHandles[i] != -1)
                    {
                        mBitValueChanged[i] = false;
                        lHandles.Add(mBitItemHandles[i]);
                        lValues.Add(mBitsValue[i]);
                    }
                }
            }

            aItemHandles = lHandles.ToArray();
            aItemValues  = lValues.ToArray();
        }