Beispiel #1
0
        private object DoGetValue(string str, object index, ExecutionContext context)
        {
            IEnumerator enumerator = LanguagePrimitives.GetEnumerator(index);

            if (enumerator != null)
            {
                ArrayList arrayList = new ArrayList();
                while (ParserOps.MoveNext(context, this.NodeToken, enumerator))
                {
                    int index1 = ParserOps.FixNum(ParserOps.Current(this.NodeToken, enumerator), this.NodeToken);
                    if (index1 < 0)
                    {
                        index1 += str.Length;
                    }
                    try
                    {
                        arrayList.Add((object)str[index1]);
                    }
                    catch (IndexOutOfRangeException ex)
                    {
                    }
                }
                return((object)arrayList.ToArray());
            }
            int index2 = ParserOps.FixNum(index, this.NodeToken);

            if (index2 < 0)
            {
                index2 += str.Length;
            }
            try
            {
                return((object)str[index2]);
            }
            catch (IndexOutOfRangeException ex)
            {
                return((object)null);
            }
        }