ScanRepeatChar() static private method

static private ScanRepeatChar ( String pattern, char ch, int index, int &count ) : int
pattern String
ch char
index int
count int
return int
コード例 #1
0
 // Token: 0x06002E14 RID: 11796 RVA: 0x000B0A10 File Offset: 0x000AEC10
 internal void ScanDateWord(string pattern)
 {
     this.m_ymdFlags = DateTimeFormatInfoScanner.FoundDatePattern.None;
     for (int i = 0; i < pattern.Length; i++)
     {
         char c = pattern[i];
         if (c <= 'M')
         {
             if (c == '\'')
             {
                 i = this.AddDateWords(pattern, i + 1, null);
                 continue;
             }
             if (c == '.')
             {
                 if (this.m_ymdFlags == DateTimeFormatInfoScanner.FoundDatePattern.FoundYMDPatternFlag)
                 {
                     this.AddIgnorableSymbols(".");
                     this.m_ymdFlags = DateTimeFormatInfoScanner.FoundDatePattern.None;
                 }
                 i++;
                 continue;
             }
             if (c == 'M')
             {
                 int num;
                 i = DateTimeFormatInfoScanner.ScanRepeatChar(pattern, 'M', i, out num);
                 if (num >= 4 && i < pattern.Length && pattern[i] == '\'')
                 {
                     i = this.AddDateWords(pattern, i + 1, "MMMM");
                 }
                 this.m_ymdFlags |= DateTimeFormatInfoScanner.FoundDatePattern.FoundMonthPatternFlag;
                 continue;
             }
         }
         else
         {
             if (c == '\\')
             {
                 i += 2;
                 continue;
             }
             if (c != 'd')
             {
                 if (c == 'y')
                 {
                     int num;
                     i = DateTimeFormatInfoScanner.ScanRepeatChar(pattern, 'y', i, out num);
                     this.m_ymdFlags |= DateTimeFormatInfoScanner.FoundDatePattern.FoundYearPatternFlag;
                     continue;
                 }
             }
             else
             {
                 int num;
                 i = DateTimeFormatInfoScanner.ScanRepeatChar(pattern, 'd', i, out num);
                 if (num <= 2)
                 {
                     this.m_ymdFlags |= DateTimeFormatInfoScanner.FoundDatePattern.FoundDayPatternFlag;
                     continue;
                 }
                 continue;
             }
         }
         if (this.m_ymdFlags == DateTimeFormatInfoScanner.FoundDatePattern.FoundYMDPatternFlag && !char.IsWhiteSpace(c))
         {
             this.m_ymdFlags = DateTimeFormatInfoScanner.FoundDatePattern.None;
         }
     }
 }
コード例 #2
0
        internal void ScanDateWord(string pattern)
        {
            this.m_ymdFlags = DateTimeFormatInfoScanner.FoundDatePattern.None;
            int index = 0;

            while (index < pattern.Length)
            {
                char c = pattern[index];
                int  count;
                if ((uint)c <= 77U)
                {
                    if ((int)c != 39)
                    {
                        if ((int)c != 46)
                        {
                            if ((int)c == 77)
                            {
                                index = DateTimeFormatInfoScanner.ScanRepeatChar(pattern, 'M', index, out count);
                                if (count >= 4 && index < pattern.Length && (int)pattern[index] == 39)
                                {
                                    index = this.AddDateWords(pattern, index + 1, "MMMM");
                                }
                                this.m_ymdFlags = this.m_ymdFlags | DateTimeFormatInfoScanner.FoundDatePattern.FoundMonthPatternFlag;
                                continue;
                            }
                        }
                        else
                        {
                            if (this.m_ymdFlags == DateTimeFormatInfoScanner.FoundDatePattern.FoundYMDPatternFlag)
                            {
                                this.AddIgnorableSymbols(".");
                                this.m_ymdFlags = DateTimeFormatInfoScanner.FoundDatePattern.None;
                            }
                            ++index;
                            continue;
                        }
                    }
                    else
                    {
                        index = this.AddDateWords(pattern, index + 1, (string)null);
                        continue;
                    }
                }
                else if ((int)c != 92)
                {
                    if ((int)c != 100)
                    {
                        if ((int)c == 121)
                        {
                            index           = DateTimeFormatInfoScanner.ScanRepeatChar(pattern, 'y', index, out count);
                            this.m_ymdFlags = this.m_ymdFlags | DateTimeFormatInfoScanner.FoundDatePattern.FoundYearPatternFlag;
                            continue;
                        }
                    }
                    else
                    {
                        index = DateTimeFormatInfoScanner.ScanRepeatChar(pattern, 'd', index, out count);
                        if (count <= 2)
                        {
                            this.m_ymdFlags = this.m_ymdFlags | DateTimeFormatInfoScanner.FoundDatePattern.FoundDayPatternFlag;
                            continue;
                        }
                        continue;
                    }
                }
                else
                {
                    index += 2;
                    continue;
                }
                if (this.m_ymdFlags == DateTimeFormatInfoScanner.FoundDatePattern.FoundYMDPatternFlag && !char.IsWhiteSpace(c))
                {
                    this.m_ymdFlags = DateTimeFormatInfoScanner.FoundDatePattern.None;
                }
                ++index;
            }
        }