// Token: 0x06002E17 RID: 11799 RVA: 0x000B0C68 File Offset: 0x000AEE68 internal static FORMATFLAGS GetFormatFlagUseSpaceInMonthNames(string[] monthNames, string[] genitveMonthNames, string[] abbrevMonthNames, string[] genetiveAbbrevMonthNames) { FORMATFLAGS formatflags = FORMATFLAGS.None; formatflags |= ((DateTimeFormatInfoScanner.ArrayElementsBeginWithDigit(monthNames) || DateTimeFormatInfoScanner.ArrayElementsBeginWithDigit(genitveMonthNames) || DateTimeFormatInfoScanner.ArrayElementsBeginWithDigit(abbrevMonthNames) || DateTimeFormatInfoScanner.ArrayElementsBeginWithDigit(genetiveAbbrevMonthNames)) ? FORMATFLAGS.UseDigitPrefixInTokens : FORMATFLAGS.None); return(formatflags | ((DateTimeFormatInfoScanner.ArrayElementsHaveSpace(monthNames) || DateTimeFormatInfoScanner.ArrayElementsHaveSpace(genitveMonthNames) || DateTimeFormatInfoScanner.ArrayElementsHaveSpace(abbrevMonthNames) || DateTimeFormatInfoScanner.ArrayElementsHaveSpace(genetiveAbbrevMonthNames)) ? FORMATFLAGS.UseSpacesInMonthNames : FORMATFLAGS.None)); }
// Token: 0x06002E18 RID: 11800 RVA: 0x000B0CC7 File Offset: 0x000AEEC7 internal static FORMATFLAGS GetFormatFlagUseSpaceInDayNames(string[] dayNames, string[] abbrevDayNames) { if (!DateTimeFormatInfoScanner.ArrayElementsHaveSpace(dayNames) && !DateTimeFormatInfoScanner.ArrayElementsHaveSpace(abbrevDayNames)) { return(FORMATFLAGS.None); } return(FORMATFLAGS.UseSpacesInDayNames); }
// Token: 0x06002E16 RID: 11798 RVA: 0x000B0C50 File Offset: 0x000AEE50 internal static FORMATFLAGS GetFormatFlagGenitiveMonth(string[] monthNames, string[] genitveMonthNames, string[] abbrevMonthNames, string[] genetiveAbbrevMonthNames) { if (DateTimeFormatInfoScanner.EqualStringArrays(monthNames, genitveMonthNames) && DateTimeFormatInfoScanner.EqualStringArrays(abbrevMonthNames, genetiveAbbrevMonthNames)) { return(FORMATFLAGS.None); } return(FORMATFLAGS.UseGenitiveMonth); }
internal int AddDateWords(string pattern, int index, string formatPostfix) { int num1 = DateTimeFormatInfoScanner.SkipWhiteSpacesAndNonLetter(pattern, index); int num2 = index; if (num1 != num2 && formatPostfix != null) { formatPostfix = (string)null; } index = num1; StringBuilder stringBuilder = new StringBuilder(); while (index < pattern.Length) { char c = pattern[index]; switch (c) { case '\'': this.AddDateWordOrPostfix(formatPostfix, stringBuilder.ToString()); ++index; goto label_13; case '\\': ++index; if (index < pattern.Length) { stringBuilder.Append(pattern[index]); ++index; continue; } continue; default: if (char.IsWhiteSpace(c)) { this.AddDateWordOrPostfix(formatPostfix, stringBuilder.ToString()); if (formatPostfix != null) { formatPostfix = (string)null; } stringBuilder.Length = 0; ++index; continue; } stringBuilder.Append(c); ++index; continue; } } label_13: return(index); }
// Token: 0x06002E11 RID: 11793 RVA: 0x000B08EC File Offset: 0x000AEAEC internal int AddDateWords(string pattern, int index, string formatPostfix) { int num = DateTimeFormatInfoScanner.SkipWhiteSpacesAndNonLetter(pattern, index); if (num != index && formatPostfix != null) { formatPostfix = null; } index = num; StringBuilder stringBuilder = new StringBuilder(); while (index < pattern.Length) { char c = pattern[index]; if (c == '\'') { this.AddDateWordOrPostfix(formatPostfix, stringBuilder.ToString()); index++; break; } if (c == '\\') { index++; if (index < pattern.Length) { stringBuilder.Append(pattern[index]); index++; } } else if (char.IsWhiteSpace(c)) { this.AddDateWordOrPostfix(formatPostfix, stringBuilder.ToString()); if (formatPostfix != null) { formatPostfix = null; } stringBuilder.Length = 0; index++; } else { stringBuilder.Append(c); index++; } } return(index); }
[System.Security.SecurityCritical] // auto-generated internal TokenHashValue[] CreateTokenHashTable() { TokenHashValue[] temp = m_dtfiTokenHash; if (temp == null) { temp = new TokenHashValue[TOKEN_HASH_SIZE]; bool koreanLanguage = LanguageName.Equals(KoreanLangName); string sep = this.TimeSeparator.Trim(); if (IgnorableComma != sep) InsertHash(temp, IgnorableComma, TokenType.IgnorableSymbol, 0); if (IgnorablePeriod != sep) InsertHash(temp, IgnorablePeriod, TokenType.IgnorableSymbol, 0); if (KoreanHourSuff != sep && CJKHourSuff != sep && ChineseHourSuff != sep) { // // On the Macintosh, the default TimeSeparator is identical to the KoreanHourSuff, CJKHourSuff, or ChineseHourSuff for some cultures like // ja-JP and ko-KR. In these cases having the same symbol inserted into the hash table with multiple TokenTypes causes undesirable // DateTime.Parse behavior. For instance, the DateTimeFormatInfo.Tokenize() method might return SEP_DateOrOffset for KoreanHourSuff // instead of SEP_HourSuff. // InsertHash(temp, this.TimeSeparator, TokenType.SEP_Time, 0); } InsertHash(temp, this.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0); InsertHash(temp, this.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1); // if (LanguageName.Equals("sq")) { // Albanian allows time formats like "12:00.PD" InsertHash(temp, IgnorablePeriod + this.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0); InsertHash(temp, IgnorablePeriod + this.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1); } // CJK suffix InsertHash(temp, CJKYearSuff, TokenType.SEP_YearSuff, 0); InsertHash(temp, KoreanYearSuff, TokenType.SEP_YearSuff, 0); InsertHash(temp, CJKMonthSuff, TokenType.SEP_MonthSuff, 0); InsertHash(temp, KoreanMonthSuff, TokenType.SEP_MonthSuff, 0); InsertHash(temp, CJKDaySuff, TokenType.SEP_DaySuff, 0); InsertHash(temp, KoreanDaySuff, TokenType.SEP_DaySuff, 0); InsertHash(temp, CJKHourSuff, TokenType.SEP_HourSuff, 0); InsertHash(temp, ChineseHourSuff, TokenType.SEP_HourSuff, 0); InsertHash(temp, CJKMinuteSuff, TokenType.SEP_MinuteSuff, 0); InsertHash(temp, CJKSecondSuff, TokenType.SEP_SecondSuff, 0); // if (koreanLanguage) { // Korean suffix InsertHash(temp, KoreanHourSuff, TokenType.SEP_HourSuff, 0); InsertHash(temp, KoreanMinuteSuff, TokenType.SEP_MinuteSuff, 0); InsertHash(temp, KoreanSecondSuff, TokenType.SEP_SecondSuff, 0); } if ( LanguageName.Equals("ky")) { // For some cultures, the date separator works more like a comma, being allowed before or after any date part InsertHash(temp, dateSeparatorOrTimeZoneOffset, TokenType.IgnorableSymbol, 0); } else { InsertHash(temp, dateSeparatorOrTimeZoneOffset, TokenType.SEP_DateOrOffset, 0); } String[] dateWords = null; DateTimeFormatInfoScanner scanner = null; // We need to rescan the date words since we're always synthetic scanner = new DateTimeFormatInfoScanner(); // Enumarate all LongDatePatterns, and get the DateWords and scan for month postfix. // The only reason they're being assigned to m_dateWords is for Whidbey Deserialization m_dateWords = dateWords = scanner.GetDateWordsOfDTFI(this); // Ensure the formatflags is initialized. DateTimeFormatFlags flag = FormatFlags; // For some cultures, the date separator works more like a comma, being allowed before or after any date part. // In these cultures, we do not use normal date separator since we disallow date separator after a date terminal state. // This is determined in DateTimeFormatInfoScanner. Use this flag to determine if we should treat date separator as ignorable symbol. bool useDateSepAsIgnorableSymbol = false; String monthPostfix = null; if (dateWords != null) { // There are DateWords. It could be a real date word (such as "de"), or a monthPostfix. // The monthPostfix starts with '\xfffe' (MonthPostfixChar), followed by the real monthPostfix. for (int i = 0; i < dateWords.Length; i++) { switch (dateWords[i][0]) { // This is a month postfix case DateTimeFormatInfoScanner.MonthPostfixChar: // Get the real month postfix. monthPostfix = dateWords[i].Substring(1); // Add the month name + postfix into the token. AddMonthNames(temp, monthPostfix); break; case DateTimeFormatInfoScanner.IgnorableSymbolChar: String symbol = dateWords[i].Substring(1); InsertHash(temp, symbol, TokenType.IgnorableSymbol, 0); if (this.DateSeparator.Trim(null).Equals(symbol)) { // The date separator is the same as the ingorable symbol. useDateSepAsIgnorableSymbol = true; } break; default: InsertHash(temp, dateWords[i], TokenType.DateWordToken, 0); // if (LanguageName.Equals("eu")) { // Basque has date words with leading dots InsertHash(temp, IgnorablePeriod + dateWords[i], TokenType.DateWordToken, 0); } break; } } } if (!useDateSepAsIgnorableSymbol) { // Use the normal date separator. InsertHash(temp, this.DateSeparator, TokenType.SEP_Date, 0); } // Add the regular month names. AddMonthNames(temp, null); // Add the abbreviated month names. for (int i = 1; i <= 13; i++) { InsertHash(temp, GetAbbreviatedMonthName(i), TokenType.MonthToken, i); } if ((FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0) { for (int i = 1; i <= 13; i++) { String str; str = internalGetMonthName(i, MonthNameStyles.Genitive, false); InsertHash(temp, str, TokenType.MonthToken, i); } } if ((FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != 0) { for (int i = 1; i <= 13; i++) { String str; str = internalGetMonthName(i, MonthNameStyles.LeapYear, false); InsertHash(temp, str, TokenType.MonthToken, i); } } for (int i = 0; i < 7; i++) { //String str = GetDayOfWeekNames()[i]; // We have to call public methods here to work with inherited DTFI. String str = GetDayName((DayOfWeek)i); InsertHash(temp, str, TokenType.DayOfWeekToken, i); str = GetAbbreviatedDayName((DayOfWeek)i); InsertHash(temp, str, TokenType.DayOfWeekToken, i); } int[] eras = calendar.Eras; for (int i = 1; i <= eras.Length; i++) { InsertHash(temp, GetEraName(i), TokenType.EraToken, i); InsertHash(temp, GetAbbreviatedEraName(i), TokenType.EraToken, i); } // if (LanguageName.Equals(JapaneseLangName)) { // Japanese allows day of week forms like: "(Tue)" for (int i = 0; i < 7; i++) { String specialDayOfWeek = "(" + GetAbbreviatedDayName((DayOfWeek)i) + ")"; InsertHash(temp, specialDayOfWeek, TokenType.DayOfWeekToken, i); } if (this.Calendar.GetType() != typeof(JapaneseCalendar)) { // Special case for Japanese. If this is a Japanese DTFI, and the calendar is not Japanese calendar, // we will check Japanese Era name as well when the calendar is Gregorian. DateTimeFormatInfo jaDtfi = GetJapaneseCalendarDTFI(); for (int i = 1; i <= jaDtfi.Calendar.Eras.Length; i++) { InsertHash(temp, jaDtfi.GetEraName(i), TokenType.JapaneseEraToken, i); InsertHash(temp, jaDtfi.GetAbbreviatedEraName(i), TokenType.JapaneseEraToken, i); // m_abbrevEnglishEraNames[0] contains the name for era 1, so the token value is i+1. InsertHash(temp, jaDtfi.AbbreviatedEnglishEraNames[i-1], TokenType.JapaneseEraToken, i); } } } // else if (CultureName.Equals("zh-TW")) { DateTimeFormatInfo twDtfi = GetTaiwanCalendarDTFI(); for (int i = 1; i <= twDtfi.Calendar.Eras.Length; i++) { if (twDtfi.GetEraName(i).Length > 0) { InsertHash(temp, twDtfi.GetEraName(i), TokenType.TEraToken, i); } } } InsertHash(temp, InvariantInfo.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0); InsertHash(temp, InvariantInfo.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1); // Add invariant month names and day names. for (int i = 1; i <= 12; i++) { String str; // We have to call public methods here to work with inherited DTFI. // Insert the month name first, so that they are at the front of abbrevaited // month names. str = InvariantInfo.GetMonthName(i); InsertHash(temp, str, TokenType.MonthToken, i); str = InvariantInfo.GetAbbreviatedMonthName(i); InsertHash(temp, str, TokenType.MonthToken, i); } for (int i = 0; i < 7; i++) { // We have to call public methods here to work with inherited DTFI. String str = InvariantInfo.GetDayName((DayOfWeek)i); InsertHash(temp, str, TokenType.DayOfWeekToken, i); str = InvariantInfo.GetAbbreviatedDayName((DayOfWeek)i); InsertHash(temp, str, TokenType.DayOfWeekToken, i); } for (int i = 0; i < AbbreviatedEnglishEraNames.Length; i++) { // m_abbrevEnglishEraNames[0] contains the name for era 1, so the token value is i+1. InsertHash(temp, AbbreviatedEnglishEraNames[i], TokenType.EraToken, i + 1); } InsertHash(temp, LocalTimeMark, TokenType.SEP_LocalTimeMark, 0); InsertHash(temp, DateTimeParse.GMTName, TokenType.TimeZoneToken, 0); InsertHash(temp, DateTimeParse.ZuluName, TokenType.TimeZoneToken, 0); InsertHash(temp, invariantDateSeparator, TokenType.SEP_Date, 0); InsertHash(temp, invariantTimeSeparator, TokenType.SEP_Time, 0); m_dtfiTokenHash = temp; } return (temp); }
internal TokenHashValue[] CreateTokenHashTable() { TokenHashValue[] tokenHashValueArray = this.m_dtfiTokenHash; if (tokenHashValueArray == null) { tokenHashValueArray = new TokenHashValue[199]; bool flag1 = this.LanguageName.Equals("ko"); string str1 = this.TimeSeparator.Trim(); if ("," != str1) this.InsertHash(tokenHashValueArray, ",", TokenType.IgnorableSymbol, 0); if ("." != str1) this.InsertHash(tokenHashValueArray, ".", TokenType.IgnorableSymbol, 0); if ("시" != str1 && "時" != str1 && "时" != str1) this.InsertHash(tokenHashValueArray, this.TimeSeparator, TokenType.SEP_Time, 0); this.InsertHash(tokenHashValueArray, this.AMDesignator, (TokenType) 1027, 0); this.InsertHash(tokenHashValueArray, this.PMDesignator, (TokenType) 1284, 1); if (this.LanguageName.Equals("sq")) { this.InsertHash(tokenHashValueArray, "." + this.AMDesignator, (TokenType) 1027, 0); this.InsertHash(tokenHashValueArray, "." + this.PMDesignator, (TokenType) 1284, 1); } this.InsertHash(tokenHashValueArray, "年", TokenType.SEP_YearSuff, 0); this.InsertHash(tokenHashValueArray, "년", TokenType.SEP_YearSuff, 0); this.InsertHash(tokenHashValueArray, "月", TokenType.SEP_MonthSuff, 0); this.InsertHash(tokenHashValueArray, "월", TokenType.SEP_MonthSuff, 0); this.InsertHash(tokenHashValueArray, "日", TokenType.SEP_DaySuff, 0); this.InsertHash(tokenHashValueArray, "일", TokenType.SEP_DaySuff, 0); this.InsertHash(tokenHashValueArray, "時", TokenType.SEP_HourSuff, 0); this.InsertHash(tokenHashValueArray, "时", TokenType.SEP_HourSuff, 0); this.InsertHash(tokenHashValueArray, "分", TokenType.SEP_MinuteSuff, 0); this.InsertHash(tokenHashValueArray, "秒", TokenType.SEP_SecondSuff, 0); if (flag1) { this.InsertHash(tokenHashValueArray, "시", TokenType.SEP_HourSuff, 0); this.InsertHash(tokenHashValueArray, "분", TokenType.SEP_MinuteSuff, 0); this.InsertHash(tokenHashValueArray, "초", TokenType.SEP_SecondSuff, 0); } if (this.LanguageName.Equals("ky")) this.InsertHash(tokenHashValueArray, "-", TokenType.IgnorableSymbol, 0); else this.InsertHash(tokenHashValueArray, "-", TokenType.SEP_DateOrOffset, 0); DateTimeFormatInfoScanner formatInfoScanner = new DateTimeFormatInfoScanner(); string[] dateWordsOfDtfi; this.m_dateWords = dateWordsOfDtfi = formatInfoScanner.GetDateWordsOfDTFI(this); int num = (int) this.FormatFlags; bool flag2 = false; if (dateWordsOfDtfi != null) { for (int index = 0; index < dateWordsOfDtfi.Length; ++index) { switch (dateWordsOfDtfi[index][0]) { case '\xE000': string monthPostfix = dateWordsOfDtfi[index].Substring(1); this.AddMonthNames(tokenHashValueArray, monthPostfix); break; case '\xE001': string str2 = dateWordsOfDtfi[index].Substring(1); this.InsertHash(tokenHashValueArray, str2, TokenType.IgnorableSymbol, 0); if (this.DateSeparator.Trim((char[]) null).Equals(str2)) { flag2 = true; break; } else break; default: this.InsertHash(tokenHashValueArray, dateWordsOfDtfi[index], TokenType.DateWordToken, 0); if (this.LanguageName.Equals("eu")) { this.InsertHash(tokenHashValueArray, "." + dateWordsOfDtfi[index], TokenType.DateWordToken, 0); break; } else break; } } } if (!flag2) this.InsertHash(tokenHashValueArray, this.DateSeparator, TokenType.SEP_Date, 0); this.AddMonthNames(tokenHashValueArray, (string) null); for (int index = 1; index <= 13; ++index) this.InsertHash(tokenHashValueArray, this.GetAbbreviatedMonthName(index), TokenType.MonthToken, index); if ((this.FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != DateTimeFormatFlags.None) { for (int index = 1; index <= 13; ++index) { string monthName = this.internalGetMonthName(index, MonthNameStyles.Genitive, false); this.InsertHash(tokenHashValueArray, monthName, TokenType.MonthToken, index); } } if ((this.FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != DateTimeFormatFlags.None) { for (int index = 1; index <= 13; ++index) { string monthName = this.internalGetMonthName(index, MonthNameStyles.LeapYear, false); this.InsertHash(tokenHashValueArray, monthName, TokenType.MonthToken, index); } } for (int tokenValue = 0; tokenValue < 7; ++tokenValue) { string dayName = this.GetDayName((DayOfWeek) tokenValue); this.InsertHash(tokenHashValueArray, dayName, TokenType.DayOfWeekToken, tokenValue); string abbreviatedDayName = this.GetAbbreviatedDayName((DayOfWeek) tokenValue); this.InsertHash(tokenHashValueArray, abbreviatedDayName, TokenType.DayOfWeekToken, tokenValue); } int[] eras = this.calendar.Eras; for (int index = 1; index <= eras.Length; ++index) { this.InsertHash(tokenHashValueArray, this.GetEraName(index), TokenType.EraToken, index); this.InsertHash(tokenHashValueArray, this.GetAbbreviatedEraName(index), TokenType.EraToken, index); } if (this.LanguageName.Equals("ja")) { for (int tokenValue = 0; tokenValue < 7; ++tokenValue) { string str2 = "(" + this.GetAbbreviatedDayName((DayOfWeek) tokenValue) + ")"; this.InsertHash(tokenHashValueArray, str2, TokenType.DayOfWeekToken, tokenValue); } if (this.Calendar.GetType() != typeof (JapaneseCalendar)) { DateTimeFormatInfo japaneseCalendarDtfi = DateTimeFormatInfo.GetJapaneseCalendarDTFI(); for (int index = 1; index <= japaneseCalendarDtfi.Calendar.Eras.Length; ++index) { this.InsertHash(tokenHashValueArray, japaneseCalendarDtfi.GetEraName(index), TokenType.JapaneseEraToken, index); this.InsertHash(tokenHashValueArray, japaneseCalendarDtfi.GetAbbreviatedEraName(index), TokenType.JapaneseEraToken, index); this.InsertHash(tokenHashValueArray, japaneseCalendarDtfi.AbbreviatedEnglishEraNames[index - 1], TokenType.JapaneseEraToken, index); } } } else if (this.CultureName.Equals("zh-TW")) { DateTimeFormatInfo taiwanCalendarDtfi = DateTimeFormatInfo.GetTaiwanCalendarDTFI(); for (int index = 1; index <= taiwanCalendarDtfi.Calendar.Eras.Length; ++index) { if (taiwanCalendarDtfi.GetEraName(index).Length > 0) this.InsertHash(tokenHashValueArray, taiwanCalendarDtfi.GetEraName(index), TokenType.TEraToken, index); } } this.InsertHash(tokenHashValueArray, DateTimeFormatInfo.InvariantInfo.AMDesignator, (TokenType) 1027, 0); this.InsertHash(tokenHashValueArray, DateTimeFormatInfo.InvariantInfo.PMDesignator, (TokenType) 1284, 1); for (int index = 1; index <= 12; ++index) { string monthName = DateTimeFormatInfo.InvariantInfo.GetMonthName(index); this.InsertHash(tokenHashValueArray, monthName, TokenType.MonthToken, index); string abbreviatedMonthName = DateTimeFormatInfo.InvariantInfo.GetAbbreviatedMonthName(index); this.InsertHash(tokenHashValueArray, abbreviatedMonthName, TokenType.MonthToken, index); } for (int tokenValue = 0; tokenValue < 7; ++tokenValue) { string dayName = DateTimeFormatInfo.InvariantInfo.GetDayName((DayOfWeek) tokenValue); this.InsertHash(tokenHashValueArray, dayName, TokenType.DayOfWeekToken, tokenValue); string abbreviatedDayName = DateTimeFormatInfo.InvariantInfo.GetAbbreviatedDayName((DayOfWeek) tokenValue); this.InsertHash(tokenHashValueArray, abbreviatedDayName, TokenType.DayOfWeekToken, tokenValue); } for (int index = 0; index < this.AbbreviatedEnglishEraNames.Length; ++index) this.InsertHash(tokenHashValueArray, this.AbbreviatedEnglishEraNames[index], TokenType.EraToken, index + 1); this.InsertHash(tokenHashValueArray, "T", TokenType.SEP_LocalTimeMark, 0); this.InsertHash(tokenHashValueArray, "GMT", TokenType.TimeZoneToken, 0); this.InsertHash(tokenHashValueArray, "Z", TokenType.TimeZoneToken, 0); this.InsertHash(tokenHashValueArray, "/", TokenType.SEP_Date, 0); this.InsertHash(tokenHashValueArray, ":", TokenType.SEP_Time, 0); this.m_dtfiTokenHash = tokenHashValueArray; } return tokenHashValueArray; }
internal TokenHashValue[] CreateTokenHashTable() { TokenHashValue[] dtfiTokenHash = this.m_dtfiTokenHash; if (dtfiTokenHash == null) { dtfiTokenHash = new TokenHashValue[0xc7]; bool flag = this.LanguageName.Equals("ko"); string str = this.TimeSeparator.Trim(); if ("," != str) { this.InsertHash(dtfiTokenHash, ",", TokenType.IgnorableSymbol, 0); } if ("." != str) { this.InsertHash(dtfiTokenHash, ".", TokenType.IgnorableSymbol, 0); } if ((("시" != str) && ("時" != str)) && ("时" != str)) { this.InsertHash(dtfiTokenHash, this.TimeSeparator, TokenType.SEP_Time, 0); } this.InsertHash(dtfiTokenHash, this.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0); this.InsertHash(dtfiTokenHash, this.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1); if (this.LanguageName.Equals("sq")) { this.InsertHash(dtfiTokenHash, "." + this.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0); this.InsertHash(dtfiTokenHash, "." + this.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1); } this.InsertHash(dtfiTokenHash, "年", TokenType.SEP_YearSuff, 0); this.InsertHash(dtfiTokenHash, "년", TokenType.SEP_YearSuff, 0); this.InsertHash(dtfiTokenHash, "月", TokenType.SEP_MonthSuff, 0); this.InsertHash(dtfiTokenHash, "월", TokenType.SEP_MonthSuff, 0); this.InsertHash(dtfiTokenHash, "日", TokenType.SEP_DaySuff, 0); this.InsertHash(dtfiTokenHash, "일", TokenType.SEP_DaySuff, 0); this.InsertHash(dtfiTokenHash, "時", TokenType.SEP_HourSuff, 0); this.InsertHash(dtfiTokenHash, "时", TokenType.SEP_HourSuff, 0); this.InsertHash(dtfiTokenHash, "分", TokenType.SEP_MinuteSuff, 0); this.InsertHash(dtfiTokenHash, "秒", TokenType.SEP_SecondSuff, 0); if (flag) { this.InsertHash(dtfiTokenHash, "시", TokenType.SEP_HourSuff, 0); this.InsertHash(dtfiTokenHash, "분", TokenType.SEP_MinuteSuff, 0); this.InsertHash(dtfiTokenHash, "초", TokenType.SEP_SecondSuff, 0); } if (this.LanguageName.Equals("ky")) { this.InsertHash(dtfiTokenHash, "-", TokenType.IgnorableSymbol, 0); } else { this.InsertHash(dtfiTokenHash, "-", TokenType.SEP_DateOrOffset, 0); } string[] strArray = null; DateTimeFormatInfoScanner scanner = null; scanner = new DateTimeFormatInfoScanner(); this.m_dateWords = strArray = scanner.GetDateWordsOfDTFI(this); DateTimeFormatFlags formatFlags = this.FormatFlags; bool flag2 = false; string monthPostfix = null; if (strArray != null) { for (int num = 0; num < strArray.Length; num++) { switch (strArray[num][0]) { case 0xe000: monthPostfix = strArray[num].Substring(1); this.AddMonthNames(dtfiTokenHash, monthPostfix); break; case 0xe001: { string str3 = strArray[num].Substring(1); this.InsertHash(dtfiTokenHash, str3, TokenType.IgnorableSymbol, 0); if (this.DateSeparator.Trim(null).Equals(str3)) { flag2 = true; } break; } default: this.InsertHash(dtfiTokenHash, strArray[num], TokenType.DateWordToken, 0); if (this.LanguageName.Equals("eu")) { this.InsertHash(dtfiTokenHash, "." + strArray[num], TokenType.DateWordToken, 0); } break; } } } if (!flag2) { this.InsertHash(dtfiTokenHash, this.DateSeparator, TokenType.SEP_Date, 0); } this.AddMonthNames(dtfiTokenHash, null); for (int i = 1; i <= 13; i++) { this.InsertHash(dtfiTokenHash, this.GetAbbreviatedMonthName(i), TokenType.MonthToken, i); } if ((this.FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != DateTimeFormatFlags.None) { for (int num3 = 1; num3 <= 13; num3++) { string str4 = this.internalGetMonthName(num3, MonthNameStyles.Genitive, false); this.InsertHash(dtfiTokenHash, str4, TokenType.MonthToken, num3); } } if ((this.FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != DateTimeFormatFlags.None) { for (int num4 = 1; num4 <= 13; num4++) { string str5 = this.internalGetMonthName(num4, MonthNameStyles.LeapYear, false); this.InsertHash(dtfiTokenHash, str5, TokenType.MonthToken, num4); } } for (int j = 0; j < 7; j++) { string dayName = this.GetDayName((DayOfWeek) j); this.InsertHash(dtfiTokenHash, dayName, TokenType.DayOfWeekToken, j); dayName = this.GetAbbreviatedDayName((DayOfWeek) j); this.InsertHash(dtfiTokenHash, dayName, TokenType.DayOfWeekToken, j); } int[] eras = this.calendar.Eras; for (int k = 1; k <= eras.Length; k++) { this.InsertHash(dtfiTokenHash, this.GetEraName(k), TokenType.EraToken, k); this.InsertHash(dtfiTokenHash, this.GetAbbreviatedEraName(k), TokenType.EraToken, k); } if (this.LanguageName.Equals("ja")) { for (int num7 = 0; num7 < 7; num7++) { string str7 = "(" + this.GetAbbreviatedDayName((DayOfWeek) num7) + ")"; this.InsertHash(dtfiTokenHash, str7, TokenType.DayOfWeekToken, num7); } if (this.Calendar.GetType() != typeof(JapaneseCalendar)) { DateTimeFormatInfo japaneseCalendarDTFI = GetJapaneseCalendarDTFI(); for (int num8 = 1; num8 <= japaneseCalendarDTFI.Calendar.Eras.Length; num8++) { this.InsertHash(dtfiTokenHash, japaneseCalendarDTFI.GetEraName(num8), TokenType.JapaneseEraToken, num8); this.InsertHash(dtfiTokenHash, japaneseCalendarDTFI.GetAbbreviatedEraName(num8), TokenType.JapaneseEraToken, num8); this.InsertHash(dtfiTokenHash, japaneseCalendarDTFI.AbbreviatedEnglishEraNames[num8 - 1], TokenType.JapaneseEraToken, num8); } } } else if (this.CultureName.Equals("zh-TW")) { DateTimeFormatInfo taiwanCalendarDTFI = GetTaiwanCalendarDTFI(); for (int num9 = 1; num9 <= taiwanCalendarDTFI.Calendar.Eras.Length; num9++) { if (taiwanCalendarDTFI.GetEraName(num9).Length > 0) { this.InsertHash(dtfiTokenHash, taiwanCalendarDTFI.GetEraName(num9), TokenType.TEraToken, num9); } } } this.InsertHash(dtfiTokenHash, InvariantInfo.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0); this.InsertHash(dtfiTokenHash, InvariantInfo.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1); for (int m = 1; m <= 12; m++) { string monthName = InvariantInfo.GetMonthName(m); this.InsertHash(dtfiTokenHash, monthName, TokenType.MonthToken, m); monthName = InvariantInfo.GetAbbreviatedMonthName(m); this.InsertHash(dtfiTokenHash, monthName, TokenType.MonthToken, m); } for (int n = 0; n < 7; n++) { string abbreviatedDayName = InvariantInfo.GetDayName((DayOfWeek) n); this.InsertHash(dtfiTokenHash, abbreviatedDayName, TokenType.DayOfWeekToken, n); abbreviatedDayName = InvariantInfo.GetAbbreviatedDayName((DayOfWeek) n); this.InsertHash(dtfiTokenHash, abbreviatedDayName, TokenType.DayOfWeekToken, n); } for (int num12 = 0; num12 < this.AbbreviatedEnglishEraNames.Length; num12++) { this.InsertHash(dtfiTokenHash, this.AbbreviatedEnglishEraNames[num12], TokenType.EraToken, num12 + 1); } this.InsertHash(dtfiTokenHash, "T", TokenType.SEP_LocalTimeMark, 0); this.InsertHash(dtfiTokenHash, "GMT", TokenType.TimeZoneToken, 0); this.InsertHash(dtfiTokenHash, "Z", TokenType.TimeZoneToken, 0); this.InsertHash(dtfiTokenHash, "/", TokenType.SEP_Date, 0); this.InsertHash(dtfiTokenHash, ":", TokenType.SEP_Time, 0); this.m_dtfiTokenHash = dtfiTokenHash; } return dtfiTokenHash; }
internal TokenHashValue[] CreateTokenHashTable() { TokenHashValue[] temp = m_dtfiTokenHash; if (temp == null) { temp = new TokenHashValue[TOKEN_HASH_SIZE]; InsertHash(temp, ",", TokenType.IgnorableSymbol, 0); InsertHash(temp, ".", TokenType.IgnorableSymbol, 0); InsertHash(temp, this.TimeSeparator, TokenType.SEP_Time, 0); InsertHash(temp, this.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0); InsertHash(temp, this.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1); if (CultureName.Equals("sq-AL")) { // Algerian allows time formats like "12:00.PD" InsertHash(temp, "." + this.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0); InsertHash(temp, "." + this.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1); } // CJK suffix InsertHash(temp, CJKYearSuff, TokenType.SEP_YearSuff, 0); InsertHash(temp, KoreanYearSuff, TokenType.SEP_YearSuff, 0); InsertHash(temp, CJKMonthSuff, TokenType.SEP_MonthSuff, 0); InsertHash(temp, KoreanMonthSuff, TokenType.SEP_MonthSuff, 0); InsertHash(temp, CJKDaySuff, TokenType.SEP_DaySuff, 0); InsertHash(temp, KoreanDaySuff, TokenType.SEP_DaySuff, 0); InsertHash(temp, CJKHourSuff, TokenType.SEP_HourSuff, 0); InsertHash(temp, ChineseHourSuff, TokenType.SEP_HourSuff, 0); InsertHash(temp, CJKMinuteSuff, TokenType.SEP_MinuteSuff, 0); InsertHash(temp, CJKSecondSuff, TokenType.SEP_SecondSuff, 0); if (LanguageName.Equals(KoreanLangName)) { // Korean suffix InsertHash(temp, KoreanHourSuff, TokenType.SEP_HourSuff, 0); InsertHash(temp, KoreanMinuteSuff, TokenType.SEP_MinuteSuff, 0); InsertHash(temp, KoreanSecondSuff, TokenType.SEP_SecondSuff, 0); } String[] dateWords = null; DateTimeFormatInfoScanner scanner = null; // Get the all of the long date pattern. The getter will check if the default LongDatePattern // is in the standard list or not. If not, m_scanDateWords will be true, and we will // need to scan the date words. // Note that dateWords is used as a temp buffer here. It will be reset as the real date words later. if (!m_scanDateWords) { dateWords = ClonedAllLongDatePatterns; } if (m_scanDateWords || m_cultureTableRecord.IsSynthetic) { scanner = new DateTimeFormatInfoScanner(); // Enumarate all LongDatePatterns, and get the DateWords and scan for month postfix. m_dateWords = dateWords = scanner.GetDateWordsOfDTFI(this); // Ensure the formatflags is initialized. DateTimeFormatFlags flag = FormatFlags; m_scanDateWords = false; } else { // Use the table value. dateWords = this.DateWords;; } // For some cultures, the date separator works more like a comma, being allowed before or after any date part. // In this cultures, we do not use normal date separator since we disallow date separator after a date terminal state. // This is determinted in DateTimeFormatInfoScanner. Use this flag to determine if we should treat date separator as ignorable symbol. bool useDateSepAsIgnorableSymbol = false; String monthPostfix = null; if (dateWords != null) { // There are DateWords. It could be a real date word (such as "de"), or a monthPostfix. // The monthPostfix starts with '\xfffe' (MonthPostfixChar), followed by the real monthPostfix. for (int i = 0; i < dateWords.Length; i++) { switch (dateWords[i][0]) { // This is a month postfix case DateTimeFormatInfoScanner.MonthPostfixChar: // Get the real month postfix. monthPostfix = dateWords[i].Substring(1); // Add the month name + postfix into the token. AddMonthNames(temp, monthPostfix); break; case DateTimeFormatInfoScanner.IgnorableSymbolChar: String symbol = dateWords[i].Substring(1); InsertHash(temp, symbol, TokenType.IgnorableSymbol, 0); if (this.DateSeparator.Trim(null).Equals(symbol)) { // The date separator is the same as the ingorable symbol. useDateSepAsIgnorableSymbol = true; } break; default: InsertHash(temp, dateWords[i], TokenType.DateWordToken, 0); if (CultureName.Equals("eu-ES")) { // Basque has date words with leading dots InsertHash(temp, "." + dateWords[i], TokenType.DateWordToken, 0); } break; } } } if (!useDateSepAsIgnorableSymbol) { // Use the normal date separator. InsertHash(temp, this.DateSeparator, TokenType.SEP_Date, 0); } // Add the regular month names. AddMonthNames(temp, null); // Add the abbreviated month names. for (int i = 1; i <= 13; i++) { InsertHash(temp, GetAbbreviatedMonthName(i), TokenType.MonthToken, i); } if (CultureName.Equals("gl-ES")) { // // Special case for gl-ES. It has a potential incorrect format in year/month: MMMM'de 'yyyy. // It probably has to be MMMM' de 'yyyy. // // We keep this so that we can still parse dates formatted in the older version. for (int i = 1; i <= 13; i++) { String str; //str = internalGetMonthName(i, MonthNameStyles.Regular, false); // We have to call public methods here to work with inherited DTFI. // Insert the month name first, so that they are at the front of abbrevaited // month names. str = GetMonthName(i); if (str.Length > 0) { // Insert the month name with the postfix first, so it can be matched first. InsertHash(temp, str + "de", TokenType.MonthToken, i); } } } if ((FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0) { for (int i = 1; i <= 13; i++) { String str; str = internalGetMonthName(i, MonthNameStyles.Genitive, false); InsertHash(temp, str, TokenType.MonthToken, i); } } if ((FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != 0) { for (int i = 1; i <= 13; i++) { String str; str = internalGetMonthName(i, MonthNameStyles.LeapYear, false); InsertHash(temp, str, TokenType.MonthToken, i); } } for (int i = 0; i < 7; i++) { //String str = GetDayOfWeekNames()[i]; // We have to call public methods here to work with inherited DTFI. String str = GetDayName((DayOfWeek)i); InsertHash(temp, str, TokenType.DayOfWeekToken, i); str = GetAbbreviatedDayName((DayOfWeek)i); InsertHash(temp, str, TokenType.DayOfWeekToken, i); } int[] eras = calendar.Eras; for (int i = 1; i <= eras.Length; i++) { InsertHash(temp, GetEraName(i), TokenType.EraToken, i); InsertHash(temp, GetAbbreviatedEraName(i), TokenType.EraToken, i); } if (LanguageName.Equals(JapaneseLangName)) { // Japanese allows day of week forms like: "(Tue)" for (int i = 0; i < 7; i++) { String specialDayOfWeek = "(" + GetAbbreviatedDayName((DayOfWeek)i) + ")"; InsertHash(temp, specialDayOfWeek, TokenType.DayOfWeekToken, i); } if (this.Calendar.GetType() != typeof(JapaneseCalendar)) { // Special case for Japanese. If this is a Japanese DTFI, and the calendar is not Japanese calendar, // we will check Japanese Era name as well when the calendar is Gregorian. DateTimeFormatInfo jaDtfi = GetJapaneseCalendarDTFI(); for (int i = 1; i <= jaDtfi.Calendar.Eras.Length; i++) { InsertHash(temp, jaDtfi.GetEraName(i), TokenType.JapaneseEraToken, i); InsertHash(temp, jaDtfi.GetAbbreviatedEraName(i), TokenType.JapaneseEraToken, i); // m_abbrevEnglishEraNames[0] contains the name for era 1, so the token value is i+1. InsertHash(temp, jaDtfi.AbbreviatedEnglishEraNames[i-1], TokenType.JapaneseEraToken, i); } } } else if (CultureName.Equals("zh-TW")) { DateTimeFormatInfo twDtfi = GetTaiwanCalendarDTFI(); for (int i = 1; i <= twDtfi.Calendar.Eras.Length; i++) { if (twDtfi.GetEraName(i).Length > 0) { InsertHash(temp, twDtfi.GetEraName(i), TokenType.TEraToken, i); } } } InsertHash(temp, InvariantInfo.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0); InsertHash(temp, InvariantInfo.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1); // Add invariant month names and day names. for (int i = 1; i <= 12; i++) { String str; // We have to call public methods here to work with inherited DTFI. // Insert the month name first, so that they are at the front of abbrevaited // month names. str = InvariantInfo.GetMonthName(i); InsertHash(temp, str, TokenType.MonthToken, i); str = InvariantInfo.GetAbbreviatedMonthName(i); InsertHash(temp, str, TokenType.MonthToken, i); } for (int i = 0; i < 7; i++) { // We have to call public methods here to work with inherited DTFI. String str = InvariantInfo.GetDayName((DayOfWeek)i); InsertHash(temp, str, TokenType.DayOfWeekToken, i); str = InvariantInfo.GetAbbreviatedDayName((DayOfWeek)i); InsertHash(temp, str, TokenType.DayOfWeekToken, i); } for (int i = 0; i < AbbreviatedEnglishEraNames.Length; i++) { // m_abbrevEnglishEraNames[0] contains the name for era 1, so the token value is i+1. InsertHash(temp, AbbreviatedEnglishEraNames[i], TokenType.EraToken, i + 1); } InsertHash(temp, LocalTimeMark, TokenType.SEP_LocalTimeMark, 0); InsertHash(temp, DateTimeParse.GMTName, TokenType.TimeZoneToken, 0); InsertHash(temp, DateTimeParse.ZuluName, TokenType.TimeZoneToken, 0); InsertHash(temp, invariantDateSeparator, TokenType.SEP_Date, 0); InsertHash(temp, invariantTimeSeparator, TokenType.SEP_Time, 0); if (CultureName.Equals("ky-KG")) { // For some cultures, the date separator works more like a comma, being allowed before or after any date part InsertHash(temp, alternativeDateSeparator, TokenType.IgnorableSymbol, 0); } else { InsertHash(temp, alternativeDateSeparator, TokenType.SEP_Date, 0); } m_dtfiTokenHash = temp; } return (temp); }
// 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; } } }
internal static FORMATFLAGS GetFormatFlagUseSpaceInMonthNames(string[] monthNames, string[] genitveMonthNames, string[] abbrevMonthNames, string[] genetiveAbbrevMonthNames) { return((FORMATFLAGS)(0 | (DateTimeFormatInfoScanner.ArrayElementsBeginWithDigit(monthNames) || DateTimeFormatInfoScanner.ArrayElementsBeginWithDigit(genitveMonthNames) || (DateTimeFormatInfoScanner.ArrayElementsBeginWithDigit(abbrevMonthNames) || DateTimeFormatInfoScanner.ArrayElementsBeginWithDigit(genetiveAbbrevMonthNames)) ? 32 : 0) | (DateTimeFormatInfoScanner.ArrayElementsHaveSpace(monthNames) || DateTimeFormatInfoScanner.ArrayElementsHaveSpace(genitveMonthNames) || (DateTimeFormatInfoScanner.ArrayElementsHaveSpace(abbrevMonthNames) || DateTimeFormatInfoScanner.ArrayElementsHaveSpace(genetiveAbbrevMonthNames)) ? 4 : 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; } }