/*=================================InitEraInfo========================== **Action: Get the era range information from calendar.nlp. **Returns: An array of EraInfo, which contains the information about an era. **Arguments: ** calID the Calendar ID defined in Calendar.cs **============================================================================*/ internal static EraInfo[] InitEraInfo(int calID) { // // Initialize era information. // /* * Japaense era info example: * eraInfo[0] = new EraInfo(4, new DateTime(1989, 1, 8).Ticks, 1988, 1, GregorianCalendar.MaxYear - 1988); // Heisei. Most recent * eraInfo[1] = new EraInfo(3, new DateTime(1926, 12, 25).Ticks, 1925, 1, 1989 - 1925); // Showa * eraInfo[2] = new EraInfo(2, new DateTime(1912, 7, 30).Ticks, 1911, 1, 1926 - 1911); // Taisho * eraInfo[3] = new EraInfo(1, new DateTime(1868, 9, 8).Ticks, 1867, 1, 1912 - 1867); // Meiji */ String[] eraRanges = CalendarTable.GetMultipleStringValues(calID, CalendarTable.SERARANGES, false); EraInfo [] eraInfo = new EraInfo[eraRanges.Length]; int maxEraYear = GregorianCalendar.MaxYear; for (int i = 0; i < eraRanges.Length; i++) { // // The eraRange string is in the form of "4;1989;1;8;1988;1". // num[0] is the era value. // num[1] is the year when the era starts. // num[2] is the month when the era starts. // num[3] is the day when the era starts. // num[4] is the offset to Gregorian year (1988). // num[5] is the minimum era year for this era. // String[] numStrs = eraRanges[i].Split(new char[] { ';' }); int[] nums = new int[6]; for (int j = 0; j < 6; j++) { nums[j] = Int32.Parse(numStrs[j], CultureInfo.InvariantCulture); } eraInfo[i] = new EraInfo(nums[0], new DateTime(nums[1], nums[2], nums[3]).Ticks, nums[4], nums[5], maxEraYear - nums[4]); maxEraYear = nums[1]; } return(eraInfo); }
static CalendarTable() { m_defaultInstance = new CalendarTable("culture.nlp", true); }