Ejemplo n.º 1
0
        internal override RetrievalState ReadContents(EmberReader reader, ElementType actualType)
        {
            this.AssertElementType(ElementType.Node, actualType);

            while (reader.Read() && (reader.InnerNumber != InnerNumber.EndContainer))
            {
                switch (reader.GetContextSpecificOuterNumber())
                {
                case GlowNodeContents.Description.OuterNumber:
                    this.Description = reader.AssertAndReadContentsAsString();
                    break;

                case GlowNodeContents.IsRoot.OuterNumber:
                    this.IsRoot = reader.AssertAndReadContentsAsBoolean();
                    break;

                case GlowNodeContents.IsOnline.OuterNumber:
                    this.IsOnline        = reader.AssertAndReadContentsAsBoolean();
                    this.RetrievalState &= RetrievalState.Complete;
                    break;

                case GlowNodeContents.SchemaIdentifiers.OuterNumber:
                    this.ReadSchemaIdentifiers(reader);
                    break;

                default:
                    reader.Skip();
                    break;
                }
            }

            return(this.RetrievalState);
        }
Ejemplo n.º 2
0
        internal override RetrievalState ReadContents(EmberReader reader, ElementType actualType)
        {
            this.AssertElementType(ElementType.Parameter, actualType);

            ParameterType?valueType = null;
            ParameterType?enumType  = null;
            ParameterType?typeType  = null;

            while (reader.Read() && (reader.InnerNumber != InnerNumber.EndContainer))
            {
                ParameterType?dummyType;

                switch (reader.GetContextSpecificOuterNumber())
                {
                case GlowParameterContents.Description.OuterNumber:
                    this.Description = reader.AssertAndReadContentsAsString();
                    break;

                case GlowParameterContents.Value.OuterNumber:
                    this.SetProviderValue(this.ReadValue(reader, out valueType));
                    break;

                case GlowParameterContents.Minimum.OuterNumber:
                    this.SetMinimum(this.ReadValue(reader, out dummyType));
                    break;

                case GlowParameterContents.Maximum.OuterNumber:
                    this.SetMaximum(this.ReadValue(reader, out dummyType));
                    break;

                case GlowParameterContents.Access.OuterNumber:
                    this.Access = this.ReadEnum <ParameterAccess>(reader, GlowParameterContents.Access.Name);
                    break;

                case GlowParameterContents.Format.OuterNumber:
                    this.Format = reader.AssertAndReadContentsAsString();
                    break;

                case GlowParameterContents.Enumeration.OuterNumber:
                    this.EnumMapCore = ReadEnumeration(reader);
                    enumType         = ParameterType.Enum;
                    break;

                case GlowParameterContents.Factor.OuterNumber:
                    this.FactorCore = this.ReadInt(reader, GlowParameterContents.Factor.Name);
                    break;

                case GlowParameterContents.IsOnline.OuterNumber:
                    this.IsOnline = reader.AssertAndReadContentsAsBoolean();
                    var send = (this.RetrieveDetailsChangeStatus == RetrieveDetailsChangeStatus.Changed) &&
                               this.RetrieveDetails && this.StreamIdentifier.HasValue;
                    this.RetrievalState &= send ? RetrievalState.None : RetrievalState.Complete;
                    break;

                case GlowParameterContents.Formula.OuterNumber:
                    this.FormulaCore = reader.AssertAndReadContentsAsString();
                    break;

                case GlowParameterContents.Step.OuterNumber:
                    this.ReadInt(reader, GlowParameterContents.Step.Name);
                    break;

                case GlowParameterContents.Default.OuterNumber:
                    this.DefaultValue = this.ReadValue(reader, out dummyType);
                    break;

                case GlowParameterContents.Type.OuterNumber:
                    typeType = this.ReadEnum <ParameterType>(reader, GlowParameterContents.Type.Name);
                    break;

                case GlowParameterContents.StreamIdentifier.OuterNumber:
                    this.StreamIdentifier = this.ReadInt(reader, GlowParameterContents.StreamIdentifier.Name);
                    break;

                case GlowParameterContents.EnumMap.OuterNumber:
                    this.EnumMapCore = this.ReadEnumMap(reader);
                    enumType         = ParameterType.Enum;
                    break;

                case GlowParameterContents.StreamDescriptor.OuterNumber:
                    this.StreamDescriptor = this.ReadStreamDescriptor(reader);
                    break;

                case GlowParameterContents.SchemaIdentifiers.OuterNumber:
                    this.ReadSchemaIdentifiers(reader);
                    break;

                default:
                    reader.Skip();
                    break;
                }
            }

            this.SetFinalTytpe(valueType, enumType, typeType);
            return(this.RetrievalState);
        }
 internal sealed override bool?ReadValue(EmberReader reader, out ParameterType?parameterType)
 {
     parameterType = ParameterType.Boolean;
     return(reader.AssertAndReadContentsAsBoolean());
 }