/// <summary> /// Updates my values using inverse of control pattern. /// </summary> /// <param name="update">Captures a delegated used to update the consumer variables using values decoded form the message.</param> /// <param name="length">Number of items in the data set.</param> void IMessageReader.UpdateMyValues(Func <int, IConsumerBinding> update, int length) { //UInt64 _mask = 0x1; for (int i = 0; i < length; i++) { if (EndOfMessage()) { Trace($"Unexpected end of message while reading #{i} element."); break; } //TODO: Implement ContentMask https://github.com/mpostol/OPC-UA-OOI/issues/89 //if ((ContentMask & _mask) > 0) //{ IConsumerBinding _binding = update(i); switch (MessageHeader.FieldsEncoding) { case FieldEncodingEnum.VariantFieldEncoding: ReadValueVariant(_binding); break; case FieldEncodingEnum.CompressedFieldEncoding: ReadValue(_binding); break; case FieldEncodingEnum.DataValueFieldEncoding: ReadDataValue(_binding); break; } //} //_mask = _mask << 1; } }
/// <summary> /// Gets the <see cref="IConsumerBinding" /> instance for data member. /// </summary> /// <param name="member">The field description captured by object of type <see cref="FieldMetaData"/>.</param> /// <param name="repositoryGroup">The repository group.</param> /// <param name="bindingFactory">The binding factory.</param> /// <param name="encodingFactory">The encoding factory.</param> /// <returns>An instance of <see cref="IConsumerBinding" /> type.</returns> internal static IConsumerBinding GetConsumerBinding4DataMember(this FieldMetaData member, string repositoryGroup, IBindingFactory bindingFactory, IEncodingFactory encodingFactory) { IConsumerBinding _binding = bindingFactory.GetConsumerBinding(repositoryGroup, member.ProcessValueName, member.TypeInformation); encodingFactory.UpdateValueConverter(_binding, repositoryGroup, member.TypeInformation); return(_binding); }
/// <summary> /// Creates new instance of <see cref="NetworkVariableEventSource{T}" /> /// </summary> /// <param name="consumerBinding">Wrapped consumer binding.</param> /// <param name="variableName">The name of the variable which binding is being warpped.</param> public NetworkVariableEventSource(IConsumerBinding consumerBinding, string variableName) { Name = variableName; _monitoredValue = (ConsumerBindingMonitoredValue <T>)consumerBinding; _monitoredValue.PropertyChanged += MonitoredValueOnPropertyChanged; }
private void ReadValueVariant(IConsumerBinding consumerBinding) { IVariant _ret = m_UADecoder.ReadVariant(this); AssertTypeMach(_ret.UATypeInfo, consumerBinding.Encoding); consumerBinding.Assign2Repository(_ret.Value); }
/// <summary> /// Updates my values using inverse of control pattern. /// </summary> /// <param name="update">Captures a delegated used to update the consumer variables using values decoded form the message.</param> /// <param name="length">Number of items in the data set.</param> void IMessageReader.UpdateMyValues(Func <int, IConsumerBinding> update, int length) { //UInt64 _mask = 0x1; for (int i = 0; i < length; i++) { if (EndOfMessage()) { Diagnostics.ReactiveNetworkingEventSource.Log.MessageInconsistency(i); break; } //TODO: Implement ContentMask https://github.com/mpostol/OPC-UA-OOI/issues/89 //if ((ContentMask & _mask) > 0) //{ IConsumerBinding _binding = update(i); switch (MessageHeader.FieldsEncoding) { case FieldEncodingEnum.VariantFieldEncoding: ReadValueVariant(_binding); break; case FieldEncodingEnum.CompressedFieldEncoding: ReadValue(_binding); break; case FieldEncodingEnum.DataValueFieldEncoding: ReadDataValue(_binding); break; } //} //_mask = _mask << 1; } }
public void GetConsumerBindingSerializationTest() { using (AzureGatewaySemanticEventSource log = AzureGatewaySemanticEventSource.Log()) using (EventListener lisner = new EventListener()) { //setup log instrumentation List <EventWrittenEventArgs> eventsList = new List <EventWrittenEventArgs>(); lisner.EventWritten += (source, entry) => eventsList.Add(entry); Assert.AreEqual <int>(0, eventsList.Count); lisner.EnableEvents(log, EventLevel.LogAlways, EventKeywords.All); PartBindingFactory newInstance = new PartBindingFactory(); string repositoryName = "RepositoryGroup -tHttp1 -dAzureDeviceId -sAzureScopeId -pAzurePrimaryKey -kAzureSecondaryKey -i2000"; IConsumerBinding binding = newInstance.GetConsumerBinding(repositoryName, "processValueName", new UATypeInfo(BuiltInType.String)); Assert.IsNotNull(binding); binding.Assign2Repository("New value"); string dto = newInstance.GetDTO(repositoryName); Debug.Write(dto); Assert.AreEqual <int>(32, dto.Length); Assert.AreEqual <string>("{\"processValueName\":\"New value\"}", dto); Assert.AreEqual <int>(2, eventsList.Count); EventWrittenEventArgs eventArgs = eventsList[0]; Assert.AreEqual <string>(nameof(AzureGatewaySemanticEventSource.EnteringMethodBinding), eventArgs.EventName); Assert.AreEqual <string>("Entering method PartBindingFactory.GetConsumerBinding", String.Format(eventArgs.Message, eventArgs.Payload.Select <object, string>(x => x.ToString()).ToArray <string>())); eventArgs = eventsList[1]; Assert.AreEqual <string>(nameof(AzureGatewaySemanticEventSource.EnteringMethodBinding), eventArgs.EventName); Assert.AreEqual <string>("Entering method PartBindingFactory.GetDTO", String.Format(eventArgs.Message, eventArgs.Payload.Select <object, string>(x => x.ToString()).ToArray <string>())); } }
public void UpdateMyValues(Func <int, IConsumerBinding> update, int length) { for (int i = 0; i < length; i++) { IConsumerBinding _bind = update(i); _bind.Assign2Repository(m_Message[i]); } }
public void BinaryUDPPackageReaderTestMethod() { int _port = 35678; UInt32 _dataId = CommonDefinitions.DataSetId; List <string> _Events = new List <string>(); using (BinaryUDPPackageReader _reader = new BinaryUDPPackageReader(_port, z => _Events.Add(z))) { Assert.IsNotNull(_reader); Assert.AreEqual <int>(0, _reader.m_NumberOfSentBytes); Assert.AreEqual <int>(0, _reader.m_NumberOfAttachToNetwork); Assert.AreEqual <int>(0, _reader.m_NumberOfSentMessages); Assert.AreEqual <HandlerState>(HandlerState.Disabled, _reader.State.State); _reader.AttachToNetwork(); Assert.AreEqual <HandlerState>(HandlerState.Operational, _reader.State.State); Assert.AreEqual <int>(1, _reader.m_NumberOfAttachToNetwork); Assert.AreEqual <int>(0, _reader.m_NumberOfSentBytes); Assert.AreEqual <int>(0, _reader.m_NumberOfSentMessages); object[] _buffer = new object[CommonDefinitions.TestValues.Length]; IConsumerBinding[] _bindings = new IConsumerBinding[_buffer.Length]; Action <object, int> _assign = (x, y) => _buffer[y] = x; for (int i = 0; i < _buffer.Length; i++) { _bindings[i] = new ConsumerBinding(i, _assign, Type.GetTypeCode(CommonDefinitions.TestValues[i].GetType())); } int _redItems = 0; _reader.ReadMessageCompleted += (x, y) => _reader_ReadMessageCompleted(x, y, _dataId, (z) => { _redItems++; return(_bindings[z]); }, _buffer.Length); _reader.SendUDPMessage(CommonDefinitions.GetTestBinaryArrayVariant(), _dataId, _port); Assert.AreEqual <int>(1, _reader.m_NumberOfAttachToNetwork); Assert.AreEqual <int>(116, _reader.m_NumberOfSentBytes); Assert.AreEqual <int>(1, _reader.m_NumberOfSentMessages); Thread.Sleep(1500); foreach (string _item in _Events) { Console.WriteLine(_item); } //test packet content Assert.AreEqual <Guid>(CommonDefinitions.TestGuid, _reader.Header.PublisherId); Assert.AreEqual <byte>(MessageHandling.CommonDefinitions.ProtocolVersion, _reader.Header.ProtocolVersion); Assert.AreEqual <byte>(0, _reader.Header.NetworkMessageFlags); Assert.AreEqual <UInt32>(0, _reader.Header.SecurityTokenId); Assert.AreEqual <ushort>(1, _reader.Header.NonceLength); Assert.AreEqual <int>(1, _reader.Header.Nonce.Length); Assert.AreEqual <byte>(0xcc, _reader.Header.Nonce[0]); Assert.AreEqual <ushort>(1, _reader.Header.MessageCount); Assert.AreEqual <int>(1, _reader.Header.DataSetWriterIds.Count); Assert.AreEqual <UInt32>(CommonDefinitions.DataSetId, _reader.Header.DataSetWriterIds[0]); Assert.AreEqual <int>(_buffer.Length, _redItems); object[] _shouldBeInBuffer = CommonDefinitions.TestValues; Assert.AreEqual <int>(_shouldBeInBuffer.Length, _buffer.Length); Assert.AreEqual <string>(String.Join(",", _shouldBeInBuffer), String.Join(",", _buffer)); Assert.AreEqual <byte>(1, _reader.Header.MessageCount); Assert.AreEqual <int>(3, _Events.Count); } Thread.Sleep(150); Assert.AreEqual <int>(3, _Events.Count); }
public void GetConsumerBindingTest() { ConsumerBindingFactory factory = new ConsumerBindingFactory(null, _configuration); factory.Initialise(_consumerViewModel); UATypeInfo typeInfo = new UATypeInfo(BuiltInType.Byte, -1, new int[] { }); IConsumerBinding binding = factory.GetConsumerBinding(_typeMetadata.RepositoryGroupName, _typeMetadata.TypeName, typeInfo); Assert.NotNull(binding); }
public void BinaryUDPPackageReaderTestMethod() { int _port = 35678; UInt32 _dataId = CommonDefinitions.DataSetId; List<string> _Events = new List<string>(); using (BinaryUDPPackageReader _reader = new BinaryUDPPackageReader(_port, z => _Events.Add(z))) { Assert.IsNotNull(_reader); Assert.AreEqual<int>(0, _reader.m_NumberOfSentBytes); Assert.AreEqual<int>(0, _reader.m_NumberOfAttachToNetwork); Assert.AreEqual<int>(0, _reader.m_NumberOfSentMessages); Assert.AreEqual<HandlerState>(HandlerState.Disabled, _reader.State.State); _reader.AttachToNetwork(); Assert.AreEqual<HandlerState>(HandlerState.Operational, _reader.State.State); Assert.AreEqual<int>(1, _reader.m_NumberOfAttachToNetwork); Assert.AreEqual<int>(0, _reader.m_NumberOfSentBytes); Assert.AreEqual<int>(0, _reader.m_NumberOfSentMessages); object[] _buffer = new object[CommonDefinitions.TestValues.Length]; IConsumerBinding[] _bindings = new IConsumerBinding[_buffer.Length]; Action<object, int> _assign = (x, y) => _buffer[y] = x; for (int i = 0; i < _buffer.Length; i++) _bindings[i] = new ConsumerBinding(i, _assign, Type.GetTypeCode(CommonDefinitions.TestValues[i].GetType())); int _redItems = 0; _reader.ReadMessageCompleted += (x, y) => _reader_ReadMessageCompleted(x, y, _dataId, (z) => { _redItems++; return _bindings[z]; }, _buffer.Length); _reader.SendUDPMessage(CommonDefinitions.GetTestBinaryArrayVariant(), _dataId, _port); Assert.AreEqual<int>(1, _reader.m_NumberOfAttachToNetwork); Assert.AreEqual<int>(116, _reader.m_NumberOfSentBytes); Assert.AreEqual<int>(1, _reader.m_NumberOfSentMessages); Thread.Sleep(1500); foreach (string _item in _Events) Console.WriteLine(_item); //test packet content Assert.AreEqual<Guid>(CommonDefinitions.TestGuid, _reader.Header.PublisherId); Assert.AreEqual<byte>(MessageHandling.CommonDefinitions.ProtocolVersion, _reader.Header.ProtocolVersion); Assert.AreEqual<byte>(0, _reader.Header.NetworkMessageFlags); Assert.AreEqual<UInt32>(0, _reader.Header.SecurityTokenId); Assert.AreEqual<ushort>(1, _reader.Header.NonceLength); Assert.AreEqual<int>(1, _reader.Header.Nonce.Length); Assert.AreEqual<byte>(0xcc, _reader.Header.Nonce[0]); Assert.AreEqual<ushort>(1, _reader.Header.MessageCount); Assert.AreEqual<int>(1, _reader.Header.DataSetWriterIds.Count); Assert.AreEqual<UInt32>(CommonDefinitions.DataSetId, _reader.Header.DataSetWriterIds[0]); Assert.AreEqual<int>(_buffer.Length, _redItems); object[] _shouldBeInBuffer = CommonDefinitions.TestValues; Assert.AreEqual<int>(_shouldBeInBuffer.Length, _buffer.Length); Assert.AreEqual<string>(String.Join(",", _shouldBeInBuffer), String.Join(",", _buffer)); Assert.AreEqual<byte>(1, _reader.Header.MessageCount); Assert.AreEqual<int>(3, _Events.Count); } Thread.Sleep(150); Assert.AreEqual<int>(3, _Events.Count); }
public void DataRepositoryTestMethod() { DataRepository _rpo = new DataRepository(); IConsumerBinding _nb = _rpo.GetConsumerBinding(String.Empty, DataRepository.name, new UATypeInfo(BuiltInType.String)); Assert.IsNotNull(_nb); Assert.IsNotNull(_nb.Encoding); _nb.Converter = null; Assert.AreEqual <BuiltInType>(BuiltInType.String, _nb.Encoding.BuiltInType); string _testValue = "123wjkqjwkqjwjqjwqwjwqkwqjw"; _nb.Assign2Repository(_testValue); Assert.AreEqual <string>(_testValue, _rpo.Buffer); }
public void ToStringCLRArrayRankErrorTestMethod() { ConsumerBindingMonitoredValue <Int32[, , ]> _binding = new ConsumerBindingMonitoredValue <int[, , ]>(new UATypeInfo(BuiltInType.Int32, 0, new int[] { int.MaxValue, int.MaxValue, int.MaxValue })); string _name = String.Empty; _binding.PropertyChanged += (sender, e) => _name = e.PropertyName; Assert.IsNotNull(_binding); IConsumerBinding _bindingInterface = _binding; Array _newValue = new int[, ] { { 1, 2 }, { 3, 4 } }; _bindingInterface.Assign2Repository(_newValue); }
public void DataTransferTest() { uint _dataId = CommonDefinitions.DataSetId; BinaryDataTransferGraphReceiverFixture _BinaryDataTransferGraphReceiverFixture = new DTGFixture(); using (BinaryDecoder _reader = new BinaryDecoder(_BinaryDataTransferGraphReceiverFixture, new Helpers.UABinaryDecoderImplementation())) { Assert.IsNotNull(_reader); Assert.AreEqual <int>(0, _BinaryDataTransferGraphReceiverFixture.m_NumberOfSentBytes); Assert.AreEqual <int>(0, _BinaryDataTransferGraphReceiverFixture.NumberOfAttachToNetwork); Assert.AreEqual <int>(0, _BinaryDataTransferGraphReceiverFixture.m_NumberOfSentMessages); Assert.AreEqual <HandlerState>(HandlerState.Disabled, _BinaryDataTransferGraphReceiverFixture.State.State); _reader.AttachToNetwork(); _reader.State.Enable(); Assert.AreEqual <HandlerState>(HandlerState.Operational, _BinaryDataTransferGraphReceiverFixture.State.State); Assert.AreEqual <int>(1, _BinaryDataTransferGraphReceiverFixture.NumberOfAttachToNetwork); Assert.AreEqual <int>(0, _BinaryDataTransferGraphReceiverFixture.m_NumberOfSentBytes); Assert.AreEqual <int>(0, _BinaryDataTransferGraphReceiverFixture.m_NumberOfSentMessages); object[] _buffer = new object[CommonDefinitions.TestValues.Length]; IConsumerBinding[] _bindings = new IConsumerBinding[_buffer.Length]; Action <object, int> _assign = (x, y) => _buffer[y] = x; for (int i = 0; i < _buffer.Length; i++) { _bindings[i] = new ConsumerBinding(i, _assign, Type.GetTypeCode(CommonDefinitions.TestValues[i].GetType())); } int _redItems = 0; _reader.ReadMessageCompleted += (x, y) => _reader_ReadMessageCompleted(x, y, _dataId, (z) => { _redItems++; return(_bindings[z]); }, _buffer.Length); _BinaryDataTransferGraphReceiverFixture.SendUDPMessage(CommonDefinitions.GetTestBinaryArrayVariant(), _dataId); Assert.AreEqual <int>(1, _BinaryDataTransferGraphReceiverFixture.NumberOfAttachToNetwork); Assert.AreEqual <int>(116, _BinaryDataTransferGraphReceiverFixture.m_NumberOfSentBytes); Assert.AreEqual <int>(1, _BinaryDataTransferGraphReceiverFixture.m_NumberOfSentMessages); //test packet content PacketHeader _readerHeader = _reader.Header; Assert.AreEqual <Guid>(CommonDefinitions.TestGuid, _readerHeader.PublisherId); Assert.AreEqual <byte>(MessageHandling.CommonDefinitions.ProtocolVersion, _readerHeader.ProtocolVersion); Assert.AreEqual <byte>(0, _readerHeader.NetworkMessageFlags); Assert.AreEqual <uint>(0, _readerHeader.SecurityTokenId); Assert.AreEqual <ushort>(1, _readerHeader.NonceLength); Assert.AreEqual <int>(1, _readerHeader.Nonce.Length); Assert.AreEqual <byte>(0xcc, _readerHeader.Nonce[0]); Assert.AreEqual <ushort>(1, _readerHeader.MessageCount); Assert.AreEqual <int>(1, _readerHeader.DataSetWriterIds.Count); Assert.AreEqual <uint>(CommonDefinitions.DataSetId, _readerHeader.DataSetWriterIds[0]); Assert.AreEqual <int>(_buffer.Length, _redItems); object[] _shouldBeInBuffer = CommonDefinitions.TestValues; Assert.AreEqual <int>(_shouldBeInBuffer.Length, _buffer.Length); Assert.AreEqual <string>(string.Join(",", _shouldBeInBuffer), string.Join(",", _buffer)); Assert.AreEqual <byte>(1, _readerHeader.MessageCount); } }
public void ToStringScalarTestMethod() { ConsumerBindingMonitoredValue <Int32> _binding = new ConsumerBindingMonitoredValue <int>(new UATypeInfo(BuiltInType.Int32)); string _name = String.Empty; _binding.PropertyChanged += (sender, e) => _name = e.PropertyName; Assert.IsNotNull(_binding); IConsumerBinding _bindingInterface = _binding; const int _newValue = 1234567; _bindingInterface.Assign2Repository(_newValue); Assert.AreEqual <int>(_newValue, _binding.Value); Assert.AreEqual <string>(_newValue.ToString(), _binding.ToString()); Assert.AreEqual <string>("Value", _name); }
public void RecordingRepositoryTestMethod() { RecordingRepository _rpo = new RecordingRepository(); IConsumerBinding _nb = _rpo.GetConsumerBinding(String.Empty, DataRepository.name, new UATypeInfo(BuiltInType.String)); Assert.IsNotNull(_nb); Assert.IsNotNull(_nb.Encoding); _nb.Converter = new DateFormatter(); Assert.AreEqual <BuiltInType>(BuiltInType.String, _nb.Encoding.BuiltInType); DateTime _dt = new DateTime(2008, 2, 5); Recording _testValue = new Recording("Chris Sells", "Chris Sells Live", _dt); _nb.Assign2Repository(_testValue); Assert.AreEqual <string>(_dt.ToString(CultureInfo.InvariantCulture), _rpo.Buffer); }
public void ToStringCLRArrayTestMethod() { ConsumerBindingMonitoredValue <Int32[]> _binding = new ConsumerBindingMonitoredValue <int[]>(new UATypeInfo(BuiltInType.Int32, 1)); string _name = String.Empty; _binding.PropertyChanged += (sender, e) => _name = e.PropertyName; Assert.IsNotNull(_binding); IConsumerBinding _bindingInterface = _binding; Array _newValue = new int[] { 1234567, 7654321 }; _bindingInterface.Assign2Repository(_newValue); CollectionAssert.AreEqual(_newValue, _binding.Value); Assert.AreEqual <string>(@"Array Rank=1 Values [1234567, 7654321]", _binding.ToString()); Assert.AreEqual <string>("Value", _name); }
public void ToStringCLRArrayRank3TestMethod() { ConsumerBindingMonitoredValue <Int32[, , ]> _binding = new ConsumerBindingMonitoredValue <int[, , ]>(new UATypeInfo(BuiltInType.Int32, 0, new int[] { int.MaxValue, int.MaxValue, int.MaxValue })); string _name = String.Empty; _binding.PropertyChanged += (sender, e) => _name = e.PropertyName; Assert.IsNotNull(_binding); IConsumerBinding _bindingInterface = _binding; Array _newValue = new int[, , ] { { { 1, 2 }, { 3, 4 } }, { { 5, 6 }, { 7, 8 } } }; _bindingInterface.Assign2Repository(_newValue); CollectionAssert.AreEqual(_newValue, _binding.Value); Assert.AreEqual <string>(@"Array Rank=3 Values [1, 2, 3, 4, 5, 6, 7, 8]", _binding.ToString()); Assert.AreEqual <string>("Value", _name); }
/// <summary> /// Helper method that creates the consumer binding. /// </summary> /// <param name="variableName">Name of the variable.</param> /// <param name="typeInfo">The encoding.</param> /// <returns>IConsumerBinding.</returns> /// <exception cref="System.ArgumentOutOfRangeException">variableName</exception> public IConsumerBinding GetConsumerBinding(string variableName, UATypeInfo typeInfo) { IConsumerBinding _return = null; if (typeInfo.ValueRank == 0 || typeInfo.ValueRank > 1) { throw new ArgumentOutOfRangeException(nameof(typeInfo.ValueRank)); } switch (typeInfo.BuiltInType) { case BuiltInType.Boolean: if (typeInfo.ValueRank < 0) { _return = AddBinding <Boolean>(variableName, typeInfo); } else { _return = AddBinding <Boolean[]>(variableName, typeInfo); } break; case BuiltInType.SByte: if (typeInfo.ValueRank < 0) { _return = AddBinding <SByte>(variableName, typeInfo); } else { _return = AddBinding <SByte[]>(variableName, typeInfo); } break; case BuiltInType.Byte: if (typeInfo.ValueRank < 0) { _return = AddBinding <Byte>(variableName, typeInfo); } else { _return = AddBinding <Byte[]>(variableName, typeInfo); } break; case BuiltInType.Int16: if (typeInfo.ValueRank < 0) { _return = AddBinding <Int16>(variableName, typeInfo); } else { _return = AddBinding <Int16[]>(variableName, typeInfo); } break; case BuiltInType.UInt16: if (typeInfo.ValueRank < 0) { _return = AddBinding <UInt16>(variableName, typeInfo); } else { _return = AddBinding <UInt16[]>(variableName, typeInfo); } break; case BuiltInType.Int32: if (typeInfo.ValueRank < 0) { _return = AddBinding <Int32>(variableName, typeInfo); } else { _return = AddBinding <Int32[]>(variableName, typeInfo); } break; case BuiltInType.UInt32: if (typeInfo.ValueRank < 0) { _return = AddBinding <UInt32>(variableName, typeInfo); } else { _return = AddBinding <UInt32[]>(variableName, typeInfo); } break; case BuiltInType.Int64: if (typeInfo.ValueRank < 0) { _return = AddBinding <Int64>(variableName, typeInfo); } else { _return = AddBinding <Int64[]>(variableName, typeInfo); } break; case BuiltInType.UInt64: if (typeInfo.ValueRank < 0) { _return = AddBinding <UInt64>(variableName, typeInfo); } else { _return = AddBinding <UInt64[]>(variableName, typeInfo); } break; case BuiltInType.Float: if (typeInfo.ValueRank < 0) { _return = AddBinding <float>(variableName, typeInfo); } else { _return = AddBinding <float[]>(variableName, typeInfo); } break; case BuiltInType.Double: if (typeInfo.ValueRank < 0) { _return = AddBinding <Double>(variableName, typeInfo); } else { _return = AddBinding <Double[]>(variableName, typeInfo); } break; case BuiltInType.String: if (typeInfo.ValueRank < 0) { _return = AddBinding <String>(variableName, typeInfo); } else { _return = AddBinding <String[]>(variableName, typeInfo); } break; case BuiltInType.DateTime: if (typeInfo.ValueRank < 0) { _return = AddBinding <DateTime>(variableName, typeInfo); } else { _return = AddBinding <DateTime[]>(variableName, typeInfo); } break; case BuiltInType.Guid: if (typeInfo.ValueRank < 0) { _return = AddBinding <Guid>(variableName, typeInfo); } else { _return = AddBinding <Guid[]>(variableName, typeInfo); } break; case BuiltInType.ByteString: if (typeInfo.ValueRank < 0) { _return = AddBinding <byte[]>(variableName, typeInfo); } else { _return = AddBinding <byte[][]>(variableName, typeInfo); } break; case BuiltInType.Null: case BuiltInType.XmlElement: case BuiltInType.NodeId: case BuiltInType.ExpandedNodeId: case BuiltInType.StatusCode: case BuiltInType.QualifiedName: case BuiltInType.LocalizedText: case BuiltInType.ExtensionObject: case BuiltInType.DataValue: case BuiltInType.Variant: case BuiltInType.DiagnosticInfo: case BuiltInType.Enumeration: default: throw new ArgumentOutOfRangeException("encoding"); } return(_return); }
/// <summary> /// Helper method that creates the consumer binding. /// </summary> /// <param name="variableName">Name of the variable.</param> /// <param name="typeInfo">The encoding.</param> /// <returns>IConsumerBinding.</returns> /// <exception cref="System.ArgumentOutOfRangeException">variableName</exception> private IConsumerBinding GetConsumerBinding(string variableName, UATypeInfo typeInfo) { _logger.EnteringMethodBinding(); IConsumerBinding returnValue = null; if (typeInfo.ValueRank == 0 || typeInfo.ValueRank > 1) { ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException(nameof(typeInfo.ValueRank)); _logger.LogException(nameof(PartIBindingFactory), ex); throw ex; } switch (typeInfo.BuiltInType) { case BuiltInType.Boolean: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <bool>(variableName, typeInfo); } else { returnValue = AddBinding <bool[]>(variableName, typeInfo); } break; case BuiltInType.SByte: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <sbyte>(variableName, typeInfo); } else { returnValue = AddBinding <sbyte[]>(variableName, typeInfo); } break; case BuiltInType.Byte: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <byte>(variableName, typeInfo); } else { returnValue = AddBinding <byte[]>(variableName, typeInfo); } break; case BuiltInType.Int16: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <short>(variableName, typeInfo); } else { returnValue = AddBinding <short[]>(variableName, typeInfo); } break; case BuiltInType.UInt16: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <ushort>(variableName, typeInfo); } else { returnValue = AddBinding <ushort[]>(variableName, typeInfo); } break; case BuiltInType.Int32: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <int>(variableName, typeInfo); } else { returnValue = AddBinding <int[]>(variableName, typeInfo); } break; case BuiltInType.UInt32: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <uint>(variableName, typeInfo); } else { returnValue = AddBinding <uint[]>(variableName, typeInfo); } break; case BuiltInType.Int64: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <long>(variableName, typeInfo); } else { returnValue = AddBinding <long[]>(variableName, typeInfo); } break; case BuiltInType.UInt64: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <ulong>(variableName, typeInfo); } else { returnValue = AddBinding <ulong[]>(variableName, typeInfo); } break; case BuiltInType.Float: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <float>(variableName, typeInfo); } else { returnValue = AddBinding <float[]>(variableName, typeInfo); } break; case BuiltInType.Double: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <double>(variableName, typeInfo); } else { returnValue = AddBinding <double[]>(variableName, typeInfo); } break; case BuiltInType.String: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <string>(variableName, typeInfo); } else { returnValue = AddBinding <string[]>(variableName, typeInfo); } break; case BuiltInType.DateTime: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <DateTime>(variableName, typeInfo); } else { returnValue = AddBinding <DateTime[]>(variableName, typeInfo); } break; case BuiltInType.Guid: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <Guid>(variableName, typeInfo); } else { returnValue = AddBinding <Guid[]>(variableName, typeInfo); } break; case BuiltInType.ByteString: if (typeInfo.ValueRank < 0) { returnValue = AddBinding <byte[]>(variableName, typeInfo); } else { returnValue = AddBinding <byte[][]>(variableName, typeInfo); } break; case BuiltInType.Null: case BuiltInType.XmlElement: case BuiltInType.NodeId: case BuiltInType.ExpandedNodeId: case BuiltInType.StatusCode: case BuiltInType.QualifiedName: case BuiltInType.LocalizedText: case BuiltInType.ExtensionObject: case BuiltInType.DataValue: case BuiltInType.Variant: case BuiltInType.DiagnosticInfo: case BuiltInType.Enumeration: default: throw new ArgumentOutOfRangeException("encoding"); } return(returnValue); }
private void ReadDataValue(IConsumerBinding _binding) { throw new NotImplementedException(); }
private void ReadValue(IConsumerBinding consumerBinding) { object _value = null; switch (consumerBinding.Encoding.BuiltInType) { case BuiltInType.Boolean: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadBoolean(); else _value = m_UADecoder.ReadArray(this, ReadBoolean, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.SByte: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadSByte(); else _value = m_UADecoder.ReadArray(this, ReadSByte, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.Byte: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadByte(); else _value = m_UADecoder.ReadArray(this, ReadByte, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.Int16: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadInt16(); else _value = m_UADecoder.ReadArray(this, ReadInt16, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.UInt16: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadUInt16(); else _value = m_UADecoder.ReadArray(this, ReadUInt16, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.Int32: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadInt32(); else _value = m_UADecoder.ReadArray(this, ReadInt32, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.UInt32: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadUInt32(); else _value = m_UADecoder.ReadArray(this, ReadUInt32, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.Int64: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadInt64(); else _value = m_UADecoder.ReadArray(this, ReadInt64, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.UInt64: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadUInt64(); else _value = m_UADecoder.ReadArray(this, ReadUInt64, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.Float: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadSingle(); else _value = m_UADecoder.ReadArray(this, ReadSingle, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.Double: if (consumerBinding.Encoding.ValueRank < 0) _value = ReadDouble(); else _value = m_UADecoder.ReadArray(this, ReadDouble, consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.String: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadString(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadString(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.DateTime: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadDateTime(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadDateTime(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.Guid: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadGuid(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadGuid(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.ByteString: if (consumerBinding.Encoding.ValueRank < 0) m_UADecoder.ReadByteString(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadByteString(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.XmlElement: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadXmlElement(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadXmlElement(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.NodeId: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadNodeId(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadNodeId(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.ExpandedNodeId: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadExpandedNodeId(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadExpandedNodeId(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.StatusCode: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadStatusCode(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadStatusCode(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.QualifiedName: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadQualifiedName(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadQualifiedName(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.LocalizedText: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadLocalizedText(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadLocalizedText(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.ExtensionObject: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadExtensionObject(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadExtensionObject(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.DataValue: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadDataValue(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadDataValue(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.Variant: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadVariant(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadVariant(this), consumerBinding.Encoding.ValueRank > 1); break; case BuiltInType.DiagnosticInfo: if (consumerBinding.Encoding.ValueRank < 0) _value = m_UADecoder.ReadDiagnosticInfo(this); else _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadDiagnosticInfo(this), consumerBinding.Encoding.ValueRank > 1); break; default: throw new ArgumentOutOfRangeException(string.Format("Impossible to convert the type {0}", consumerBinding.Encoding)); } consumerBinding.Assign2Repository(_value); }
private void ReadValue(IConsumerBinding consumerBinding) { object _value = null; switch (consumerBinding.Encoding.BuiltInType) { case BuiltInType.Boolean: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadBoolean(); } else { _value = m_UADecoder.ReadArray(this, ReadBoolean, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.SByte: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadSByte(); } else { _value = m_UADecoder.ReadArray(this, ReadSByte, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.Byte: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadByte(); } else { _value = m_UADecoder.ReadArray(this, ReadByte, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.Int16: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadInt16(); } else { _value = m_UADecoder.ReadArray(this, ReadInt16, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.UInt16: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadUInt16(); } else { _value = m_UADecoder.ReadArray(this, ReadUInt16, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.Int32: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadInt32(); } else { _value = m_UADecoder.ReadArray(this, ReadInt32, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.UInt32: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadUInt32(); } else { _value = m_UADecoder.ReadArray(this, ReadUInt32, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.Int64: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadInt64(); } else { _value = m_UADecoder.ReadArray(this, ReadInt64, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.UInt64: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadUInt64(); } else { _value = m_UADecoder.ReadArray(this, ReadUInt64, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.Float: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadSingle(); } else { _value = m_UADecoder.ReadArray(this, ReadSingle, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.Double: if (consumerBinding.Encoding.ValueRank < 0) { _value = ReadDouble(); } else { _value = m_UADecoder.ReadArray(this, ReadDouble, consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.String: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadString(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadString(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.DateTime: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadDateTime(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadDateTime(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.Guid: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadGuid(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadGuid(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.ByteString: if (consumerBinding.Encoding.ValueRank < 0) { m_UADecoder.ReadByteString(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadByteString(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.XmlElement: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadXmlElement(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadXmlElement(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.NodeId: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadNodeId(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadNodeId(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.ExpandedNodeId: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadExpandedNodeId(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadExpandedNodeId(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.StatusCode: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadStatusCode(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadStatusCode(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.QualifiedName: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadQualifiedName(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadQualifiedName(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.LocalizedText: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadLocalizedText(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadLocalizedText(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.ExtensionObject: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadExtensionObject(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadExtensionObject(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.DataValue: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadDataValue(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadDataValue(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.Variant: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadVariant(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadVariant(this), consumerBinding.Encoding.ValueRank > 1); } break; case BuiltInType.DiagnosticInfo: if (consumerBinding.Encoding.ValueRank < 0) { _value = m_UADecoder.ReadDiagnosticInfo(this); } else { _value = m_UADecoder.ReadArray(this, () => m_UADecoder.ReadDiagnosticInfo(this), consumerBinding.Encoding.ValueRank > 1); } break; default: throw new ArgumentOutOfRangeException(string.Format("Impossible to convert the type {0}", consumerBinding.Encoding)); } consumerBinding.Assign2Repository(_value); }
/// <summary> /// Gets the binding captured by an instance of the <see cref="T:UAOOI.Networking.SemanticData.DataRepository.IConsumerBinding" /> type used by the consumer to save the data in the data repository. /// </summary> /// <param name="repositoryGroup">It is the name of a repository group profiling the configuration behavior, e.g. encoders selection. /// The configuration of the repositories belonging to the same group are handled according to the same profile.</param> /// <param name="processValueName">The name of a variable that is the ultimate destination of the values recovered from messages. /// Must be unique in the context of the group named by <paramref name="repositoryGroup" />.</param> /// <param name="fieldTypeInfo">The field metadata definition represented as an object of <see cref="T:UAOOI.Configuration.Networking.Serialization.UATypeInfo" />.</param> /// <returns>Returns an object implementing the <see cref="T:UAOOI.Networking.SemanticData.DataRepository.IConsumerBinding" /> interface that can be used to update selected variable on the factory side.</returns> /// <exception cref="NotImplementedException"></exception> public IConsumerBinding GetConsumerBinding(string repositoryGroup, string processValueName, UATypeInfo fieldTypeInfo) { _log.EnteringMethodBinding(); IConsumerBinding _return = null; if (fieldTypeInfo.ValueRank == 0 || fieldTypeInfo.ValueRank > 1) { throw new ArgumentOutOfRangeException(nameof(fieldTypeInfo.ValueRank)); } switch (fieldTypeInfo.BuiltInType) { case BuiltInType.Boolean: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <bool>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <bool[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.SByte: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <sbyte>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <sbyte[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.Byte: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <byte>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <byte[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.Int16: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <short>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <short[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.UInt16: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <ushort>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <ushort[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.Int32: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <int>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <int[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.UInt32: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <uint>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <uint[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.Int64: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <long>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <long[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.UInt64: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <ulong>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <ulong[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.Float: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <float>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <float[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.Double: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <double>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <double[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.String: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <string>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <string[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.DateTime: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <DateTime>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <DateTime[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.Guid: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <Guid>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <Guid[]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.ByteString: if (fieldTypeInfo.ValueRank < 0) { _return = AddBinding <byte[]>(repositoryGroup, processValueName, fieldTypeInfo); } else { _return = AddBinding <byte[][]>(repositoryGroup, processValueName, fieldTypeInfo); } break; case BuiltInType.Null: case BuiltInType.XmlElement: case BuiltInType.NodeId: case BuiltInType.ExpandedNodeId: case BuiltInType.StatusCode: case BuiltInType.QualifiedName: case BuiltInType.LocalizedText: case BuiltInType.ExtensionObject: case BuiltInType.DataValue: case BuiltInType.Variant: case BuiltInType.DiagnosticInfo: case BuiltInType.Enumeration: default: throw new ArgumentOutOfRangeException("encoding"); } return(_return); }