Opc.Ua.JsonDecoder.ReadQualifiedName C# (CSharp) Method

ReadQualifiedName() public method

Reads an QualifiedName from the stream.
public ReadQualifiedName ( string fieldName ) : Opc.Ua.QualifiedName
fieldName string
return Opc.Ua.QualifiedName
        public QualifiedName ReadQualifiedName(string fieldName)
        {
            object token = null;

            if (!ReadField(fieldName, out token))
            {
                return null;
            }

            var value = token as Dictionary<string, object>;

            if (value == null)
            {
                return null;
            }

            int index = -1;
            string name = null;

            object field = null;

            if (!value.TryGetValue("Name", out field))
            {
                return null;
            }

            name = field as string;

            if (value.TryGetValue("Uri", out field))
            {
                index = m_context.NamespaceUris.GetIndex(field as string);
            }
            else if (value.TryGetValue("Index", out field))
            {
                var number = field as long?;

                if (number != null)
                {
                    index = (int)number;
                }
            }

            if (index == 0)
            {
                return new QualifiedName(name);
            }

            if (m_namespaceMappings != null && index < m_namespaceMappings.Length)
            {
                index = m_namespaceMappings[index];
            }

            return new QualifiedName(name, (ushort)index);
        }