コード例 #1
0
        /// <summary>
        /// Returns a random structure.
        /// </summary>
        private ExtensionObject GetRandomStructure()
        {
            if (m_generator.GetRandomBoolean())
            {
                ScalarValueDataType value = new ScalarValueDataType();
                
                value.BooleanValue = m_generator.GetRandom<bool>(false);
                value.SByteValue = m_generator.GetRandom<sbyte>(false);
                value.ByteValue = m_generator.GetRandom<byte>(false);
                value.Int16Value = m_generator.GetRandom<short>(false);
                value.UInt16Value = m_generator.GetRandom<ushort>(false);
                value.Int32Value = m_generator.GetRandom<int>(false);
                value.UInt32Value = m_generator.GetRandom<uint>(false);
                value.Int64Value = m_generator.GetRandom<long>(false);
                value.UInt64Value = m_generator.GetRandom<ulong>(false);
                value.FloatValue = m_generator.GetRandom<float>(false);
                value.DoubleValue = m_generator.GetRandom<double>(false);
                value.StringValue = m_generator.GetRandom<string>(false);
                value.DateTimeValue = m_generator.GetRandom<DateTime>(false);
                value.GuidValue = m_generator.GetRandom<Uuid>(false);
                value.ByteStringValue = m_generator.GetRandom<byte[]>(false);
                value.XmlElementValue = m_generator.GetRandom<XmlElement>(false);
                value.NodeIdValue = m_generator.GetRandom<Opc.Ua.NodeId>(false);
                value.ExpandedNodeIdValue = m_generator.GetRandom<ExpandedNodeId>(false);
                value.QualifiedNameValue = m_generator.GetRandom<QualifiedName>(false);
                value.LocalizedTextValue = m_generator.GetRandom<LocalizedText>(false);
                value.StatusCodeValue = m_generator.GetRandom<StatusCode>(false);
                value.VariantValue = m_generator.GetRandomVariant(false);

                return new ExtensionObject(value);
            }
            else
            {
                ArrayValueDataType value = new ArrayValueDataType();
                
                value.BooleanValue = m_generator.GetRandomArray<bool>(false, 10, false);
                value.SByteValue = m_generator.GetRandomArray<sbyte>(false, 10, false);
                value.ByteValue = m_generator.GetRandomArray<byte>(false, 10, false);
                value.Int16Value = m_generator.GetRandomArray<short>(false, 10, false);
                value.UInt16Value = m_generator.GetRandomArray<ushort>(false, 10, false);
                value.Int32Value = m_generator.GetRandomArray<int>(false, 10, false);
                value.UInt32Value = m_generator.GetRandomArray<uint>(false, 10, false);
                value.Int64Value = m_generator.GetRandomArray<long>(false, 10, false);
                value.UInt64Value = m_generator.GetRandomArray<ulong>(false, 10, false);
                value.FloatValue = m_generator.GetRandomArray<float>(false, 10, false);
                value.DoubleValue = m_generator.GetRandomArray<double>(false, 10, false);
                value.StringValue = m_generator.GetRandomArray<string>(false, 10, false);
                value.DateTimeValue = m_generator.GetRandomArray<DateTime>(false, 10, false);
                value.GuidValue = m_generator.GetRandomArray<Uuid>(false, 10, false);
                value.ByteStringValue = m_generator.GetRandomArray<byte[]>(false, 10, false);
                value.XmlElementValue = m_generator.GetRandomArray<XmlElement>(false, 10, false);
                value.NodeIdValue = m_generator.GetRandomArray<Opc.Ua.NodeId>(false, 10, false);
                value.ExpandedNodeIdValue = m_generator.GetRandomArray<ExpandedNodeId>(false, 10, false);
                value.QualifiedNameValue = m_generator.GetRandomArray<QualifiedName>(false, 10, false);
                value.LocalizedTextValue = m_generator.GetRandomArray<LocalizedText>(false, 10, false);
                value.StatusCodeValue = m_generator.GetRandomArray<StatusCode>(false, 10, false);

                object[] values = m_generator.GetRandomArray<object>(false, 10, false);

                for (int ii = 0; values != null && ii < values.Length; ii++)
                {
                    value.VariantValue.Add(new Variant(values[ii]));
                }

                return new ExtensionObject(value);                
            }
        }
コード例 #2
0
        /// <summary>
        /// Returns a random structure.
        /// </summary>
        private ExtensionObject GetRandomStructure()
        {
            if (m_generator.GetRandomBoolean())
            {
                ScalarValueDataType value = new ScalarValueDataType();

                value.BooleanValue        = m_generator.GetRandom <bool>(false);
                value.SByteValue          = m_generator.GetRandom <sbyte>(false);
                value.ByteValue           = m_generator.GetRandom <byte>(false);
                value.Int16Value          = m_generator.GetRandom <short>(false);
                value.UInt16Value         = m_generator.GetRandom <ushort>(false);
                value.Int32Value          = m_generator.GetRandom <int>(false);
                value.UInt32Value         = m_generator.GetRandom <uint>(false);
                value.Int64Value          = m_generator.GetRandom <long>(false);
                value.UInt64Value         = m_generator.GetRandom <ulong>(false);
                value.FloatValue          = m_generator.GetRandom <float>(false);
                value.DoubleValue         = m_generator.GetRandom <double>(false);
                value.StringValue         = m_generator.GetRandom <string>(false);
                value.DateTimeValue       = m_generator.GetRandom <DateTime>(false);
                value.GuidValue           = m_generator.GetRandom <Uuid>(false);
                value.ByteStringValue     = m_generator.GetRandom <byte[]>(false);
                value.XmlElementValue     = m_generator.GetRandom <XmlElement>(false);
                value.NodeIdValue         = m_generator.GetRandom <Opc.Ua.NodeId>(false);
                value.ExpandedNodeIdValue = m_generator.GetRandom <ExpandedNodeId>(false);
                value.QualifiedNameValue  = m_generator.GetRandom <QualifiedName>(false);
                value.LocalizedTextValue  = m_generator.GetRandom <LocalizedText>(false);
                value.StatusCodeValue     = m_generator.GetRandom <StatusCode>(false);
                value.VariantValue        = m_generator.GetRandomVariant(false);

                return(new ExtensionObject(value.TypeId, value));
            }
            else
            {
                ArrayValueDataType value = new ArrayValueDataType();

                value.BooleanValue        = m_generator.GetRandomArray <bool>(false, 10, false);
                value.SByteValue          = m_generator.GetRandomArray <sbyte>(false, 10, false);
                value.ByteValue           = m_generator.GetRandomArray <byte>(false, 10, false);
                value.Int16Value          = m_generator.GetRandomArray <short>(false, 10, false);
                value.UInt16Value         = m_generator.GetRandomArray <ushort>(false, 10, false);
                value.Int32Value          = m_generator.GetRandomArray <int>(false, 10, false);
                value.UInt32Value         = m_generator.GetRandomArray <uint>(false, 10, false);
                value.Int64Value          = m_generator.GetRandomArray <long>(false, 10, false);
                value.UInt64Value         = m_generator.GetRandomArray <ulong>(false, 10, false);
                value.FloatValue          = m_generator.GetRandomArray <float>(false, 10, false);
                value.DoubleValue         = m_generator.GetRandomArray <double>(false, 10, false);
                value.StringValue         = m_generator.GetRandomArray <string>(false, 10, false);
                value.DateTimeValue       = m_generator.GetRandomArray <DateTime>(false, 10, false);
                value.GuidValue           = m_generator.GetRandomArray <Uuid>(false, 10, false);
                value.ByteStringValue     = m_generator.GetRandomArray <byte[]>(false, 10, false);
                value.XmlElementValue     = m_generator.GetRandomArray <XmlElement>(false, 10, false);
                value.NodeIdValue         = m_generator.GetRandomArray <Opc.Ua.NodeId>(false, 10, false);
                value.ExpandedNodeIdValue = m_generator.GetRandomArray <ExpandedNodeId>(false, 10, false);
                value.QualifiedNameValue  = m_generator.GetRandomArray <QualifiedName>(false, 10, false);
                value.LocalizedTextValue  = m_generator.GetRandomArray <LocalizedText>(false, 10, false);
                value.StatusCodeValue     = m_generator.GetRandomArray <StatusCode>(false, 10, false);

                object[] values = m_generator.GetRandomArray <object>(false, 10, false);

                for (int ii = 0; values != null && ii < values.Length; ii++)
                {
                    value.VariantValue.Add(new Variant(values[ii]));
                }

                return(new ExtensionObject(value.TypeId, value));
            }
        }
コード例 #3
0
        /// <summary>
        /// Returns a random structure.
        /// </summary>
        private ExtensionObject GetRandomStructure()
        {
            if (_generator.GetRandomBoolean())
            {
                var value = new ScalarValueDataType {
                    BooleanValue        = _generator.GetRandom <bool>(false),
                    SByteValue          = _generator.GetRandom <sbyte>(false),
                    ByteValue           = _generator.GetRandom <byte>(false),
                    Int16Value          = _generator.GetRandom <short>(false),
                    UInt16Value         = _generator.GetRandom <ushort>(false),
                    Int32Value          = _generator.GetRandom <int>(false),
                    UInt32Value         = _generator.GetRandom <uint>(false),
                    Int64Value          = _generator.GetRandom <long>(false),
                    UInt64Value         = _generator.GetRandom <ulong>(false),
                    FloatValue          = _generator.GetRandom <float>(false),
                    DoubleValue         = _generator.GetRandom <double>(false),
                    StringValue         = _generator.GetRandom <string>(false),
                    DateTimeValue       = _generator.GetRandom <DateTime>(false),
                    GuidValue           = _generator.GetRandom <Uuid>(false),
                    ByteStringValue     = _generator.GetRandom <byte[]>(false),
                    XmlElementValue     = _generator.GetRandom <XmlElement>(false),
                    NodeIdValue         = _generator.GetRandom <NodeId>(false),
                    ExpandedNodeIdValue = _generator.GetRandom <ExpandedNodeId>(false),
                    QualifiedNameValue  = _generator.GetRandom <QualifiedName>(false),
                    LocalizedTextValue  = _generator.GetRandom <LocalizedText>(false),
                    StatusCodeValue     = _generator.GetRandom <StatusCode>(false),
                    VariantValue        = _generator.GetRandomVariant(false)
                };

                return(new ExtensionObject(value));
            }
            else
            {
                var value = new ArrayValueDataType {
                    BooleanValue        = _generator.GetRandomArray <bool>(false, 10, false),
                    SByteValue          = _generator.GetRandomArray <sbyte>(false, 10, false),
                    ByteValue           = _generator.GetRandomArray <byte>(false, 10, false),
                    Int16Value          = _generator.GetRandomArray <short>(false, 10, false),
                    UInt16Value         = _generator.GetRandomArray <ushort>(false, 10, false),
                    Int32Value          = _generator.GetRandomArray <int>(false, 10, false),
                    UInt32Value         = _generator.GetRandomArray <uint>(false, 10, false),
                    Int64Value          = _generator.GetRandomArray <long>(false, 10, false),
                    UInt64Value         = _generator.GetRandomArray <ulong>(false, 10, false),
                    FloatValue          = _generator.GetRandomArray <float>(false, 10, false),
                    DoubleValue         = _generator.GetRandomArray <double>(false, 10, false),
                    StringValue         = _generator.GetRandomArray <string>(false, 10, false),
                    DateTimeValue       = _generator.GetRandomArray <DateTime>(false, 10, false),
                    GuidValue           = _generator.GetRandomArray <Uuid>(false, 10, false),
                    ByteStringValue     = _generator.GetRandomArray <byte[]>(false, 10, false),
                    XmlElementValue     = _generator.GetRandomArray <XmlElement>(false, 10, false),
                    NodeIdValue         = _generator.GetRandomArray <NodeId>(false, 10, false),
                    ExpandedNodeIdValue = _generator.GetRandomArray <ExpandedNodeId>(false, 10, false),
                    QualifiedNameValue  = _generator.GetRandomArray <QualifiedName>(false, 10, false),
                    LocalizedTextValue  = _generator.GetRandomArray <LocalizedText>(false, 10, false),
                    StatusCodeValue     = _generator.GetRandomArray <StatusCode>(false, 10, false)
                };

                var values = _generator.GetRandomArray <object>(false, 10, false);

                for (var ii = 0; values != null && ii < values.Length; ii++)
                {
                    value.VariantValue.Add(new Variant(values[ii]));
                }

                return(new ExtensionObject(value));
            }
        }