Ejemplo n.º 1
0
        private static InfoValue ReadValue(String str, ref int startIndex)
        {
            InfoValue returnVal;

            switch (FindNextType(str, startIndex))
            {
            case InfoType.Object:
                returnVal = ReadObjectValue(str, ref startIndex); break;

            case InfoType.Array:
                returnVal = ReadArrayValue(str, ref startIndex); break;

            case InfoType.String:
                returnVal = ReadStringValue(str, ref startIndex); break;

            case InfoType.Double:
                returnVal = ReadDoubleValue(str, ref startIndex); break;

            case InfoType.Integer:
                returnVal = ReadIntegerValue(str, ref startIndex); break;

            case InfoType.Boolean:
                returnVal = ReadBooleanValue(str, ref startIndex); break;

            default:
                returnVal = new InfoNull(); break;
            }

            MovePastWhitespace(str, ref startIndex);

            if (str[startIndex] == ',')
            {
                ++startIndex;
            }

            return(returnVal);
        }
Ejemplo n.º 2
0
        private static InfoValue ReadValue( String str, ref int startIndex )
        {
            InfoValue returnVal;

            switch( FindNextType( str, startIndex ) )
            {
                case InfoType.Object:
                    returnVal = ReadObjectValue( str, ref startIndex ); break;
                case InfoType.Array:
                    returnVal = ReadArrayValue( str, ref startIndex ); break;
                case InfoType.String:
                    returnVal = ReadStringValue( str, ref startIndex ); break;
                case InfoType.Double:
                    returnVal = ReadDoubleValue( str, ref startIndex ); break;
                case InfoType.Integer:
                    returnVal = ReadIntegerValue( str, ref startIndex ); break;
                case InfoType.Boolean:
                    returnVal = ReadBooleanValue( str, ref startIndex ); break;
                default:
                    returnVal = new InfoNull(); break;
            }

            MovePastWhitespace( str, ref startIndex );

            if ( str[ startIndex ] == ',' )
                ++startIndex;

            return returnVal;
        }