245 lines
6.3 KiB
C#
245 lines
6.3 KiB
C#
using System;
|
|
|
|
namespace System.Globalization
|
|
{
|
|
// Token: 0x02000170 RID: 368
|
|
internal class CCHebrewCalendar
|
|
{
|
|
// Token: 0x060011EA RID: 4586 RVA: 0x0004686C File Offset: 0x00044A6C
|
|
public static bool is_leap_year(int year)
|
|
{
|
|
return CCMath.mod(7 * year + 1, 19) < 7;
|
|
}
|
|
|
|
// Token: 0x060011EB RID: 4587 RVA: 0x00046880 File Offset: 0x00044A80
|
|
public static int last_month_of_year(int year)
|
|
{
|
|
return (!CCHebrewCalendar.is_leap_year(year)) ? 12 : 13;
|
|
}
|
|
|
|
// Token: 0x060011EC RID: 4588 RVA: 0x00046898 File Offset: 0x00044A98
|
|
public static int elapsed_days(int year)
|
|
{
|
|
int num = CCMath.div(235 * year - 234, 19);
|
|
int num3;
|
|
int num2 = CCMath.div_mod(out num3, num, 1080);
|
|
int num4 = 204 + 793 * num3;
|
|
int num5 = 11 + 12 * num + 793 * num2 + CCMath.div(num4, 1080);
|
|
int num6 = 29 * num + CCMath.div(num5, 24);
|
|
if (CCMath.mod(3 * (num6 + 1), 7) < 3)
|
|
{
|
|
num6++;
|
|
}
|
|
return num6;
|
|
}
|
|
|
|
// Token: 0x060011ED RID: 4589 RVA: 0x00046920 File Offset: 0x00044B20
|
|
public static int new_year_delay(int year)
|
|
{
|
|
int num = CCHebrewCalendar.elapsed_days(year);
|
|
int num2 = CCHebrewCalendar.elapsed_days(year + 1);
|
|
if (num2 - num == 356)
|
|
{
|
|
return 2;
|
|
}
|
|
int num3 = CCHebrewCalendar.elapsed_days(year - 1);
|
|
if (num - num3 == 382)
|
|
{
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// Token: 0x060011EE RID: 4590 RVA: 0x00046968 File Offset: 0x00044B68
|
|
public static int last_day_of_month(int month, int year)
|
|
{
|
|
if (month < 1 || month > 13)
|
|
{
|
|
throw new ArgumentOutOfRangeException("month", "Month should be between One and Thirteen.");
|
|
}
|
|
switch (month)
|
|
{
|
|
case 2:
|
|
return 29;
|
|
case 4:
|
|
return 29;
|
|
case 6:
|
|
return 29;
|
|
case 8:
|
|
if (!CCHebrewCalendar.long_heshvan(year))
|
|
{
|
|
return 29;
|
|
}
|
|
break;
|
|
case 9:
|
|
if (CCHebrewCalendar.short_kislev(year))
|
|
{
|
|
return 29;
|
|
}
|
|
break;
|
|
case 10:
|
|
return 29;
|
|
case 12:
|
|
if (!CCHebrewCalendar.is_leap_year(year))
|
|
{
|
|
return 29;
|
|
}
|
|
break;
|
|
case 13:
|
|
return 29;
|
|
}
|
|
return 30;
|
|
}
|
|
|
|
// Token: 0x060011EF RID: 4591 RVA: 0x00046A20 File Offset: 0x00044C20
|
|
public static bool long_heshvan(int year)
|
|
{
|
|
return CCMath.mod(CCHebrewCalendar.days_in_year(year), 10) == 5;
|
|
}
|
|
|
|
// Token: 0x060011F0 RID: 4592 RVA: 0x00046A34 File Offset: 0x00044C34
|
|
public static bool short_kislev(int year)
|
|
{
|
|
return CCMath.mod(CCHebrewCalendar.days_in_year(year), 10) == 3;
|
|
}
|
|
|
|
// Token: 0x060011F1 RID: 4593 RVA: 0x00046A48 File Offset: 0x00044C48
|
|
public static int days_in_year(int year)
|
|
{
|
|
return CCHebrewCalendar.fixed_from_dmy(1, 7, year + 1) - CCHebrewCalendar.fixed_from_dmy(1, 7, year);
|
|
}
|
|
|
|
// Token: 0x060011F2 RID: 4594 RVA: 0x00046A60 File Offset: 0x00044C60
|
|
public static int fixed_from_dmy(int day, int month, int year)
|
|
{
|
|
int num = -1373428;
|
|
num += CCHebrewCalendar.elapsed_days(year);
|
|
num += CCHebrewCalendar.new_year_delay(year);
|
|
if (month < 7)
|
|
{
|
|
int num2 = CCHebrewCalendar.last_month_of_year(year);
|
|
for (int i = 7; i <= num2; i++)
|
|
{
|
|
num += CCHebrewCalendar.last_day_of_month(i, year);
|
|
}
|
|
for (int i = 1; i < month; i++)
|
|
{
|
|
num += CCHebrewCalendar.last_day_of_month(i, year);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int i = 7; i < month; i++)
|
|
{
|
|
num += CCHebrewCalendar.last_day_of_month(i, year);
|
|
}
|
|
}
|
|
return num + day;
|
|
}
|
|
|
|
// Token: 0x060011F3 RID: 4595 RVA: 0x00046AF4 File Offset: 0x00044CF4
|
|
public static int year_from_fixed(int date)
|
|
{
|
|
int num = (int)Math.Floor((double)(date - -1373427) / 365.24682220597794);
|
|
int num2 = num;
|
|
while (date >= CCHebrewCalendar.fixed_from_dmy(1, 7, num2))
|
|
{
|
|
num2++;
|
|
}
|
|
return num2 - 1;
|
|
}
|
|
|
|
// Token: 0x060011F4 RID: 4596 RVA: 0x00046B38 File Offset: 0x00044D38
|
|
public static void my_from_fixed(out int month, out int year, int date)
|
|
{
|
|
year = CCHebrewCalendar.year_from_fixed(date);
|
|
int num = ((date >= CCHebrewCalendar.fixed_from_dmy(1, 1, year)) ? 1 : 7);
|
|
month = num;
|
|
while (date > CCHebrewCalendar.fixed_from_dmy(CCHebrewCalendar.last_day_of_month(month, year), month, year))
|
|
{
|
|
month++;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060011F5 RID: 4597 RVA: 0x00046B8C File Offset: 0x00044D8C
|
|
public static void dmy_from_fixed(out int day, out int month, out int year, int date)
|
|
{
|
|
CCHebrewCalendar.my_from_fixed(out month, out year, date);
|
|
day = date - CCHebrewCalendar.fixed_from_dmy(1, month, year) + 1;
|
|
}
|
|
|
|
// Token: 0x060011F6 RID: 4598 RVA: 0x00046BA8 File Offset: 0x00044DA8
|
|
public static int month_from_fixed(int date)
|
|
{
|
|
int num;
|
|
int num2;
|
|
CCHebrewCalendar.my_from_fixed(out num, out num2, date);
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x060011F7 RID: 4599 RVA: 0x00046BC0 File Offset: 0x00044DC0
|
|
public static int day_from_fixed(int date)
|
|
{
|
|
int num;
|
|
int num2;
|
|
int num3;
|
|
CCHebrewCalendar.dmy_from_fixed(out num, out num2, out num3, date);
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x060011F8 RID: 4600 RVA: 0x00046BDC File Offset: 0x00044DDC
|
|
public static int date_difference(int dayA, int monthA, int yearA, int dayB, int monthB, int yearB)
|
|
{
|
|
return CCHebrewCalendar.fixed_from_dmy(dayB, monthB, yearB) - CCHebrewCalendar.fixed_from_dmy(dayA, monthA, yearA);
|
|
}
|
|
|
|
// Token: 0x060011F9 RID: 4601 RVA: 0x00046BF4 File Offset: 0x00044DF4
|
|
public static int day_number(int day, int month, int year)
|
|
{
|
|
return CCHebrewCalendar.date_difference(1, 7, year, day, month, year) + 1;
|
|
}
|
|
|
|
// Token: 0x060011FA RID: 4602 RVA: 0x00046C04 File Offset: 0x00044E04
|
|
public static int days_remaining(int day, int month, int year)
|
|
{
|
|
return CCHebrewCalendar.date_difference(day, month, year, 1, 7, year + 1) - 1;
|
|
}
|
|
|
|
// Token: 0x0400048B RID: 1163
|
|
private const int epoch = -1373427;
|
|
|
|
// Token: 0x02000171 RID: 369
|
|
public enum Month
|
|
{
|
|
// Token: 0x0400048D RID: 1165
|
|
nisan = 1,
|
|
// Token: 0x0400048E RID: 1166
|
|
iyyar,
|
|
// Token: 0x0400048F RID: 1167
|
|
sivan,
|
|
// Token: 0x04000490 RID: 1168
|
|
tammuz,
|
|
// Token: 0x04000491 RID: 1169
|
|
av,
|
|
// Token: 0x04000492 RID: 1170
|
|
elul,
|
|
// Token: 0x04000493 RID: 1171
|
|
tishri,
|
|
// Token: 0x04000494 RID: 1172
|
|
heshvan,
|
|
// Token: 0x04000495 RID: 1173
|
|
kislev,
|
|
// Token: 0x04000496 RID: 1174
|
|
teveth,
|
|
// Token: 0x04000497 RID: 1175
|
|
shevat,
|
|
// Token: 0x04000498 RID: 1176
|
|
adar,
|
|
// Token: 0x04000499 RID: 1177
|
|
adar_I = 12,
|
|
// Token: 0x0400049A RID: 1178
|
|
adar_II
|
|
}
|
|
}
|
|
}
|