// Token: 0x06001665 RID: 5733 RVA: 0x00046D7A File Offset: 0x00044F7A
 internal void ConsumeSubString(DTSubString sub)
 {
     this.Index = sub.index + sub.length;
     if (this.Index < this.len)
     {
         this.m_current = this.Value[this.Index];
     }
 }
Exemplo n.º 2
0
        internal DTSubString GetSubString()
        {
            DTSubString str = new DTSubString {
                index = this.Index,
                s     = this.Value
            };

            while ((this.Index + str.length) < this.len)
            {
                DTSubStringType number;
                char            ch = this.Value[this.Index + str.length];
                if ((ch >= '0') && (ch <= '9'))
                {
                    number = DTSubStringType.Number;
                }
                else
                {
                    number = DTSubStringType.Other;
                }
                if (str.length == 0)
                {
                    str.type = number;
                }
                else if (str.type != number)
                {
                    break;
                }
                str.length++;
                if (number != DTSubStringType.Number)
                {
                    break;
                }
                if (str.length > 8)
                {
                    str.type = DTSubStringType.Invalid;
                    return(str);
                }
                int num = ch - '0';
                str.value = (str.value * 10) + num;
            }
            if (str.length == 0)
            {
                str.type = DTSubStringType.End;
                return(str);
            }
            return(str);
        }
        // Token: 0x06001664 RID: 5732 RVA: 0x00046CA0 File Offset: 0x00044EA0
        internal DTSubString GetSubString()
        {
            DTSubString dtsubString = default(DTSubString);

            dtsubString.index = this.Index;
            dtsubString.s     = this.Value;
            while (this.Index + dtsubString.length < this.len)
            {
                char            c = this.Value[this.Index + dtsubString.length];
                DTSubStringType dtsubStringType;
                if (c >= '0' && c <= '9')
                {
                    dtsubStringType = DTSubStringType.Number;
                }
                else
                {
                    dtsubStringType = DTSubStringType.Other;
                }
                if (dtsubString.length == 0)
                {
                    dtsubString.type = dtsubStringType;
                }
                else if (dtsubString.type != dtsubStringType)
                {
                    break;
                }
                dtsubString.length++;
                if (dtsubStringType != DTSubStringType.Number)
                {
                    break;
                }
                if (dtsubString.length > 8)
                {
                    dtsubString.type = DTSubStringType.Invalid;
                    return(dtsubString);
                }
                int num = (int)(c - '0');
                dtsubString.value = dtsubString.value * 10 + num;
            }
            if (dtsubString.length == 0)
            {
                dtsubString.type = DTSubStringType.End;
                return(dtsubString);
            }
            return(dtsubString);
        }
Exemplo n.º 4
0
 internal void ConsumeSubString(DTSubString sub) {
     Contract.Assert(sub.index == Index, "sub.index == Index");
     Contract.Assert(sub.index + sub.length <= len, "sub.index + sub.length <= len");
     Index = sub.index + sub.length;
     if (Index < len) {
         m_current = Value[Index];
     }
 }
Exemplo n.º 5
0
        internal DTSubString GetSubString() {
            DTSubString sub = new DTSubString();
            sub.index = Index;
            sub.s = Value;
            while (Index + sub.length < len) {
                DTSubStringType currentType;
                Char ch = Value[Index + sub.length];
                if (ch >= '0' && ch <= '9') {
                    currentType = DTSubStringType.Number;
                }
                else {
                    currentType = DTSubStringType.Other;
                }

                if (sub.length == 0) {
                    sub.type = currentType;
                }
                else {
                    if (sub.type != currentType) {
                        break;
                    }
                }
                sub.length++;
                if (currentType == DTSubStringType.Number) {
                    // Incorporate the number into the value
                    // Limit the digits to prevent overflow
                    if (sub.length > DateTimeParse.MaxDateTimeNumberDigits) {
                        sub.type = DTSubStringType.Invalid;
                        return sub;
                    }
                    int number = ch - '0';
                    Contract.Assert(number >= 0 && number <= 9, "number >= 0 && number <= 9");
                    sub.value = sub.value * 10 + number;
                }
                else {
                    // For non numbers, just return this length 1 token. This should be expanded
                    // to more types of thing if this parsing approach is used for things other
                    // than numbers and single characters
                    break;
                }
            }
            if (sub.length == 0) {
                sub.type = DTSubStringType.End;
                return sub;
            }

            return sub;
        }
Exemplo n.º 6
0
 internal void ConsumeSubString(DTSubString sub)
 {
     this.Index = sub.index + sub.length;
     if (this.Index < this.len)
     {
         this.m_current = this.Value[this.Index];
     }
 }
Exemplo n.º 7
0
 internal DTSubString GetSubString()
 {
     DTSubString str = new DTSubString {
         index = this.Index,
         s = this.Value
     };
     while ((this.Index + str.length) < this.len)
     {
         DTSubStringType number;
         char ch = this.Value[this.Index + str.length];
         if ((ch >= '0') && (ch <= '9'))
         {
             number = DTSubStringType.Number;
         }
         else
         {
             number = DTSubStringType.Other;
         }
         if (str.length == 0)
         {
             str.type = number;
         }
         else if (str.type != number)
         {
             break;
         }
         str.length++;
         if (number != DTSubStringType.Number)
         {
             break;
         }
         if (str.length > 8)
         {
             str.type = DTSubStringType.Invalid;
             return str;
         }
         int num = ch - '0';
         str.value = (str.value * 10) + num;
     }
     if (str.length == 0)
     {
         str.type = DTSubStringType.End;
         return str;
     }
     return str;
 }
 internal void ConsumeSubString(DTSubString sub)
 {
     Index = sub.index + sub.length;
     if (Index < len)
     {
         m_current = Value[Index];
     }
 }