예제 #1
0
        ProxyArray DecodeArray()
        {
            ProxyArray proxy = new ProxyArray();

            // Ditch opening bracket.
            json.Read();

            // [
            var parsing = true;

            while (parsing)
            {
                Token nextToken = NextToken;

                switch (nextToken)
                {
                case Token.None:
                    return(null);

                case Token.Comma:
                    continue;

                case Token.CloseBracket:
                    parsing = false;
                    break;

                default:
                    proxy.Add(DecodeByToken(nextToken));
                    break;
                }
            }

            return(proxy);
        }
예제 #2
0
        private static void DecodeMultiRankArray <T>(ProxyArray arrayData, Array array, int arrayRank, int[] indices)
        {
            var count = arrayData.Count;

            for (int i = 0; i < count; i++)
            {
                indices[arrayRank - 1] = i;
                if (arrayRank < array.Rank)
                {
                    DecodeMultiRankArray <T>(arrayData[i] as ProxyArray, array, arrayRank + 1, indices);
                }
                else
                {
                    array.SetValue(DecodeType <T>(arrayData[i]), indices);
                }
            }
        }