示例#1
0
        internal sealed override void WriteChanges(EmberWriter writer, IInvocationCollection pendingInvocations)
        {
            if (this.HasChanges)
            {
                writer.WriteStartApplicationDefinedType(
                    GlowElementCollection.Element.OuterId, GlowQualifiedParameter.InnerNumber);

                writer.WriteValue(GlowQualifiedParameter.Path.OuterId, this.NumberPath);
                writer.WriteStartSet(GlowQualifiedParameter.Contents.OuterId);

                if (this.theValue == null)
                {
                    // This can only happen when the parameter happens to be a trigger.
                    writer.WriteValue(GlowParameterContents.Value.OuterId, 0);
                }
                else
                {
                    this.WriteValue(writer, this.theValue);
                }

                writer.WriteEndContainer();
                writer.WriteEndContainer();
                this.HasChanges = false;
            }
        }
        internal override bool WriteRequest(EmberWriter writer, IStreamedParameterCollection streamedParameters)
        {
            if (this.RetrievalState.Equals(RetrievalState.None))
            {
                var isEmpty = this.children.Count == 0;

                if (isEmpty)
                {
                    writer.WriteStartApplicationDefinedType(
                        GlowElementCollection.Element.OuterId, GlowQualifiedNode.InnerNumber);
                    writer.WriteValue(GlowQualifiedNode.Path.OuterId, this.NumberPath);
                    writer.WriteStartApplicationDefinedType(
                        GlowQualifiedNode.Children.OuterId, GlowElementCollection.InnerNumber);
                }

                var result = this.WriteCommandCollection(writer, streamedParameters);

                if (isEmpty)
                {
                    writer.WriteEndContainer();
                    writer.WriteEndContainer();
                }

                return(result);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        internal sealed override void WriteChanges(EmberWriter writer, IInvocationCollection pendingInvocations)
        {
            if (this.HasChanges)
            {
                writer.WriteStartApplicationDefinedType(
                    GlowElementCollection.Element.OuterId, GlowQualifiedMatrix.InnerNumber);

                writer.WriteValue(GlowQualifiedMatrix.Path.OuterId, this.NumberPath);
                writer.WriteStartSequence(GlowQualifiedMatrix.Connections.OuterId);

                foreach (var target in this.targetsWithChangedConnections)
                {
                    writer.WriteStartApplicationDefinedType(
                        GlowConnectionCollection.Connection.OuterId, GlowConnection.InnerNumber);
                    writer.WriteValue(GlowConnection.Target.OuterId, target);
                    writer.WriteValue(GlowConnection.Sources.OuterId, this.connections[target].ToArray());
                    writer.WriteEndContainer();
                }

                writer.WriteEndContainer();
                writer.WriteEndContainer();
                this.targetsWithChangedConnections.Clear();
                this.HasChanges = false;
            }
        }
示例#4
0
        internal sealed override void WriteChanges(EmberWriter writer, IInvocationCollection pendingInvocations)
        {
            if (this.HasChanges)
            {
                writer.WriteStartApplicationDefinedType(
                    GlowElementCollection.Element.OuterId, GlowQualifiedFunction.InnerNumber);

                writer.WriteValue(GlowQualifiedFunction.Path.OuterId, this.NumberPath);
                writer.WriteStartApplicationDefinedType(
                    GlowQualifiedFunction.Children.OuterId, GlowElementCollection.InnerNumber);
                this.WriteInvocations(writer, pendingInvocations);
                writer.WriteEndContainer();
                writer.WriteEndContainer();
                this.HasChanges = false;
            }
        }
示例#5
0
        internal sealed override bool WriteRequest(EmberWriter writer, IStreamedParameterCollection streamedParameters)
        {
            if (this.RetrievalState.Equals(RetrievalState.None))
            {
                writer.WriteStartApplicationDefinedType(
                    GlowElementCollection.Element.OuterId, GlowQualifiedParameter.InnerNumber);
                writer.WriteValue(GlowQualifiedParameter.Path.OuterId, this.NumberPath);
                writer.WriteStartApplicationDefinedType(
                    GlowQualifiedParameter.Children.OuterId, GlowElementCollection.InnerNumber);
                this.WriteCommandCollection(writer, GlowCommandNumber.Subscribe, RetrievalState.Complete);
                writer.WriteEndContainer();
                writer.WriteEndContainer();
                streamedParameters.Add(this);
            }

            return(false);
        }
示例#6
0
        internal sealed override bool WriteRequest(EmberWriter writer, IStreamedParameterCollection streamedParameters)
        {
            writer.WriteStartApplicationDefinedType(GlowGlobal.Root.OuterId, GlowRootElementCollection.InnerNumber);
            var result = this.WriteCommandCollection(writer, streamedParameters);

            writer.WriteEndContainer();
            return(result);
        }
 internal void WriteCommandCollection(
     EmberWriter writer, GlowCommandNumber commandNumber, RetrievalState retrievalState)
 {
     writer.WriteStartApplicationDefinedType(GlowElementCollection.Element.OuterId, GlowCommand.InnerNumber);
     writer.WriteValue(GlowCommand.Number.OuterId, (long)commandNumber);
     writer.WriteEndContainer();
     this.RetrievalState = retrievalState;
 }
示例#8
0
 internal sealed override void WriteChanges(EmberWriter writer, IInvocationCollection pendingInvocations)
 {
     if (this.HasChanges)
     {
         writer.WriteStartApplicationDefinedType(GlowGlobal.Root.OuterId, GlowRootElementCollection.InnerNumber);
         this.WriteChangesCollection(writer, pendingInvocations);
         writer.WriteEndContainer();
         this.HasChanges = false;
     }
 }
示例#9
0
        private void WriteInvocations(EmberWriter writer, IInvocationCollection pendingInvocations)
        {
            while (this.invocations.Count > 0)
            {
                writer.WriteStartApplicationDefinedType(GlowElementCollection.Element.OuterId, GlowCommand.InnerNumber);
                writer.WriteValue(GlowCommand.Number.OuterId, 33);
                writer.WriteStartApplicationDefinedType(GlowCommand.Invocation.OuterId, GlowInvocation.InnerNumber);
                var invocation   = this.invocations.Dequeue();
                var invocationId = pendingInvocations.Add(invocation.Key);
                writer.WriteValue(GlowInvocation.InvocationId.OuterId, invocationId);
                writer.WriteStartSequence(GlowInvocation.Arguments.OuterId);

                foreach (var writeValue in invocation.Value)
                {
                    writeValue(writer);
                }

                writer.WriteEndContainer();
                writer.WriteEndContainer();
                writer.WriteEndContainer();
            }
        }