Beispiel #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);
        }
Beispiel #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;
        }