コード例 #1
0
        public IAdaptingType read(FlashorbBinaryReader reader, ParseContext parseContext)
        {
            int dataLength = reader.ReadInteger();

            byte[] buffer = reader.ReadBytes(dataLength);
            return(new StringType(Encoding.UTF8.GetString(buffer, 0, buffer.Length)));
        }
コード例 #2
0
        public IAdaptingType read(FlashorbBinaryReader reader, ParseContext parseContext)
        {
            int  handle = reader.ReadVarInteger();
            bool inline = ((handle & 1) != 0);

            handle = handle >> 1;
            if (inline)
            {
                object[] array = new object[handle];

                ArrayType ar = new ArrayType(array);
                parseContext.addReference(ar);

                // whether vector is readonly
                int @fixed = reader.ReadVarInteger();

                if (!typeof(T).IsValueType)
                {
                    // type name of the vector's elements
                    string elementTypeName = ReaderUtils.readString(reader, parseContext);
                }

                for (int i = 0; i < handle; i++)
                {
                    if (typeof(T) == typeof(int))
                    {
                        array[i] = reader.ReadInteger();
                    }
                    else if (typeof(T) == typeof(uint))
                    {
                        array[i] = reader.ReadUInteger();
                    }
                    else if (typeof(T) == typeof(double))
                    {
                        array[i] = reader.ReadDouble();
                    }
                    else
                    {
                        array[i] = RequestParser.readData(reader, parseContext);
                        //array[ i ] = objectReader.read( reader, parseContext );
                    }
                }

                return(ar);
            }
            else
            {
                return(parseContext.getReference(handle));
            }
        }
コード例 #3
0
        public IAdaptingType read(FlashorbBinaryReader reader, ParseContext parseContext)
        {
            int length = reader.ReadInteger();

            IAdaptingType[] array     = new IAdaptingType[length];
            ArrayType       arrayType = new ArrayType(array);

            parseContext.addReference(arrayType);

            for (int i = 0; i < length; i++)
            {
                array[i] = RequestParser.readData(reader, parseContext);
            }

            return(arrayType);
        }
コード例 #4
0
ファイル: RequestParser.cs プロジェクト: ramilbgd/.NET-SDK
        private Header readHeader(FlashorbBinaryReader reader)
        {
            int nameLength = reader.ReadUnsignedShort();

            byte[] bytes = reader.ReadBytes(nameLength);
#if (FULL_BUILD)
            string headerName = encoding.GetString(bytes);
#else
            string headerName = BitConverter.ToString(bytes);
#endif
            bool mustUnderstand = reader.ReadBoolean();
            //int length = reader.ReadInt32();
            int length = reader.ReadInteger();

            if (Log.isLogging(LoggingConstants.DEBUG))
            {
                Log.log(LoggingConstants.DEBUG, "MessageReader::readHeader: name - " + headerName + " mustUnderstand - " + mustUnderstand + " length - " + length);
            }

            return(new Header(headerName, mustUnderstand, length, readData(reader)));
        }
コード例 #5
0
        public IAdaptingType read(FlashorbBinaryReader reader, ParseContext parseContext)
        {
            //int capacity = reader.ReadInt32();
            int capacity = reader.ReadInteger();
            Dictionary <String, Object> properties      = new Dictionary <String, Object>(capacity);
            AnonymousObject             anonymousObject = new AnonymousObject(properties);

            parseContext.addReference(anonymousObject);

            while (true)
            {
                String propName = reader.ReadUTF();
                object obj      = RequestParser.readData(reader, parseContext);

                if (obj == null)
                {
                    break;
                }

                properties[propName] = obj;
            }

            return(anonymousObject);
        }
コード例 #6
0
ファイル: RequestParser.cs プロジェクト: ramilbgd/.NET-SDK
        private Body readBodyPart(FlashorbBinaryReader reader)
        {
            int serviceURILength = reader.ReadUnsignedShort();

#if (FULL_BUILD)
            string serviceURI = encoding.GetString(reader.ReadBytes(serviceURILength));
#else
            string serviceURI = BitConverter.ToString(reader.ReadBytes(serviceURILength));
#endif
            int responseURILength = reader.ReadUnsignedShort();
#if (FULL_BUILD)
            string responseURI = encoding.GetString(reader.ReadBytes(responseURILength));
#else
            string responseURI = BitConverter.ToString(reader.ReadBytes(responseURILength));
#endif
            int length = reader.ReadInteger();

            if (Log.isLogging(LoggingConstants.DEBUG))
            {
                Log.log(LoggingConstants.DEBUG, "MessageReader::readBodyPart: serviceURI - " + serviceURI + " responseURI - " + responseURI + " length: " + length);
            }

            return(new Body(serviceURI, responseURI, length, readData(reader)));
        }