namespace com.hitrust.trustpay.client
|
|
{
|
|
using System;
|
|
using System.Globalization;
|
|
|
|
public class HiCalendar : GregorianCalendar
|
|
{
|
|
protected DateTime iDateTime = DateTime.Now;
|
|
protected internal static string[] sLocalMonthName = new string[] { "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" };
|
|
protected internal static string[] sLocalShortMonthName = new string[] { "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二" };
|
|
protected internal static string[] sLocalShortWeekName = new string[] { "日", "一", "二", "三", "四", "五", "六" };
|
|
protected internal static string[] sLocalWeekName = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
|
|
protected internal static string[] sMonthName = new string[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
|
|
protected internal static string[] sShortMonthName = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
|
protected internal static string[] sShortWeekName = new string[] { "Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat" };
|
|
protected internal static string[] sWeekName = new string[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
|
|
|
|
public int hashCode()
|
|
{
|
|
return base.GetHashCode();
|
|
}
|
|
|
|
public virtual string toString(string aTimeFormat)
|
|
{
|
|
int tFormatLength = aTimeFormat.Length;
|
|
int tValue = 0;
|
|
string tString = "";
|
|
string tFormatedString = "";
|
|
for (int i = 0; i < tFormatLength; i++)
|
|
{
|
|
if ((aTimeFormat[i] != '%') || (i == (tFormatLength - 1)))
|
|
{
|
|
goto Label_0404;
|
|
}
|
|
i++;
|
|
char CS40002 = aTimeFormat[i];
|
|
switch (CS40002)
|
|
{
|
|
case 'H':
|
|
{
|
|
tValue = this.iDateTime.Hour;
|
|
if (tValue < 10)
|
|
{
|
|
tFormatedString = tFormatedString + "0";
|
|
}
|
|
tFormatedString = tFormatedString + tValue.ToString();
|
|
continue;
|
|
}
|
|
case 'I':
|
|
{
|
|
tValue = this.iDateTime.Hour;
|
|
if (tValue > 12)
|
|
{
|
|
tValue -= 12;
|
|
}
|
|
if (tValue < 10)
|
|
{
|
|
tFormatedString = tFormatedString + "0";
|
|
}
|
|
tFormatedString = tFormatedString + tValue.ToString();
|
|
continue;
|
|
}
|
|
case 'L':
|
|
if (i == (tFormatLength - 1))
|
|
{
|
|
continue;
|
|
}
|
|
i++;
|
|
CS40002 = aTimeFormat[i];
|
|
if (CS40002 > 'Y')
|
|
{
|
|
break;
|
|
}
|
|
switch (CS40002)
|
|
{
|
|
case 'B':
|
|
goto Label_0259;
|
|
|
|
case 'Y':
|
|
goto Label_0297;
|
|
}
|
|
goto Label_02BE;
|
|
|
|
case 'M':
|
|
{
|
|
tValue = this.iDateTime.Minute;
|
|
if (tValue < 10)
|
|
{
|
|
tFormatedString = tFormatedString + "0";
|
|
}
|
|
tFormatedString = tFormatedString + tValue.ToString();
|
|
continue;
|
|
}
|
|
case 'S':
|
|
{
|
|
tValue = this.iDateTime.Second;
|
|
if (tValue < 10)
|
|
{
|
|
tFormatedString = tFormatedString + "0";
|
|
}
|
|
tFormatedString = tFormatedString + tValue.ToString();
|
|
continue;
|
|
}
|
|
case 'B':
|
|
{
|
|
tFormatedString = tFormatedString + sMonthName[this.iDateTime.Month - 1];
|
|
continue;
|
|
}
|
|
case 'x':
|
|
{
|
|
tFormatedString = tFormatedString + this.toString("%m/%d/%y");
|
|
continue;
|
|
}
|
|
case 'y':
|
|
{
|
|
tString = this.iDateTime.Year.ToString();
|
|
tFormatedString = tFormatedString + tString.Substring(2, 2);
|
|
continue;
|
|
}
|
|
case 'm':
|
|
{
|
|
tValue = this.iDateTime.Month;
|
|
if (tValue < 10)
|
|
{
|
|
tFormatedString = tFormatedString + "0";
|
|
}
|
|
tFormatedString = tFormatedString + tValue.ToString();
|
|
continue;
|
|
}
|
|
case 'X':
|
|
{
|
|
tFormatedString = tFormatedString + this.toString("%H:%M:%S");
|
|
continue;
|
|
}
|
|
case 'Y':
|
|
{
|
|
tValue = this.iDateTime.Year;
|
|
tFormatedString = tFormatedString + tValue.ToString();
|
|
continue;
|
|
}
|
|
case 'b':
|
|
{
|
|
tFormatedString = tFormatedString + sShortMonthName[this.iDateTime.Month - 1];
|
|
continue;
|
|
}
|
|
case 'c':
|
|
{
|
|
tFormatedString = tFormatedString + this.toString("%x %X");
|
|
continue;
|
|
}
|
|
case 'd':
|
|
{
|
|
tValue = this.iDateTime.Day;
|
|
if (tValue < 10)
|
|
{
|
|
tFormatedString = tFormatedString + "0";
|
|
}
|
|
tFormatedString = tFormatedString + tValue.ToString();
|
|
continue;
|
|
}
|
|
default:
|
|
goto Label_03EB;
|
|
}
|
|
if (CS40002 != 'b')
|
|
{
|
|
if (CS40002 == 'y')
|
|
{
|
|
goto Label_0275;
|
|
}
|
|
goto Label_02BE;
|
|
}
|
|
tFormatedString = tFormatedString + sLocalShortMonthName[this.iDateTime.Month - 1];
|
|
continue;
|
|
Label_0259:
|
|
tFormatedString = tFormatedString + sLocalMonthName[this.iDateTime.Month - 1];
|
|
continue;
|
|
Label_0275:
|
|
tValue = this.iDateTime.Year - 0x777;
|
|
tFormatedString = tFormatedString + tValue.ToString();
|
|
continue;
|
|
Label_0297:
|
|
tValue = this.iDateTime.Year - 0x777;
|
|
tFormatedString = tFormatedString + tValue.ToString() + "年";
|
|
continue;
|
|
Label_02BE:
|
|
tFormatedString = tFormatedString + aTimeFormat[i];
|
|
continue;
|
|
Label_03EB:
|
|
tFormatedString = tFormatedString + aTimeFormat[i];
|
|
continue;
|
|
Label_0404:
|
|
tFormatedString = tFormatedString + aTimeFormat[i];
|
|
}
|
|
return tFormatedString;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return base.ToString();
|
|
}
|
|
}
|
|
}
|
|
|