Ejemplo n.º 1
0
        public static DataFrameColumnBase Create(DataFrameType type, DataFrame owner, int capacity, int fillSize)
        {
            switch (type)
            {
            case DataFrameType.Object: return(new DataFrameColumn <Object>(owner, capacity, fillSize));

            case DataFrameType.Decimal: return(new DataFrameColumn <Decimal>(owner, capacity, fillSize));

            case DataFrameType.Double: return(new DataFrameColumn <Double>(owner, capacity, fillSize));

            case DataFrameType.Single: return(new DataFrameColumn <Single>(owner, capacity, fillSize));

            case DataFrameType.Int64: return(new DataFrameColumn <Int64>(owner, capacity, fillSize));

            case DataFrameType.Int32: return(new DataFrameColumn <Int32>(owner, capacity, fillSize));

            case DataFrameType.Int16: return(new DataFrameColumn <Int16>(owner, capacity, fillSize));

            case DataFrameType.Byte: return(new DataFrameColumn <Byte>(owner, capacity, fillSize));

            case DataFrameType.SByte: return(new DataFrameColumn <SByte>(owner, capacity, fillSize));

            case DataFrameType.String: return(new DataFrameColumn <String>(owner, capacity, fillSize));

            case DataFrameType.Boolean: return(new DataFrameColumn <Boolean>(owner, capacity, fillSize));
            }

            throw new ArgumentException("Unknown DataFrameType");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the SocketDataFrame class
        /// </summary>
        /// <param name="fin">Indicates whether the current SocketDataFrame is the last one of a multi frame message</param>
        /// <param name="masked">Indicates whether the current SocketDataFrame is masked</param>
        /// <param name="payload">Payload of the current WebSocketFrame</param>
        /// <param name="dataType">The data type of the current SocketDataFrame</param>
        /// <param name="message">Payload of the current SocketDataFrame</param>
        /// <exception cref="ArgumentOutOfRangeException">If the length of the message is greater than 65536</exception>
        /// <remark>This class, for now, only supports messages of length smaller of equal to 65536, that is, messages that can fit in a single frame</remark>
        public WebSocketDataFrame(bool fin, bool masked, byte[] payload,
                                  DataFrameType dataType,
                                  byte[] message) : base(fin, masked, payload)
        {
            this.DataType = dataType;
            this.InitOPCode();

            if (message.Length <= 65536)
            {
                this.data = message;
            }
            else
            {
                throw new ArgumentOutOfRangeException("This class does not support frames that have a content length value that is greater than 126");
            }
        }
Ejemplo n.º 3
0
 public DataFrame(DataFrameType type, Payload payload)
     : base(FrameHeader.SOF)
 {
     Type    = type;
     Payload = payload;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the SocketDataFrame class
 /// </summary>
 /// <param name="fin">Indicates whether the current SocketDataFrame is the last one of a multi frame message</param>
 /// <param name="masked">Indicates whether the current SocketDataFrame is masked</param>
 /// <param name="payload">Payload of the current WebSocketFrame</param>
 /// <param name="dataType">The data type of the current SocketDataFrame</param>
 public WebSocketDataFrame(bool fin, bool masked, byte[] payload,
                           DataFrameType dataType) : base(fin, masked, payload)
 {
     this.DataType = dataType;
     this.InitOPCode();
 }