示例#1
0
 public static unsafe uint Read(this NativeReader reader, uint offset, out BooleanCollection values)
 {
     values = new BooleanCollection(reader, offset);
     uint count;
     offset = reader.DecodeUnsigned(offset, out count);
     offset = checked(offset + count * sizeof(Boolean));
     return offset;
 } // Read
示例#2
0
        public static unsafe uint Read(this NativeReader reader, uint offset, out BooleanCollection values)
        {
            values = new BooleanCollection(reader, offset);
            uint count;

            offset = reader.DecodeUnsigned(offset, out count);
            offset = checked (offset + count * sizeof(Boolean));
            return(offset);
        } // Read
示例#3
0
        public static bool[] ToArray(this BooleanCollection collection)
        {
            int count = collection.Count;

            bool[] result = new bool[count];
            int    i      = 0;

            foreach (bool element in collection)
            {
                result[i++] = element;
            }
            Debug.Assert(i == count);
            return(result);
        }
示例#4
0
        /// <summary>
        /// Reads a boolean array from the stream.
        /// </summary>
        public BooleanCollection ReadBooleanArray(string fieldName)
        {           
            bool isNil = false;

            BooleanCollection values = new BooleanCollection();
                                    
            if (BeginField(fieldName, true, out isNil))
            {
                PushNamespace(Namespaces.OpcUaXsd);      

                while (MoveToElement("Boolean"))
                {
                    values.Add(ReadBoolean("Boolean"));
                }

                // check the length.
                if (m_context.MaxArrayLength > 0 && m_context.MaxArrayLength < values.Count)
                {
                    throw new ServiceResultException(StatusCodes.BadEncodingLimitsExceeded);
                }

                PopNamespace();

                EndField(fieldName);
                return values;
            }

            if (isNil)
            {
                return null;
            }

            return values;
        }
示例#5
0
        /// <summary>
        /// Reads a boolean array from the stream.
        /// </summary>
        public BooleanCollection ReadBooleanArray(string fieldName)
        {
            int length = ReadArrayLength();

            if (length == -1)
            {
                return null;
            }

            BooleanCollection values = new BooleanCollection(length);

            for (int ii = 0; ii < length; ii++)
            {
                values.Add(ReadBoolean(null));
            }

            return values;
        }
        /// <summary>
        /// Reads a boolean array from the stream.
        /// </summary>
        public BooleanCollection ReadBooleanArray(string fieldName)
        {
            var values = new BooleanCollection();

            List<object> token = null;

            if (!ReadArrayField(fieldName, out token))
            {
                return values;
            }

            for (int ii = 0; ii < token.Count; ii++)
            {
                try
                {
                    m_stack.Push(token[ii]);
                    values.Add(ReadBoolean(null));
                }
                finally
                {
                    m_stack.Pop();
                }
            }

            return values;
        }