예제 #1
0
        public override void SetPacket(SocketIOPacket ConstructeePacket)
        {
            if (ConstructeePacket != null)
            {
                base.SetPacket(ConstructeePacket);

                ConstructorAction EnqueueAction = new ConstructorAction((Data) => ConstructeeTokens.Enqueue(Data));
                Tuple <Condition, ConstructorAction>[] ConditionalActions = new Tuple <Condition, ConstructorAction>[]
                {
                    new Tuple <Condition, ConstructorAction>(IsPlaceholder, EnqueueAction),
                };

                DFS(ConstructeePacket.JsonData, ConditionalActions);

                if (ConstructeePacket.Attachments.Count != ConstructeeTokenCount)
                {
                    throw new SocketIOException("Attachment count is not match to placeholder count. " + this);
                }
            }
        }
예제 #2
0
        public override void SetPacket(SocketIOPacket ConstructeePacket)
        {
            if (ConstructeePacket != null)
            {
                base.SetPacket(ConstructeePacket);

                ConstructorAction EnqueueAction = new ConstructorAction((Data) => ConstructeeTokens.Enqueue(Data));
                ConstructorAction CountAction   = new ConstructorAction((Data) => PlaceholderCount++);

                Tuple <Condition, ConstructorAction>[] ConditionalActions = new Tuple <Condition, ConstructorAction>[]
                {
                    new Tuple <Condition, ConstructorAction>(IsBytes, EnqueueAction),
                    new Tuple <Condition, ConstructorAction>(IsPlaceholder, CountAction)
                };

                DFS(ConstructeePacket.JsonData, ConditionalActions);

                if (PlaceholderCount > 0)
                {
                    throw new SocketIOException("Bytes token count is not match to placeholder count. " + this);
                }
            }
        }