本文整理汇总了C#中JsDictionaryObject.ToNumber方法的典型用法代码示例。如果您正苦于以下问题:C# JsDictionaryObject.ToNumber方法的具体用法?C# JsDictionaryObject.ToNumber怎么用?C# JsDictionaryObject.ToNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsDictionaryObject
的用法示例。
在下文中一共展示了JsDictionaryObject.ToNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUTCFullYearImpl
/// <summary>
/// 15.9.5.41
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance SetUTCFullYearImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (parameters.Length == 0)
throw new ArgumentException("There was no year specified");
DateTime valueOf = CreateDateTime(target.ToNumber());
valueOf = valueOf.AddYears(-valueOf.Year);
valueOf = valueOf.AddYears((int)parameters[0].ToNumber());
target.Value = valueOf;
if (parameters.Length > 1)
{
JsInstance[] innerParams = new JsInstance[parameters.Length - 1];
parameters.CopyTo(innerParams, 1);
target = (JsDate)SetMonthImpl(target, innerParams);
}
return target;
}
示例2: SetHoursImpl
/// <summary>
/// 15.9.5.35
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance SetHoursImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (parameters.Length == 0)
throw new ArgumentException("There was no hour specified");
DateTime valueOf = CreateDateTime(target.ToNumber()).ToLocalTime();
valueOf = valueOf.AddHours(-valueOf.Hour);
valueOf = valueOf.AddHours(parameters[0].ToNumber());
target.Value = valueOf;
if (parameters.Length > 1)
{
JsInstance[] innerParams = new JsInstance[parameters.Length - 1];
parameters.CopyTo(innerParams, 1);
target = (JsDate)SetMinutesImpl(target, innerParams);
}
return target;
}
示例3: SetUTCDateImpl
/// <summary>
/// 15.9.5.37
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance SetUTCDateImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (parameters.Length == 0)
throw new ArgumentException("There was no date specified");
DateTime valueOf = CreateDateTime(target.ToNumber());
valueOf = valueOf.AddDays(-valueOf.Day);
valueOf = valueOf.AddDays(parameters[0].ToNumber());
target.Value = valueOf;
return target;
}
示例4: GetUTCMillisecondsImpl
/// <summary>
/// 15.9.5.25
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance GetUTCMillisecondsImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (double.IsNaN(target.ToNumber()))
{
return Global.NaN;
}
return Global.NumberClass.New(CreateDateTime(target.ToNumber()).ToUniversalTime().Millisecond);
}
示例5: SetUTCMillisecondsImpl
/// <summary>
/// 15.9.5.29
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance SetUTCMillisecondsImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (parameters.Length == 0)
throw new ArgumentException("There was no millisecond specified");
DateTime valueOf = CreateDateTime(target.ToNumber());
valueOf = valueOf.AddMilliseconds(-valueOf.Millisecond);
valueOf = valueOf.AddMilliseconds(parameters[0].ToNumber());
target.Value = New(valueOf).ToNumber();
return target;
}
示例6: GetMinutesImpl
/// <summary>
/// 15.9.5.20
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance GetMinutesImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (double.IsNaN(target.ToNumber()))
{
return Global.NaN;
}
return Global.NumberClass.New(CreateDateTime(target.ToNumber()).ToLocalTime().Minute);
}
示例7: ToUTCStringImpl
/// <summary>
/// 15.9.5.
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance ToUTCStringImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (double.IsNaN(target.ToNumber()))
{
return Global.StringClass.New(double.NaN.ToString());
}
return Global.StringClass.New(CreateDateTime(target.ToNumber()).ToString(JsDate.FORMATUTC, CultureInfo.InvariantCulture));
}
示例8: GetTimeImpl
/// <summary>
/// 15.9.5.9
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance GetTimeImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (double.IsNaN(target.ToNumber()))
{
return Global.NaN;
}
return Global.NumberClass.New(CreateDateTime(target.ToNumber()).TimeOfDay.Ticks / JsDate.TICKSFACTOR);
}
示例9: GetUTCDayImpl
/// <summary>
/// 15.9.5.17
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance GetUTCDayImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (double.IsNaN(target.ToNumber()))
{
return Global.NaN;
}
return Global.NumberClass.New((int)CreateDateTime(target.ToNumber()).ToUniversalTime().DayOfWeek);
}
示例10: ToLocaleTimeStringImpl
/// <summary>
/// 15.9.5.7
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance ToLocaleTimeStringImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (double.IsNaN(target.ToNumber()))
{
return Global.StringClass.New(double.NaN.ToString());
}
return Global.StringClass.New(CreateDateTime(target.ToNumber()).ToLocalTime().ToString(JsDate.TIMEFORMAT));
}
示例11: ValueOfImpl
/// <summary>
/// 15.9.5.8
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance ValueOfImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (double.IsNaN(target.ToNumber()))
{
return Global.NaN;
}
return Global.NumberClass.New(target.ToNumber());
}
示例12: ToLocaleStringImpl
/// <summary>
///
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance ToLocaleStringImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (double.IsNaN(target.ToNumber()))
{
return Global.StringClass.New(double.NaN.ToString());
}
return Global.StringClass.New(CreateDateTime(target.ToNumber()).ToLocalTime().ToString("F", CultureInfo.CurrentCulture));
}
示例13: SetUTCMonthImpl
/// <summary>
/// 15.9.5.39
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance SetUTCMonthImpl(JsDictionaryObject target, JsInstance[] parameters) {
if (parameters.Length == 0)
throw new ArgumentException("There was no month specified");
DateTime valueOf = CreateDateTime(target.ToNumber());
valueOf = valueOf.AddMonths(-valueOf.Month);
valueOf = valueOf.AddMonths((int)parameters[0].ToNumber() + 1);
target.Value = valueOf;
if (parameters.Length > 1) {
JsInstance[] innerParams = new JsInstance[parameters.Length - 1];
Array.Copy(parameters, 1, innerParams, 0, innerParams.Length);
target = (JsDate)SetDateImpl(target, innerParams);
}
return target;
}
示例14: SetSecondsImpl
/// <summary>
/// 15.9.5.30
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance SetSecondsImpl(JsDictionaryObject target, JsInstance[] parameters) {
if (parameters.Length == 0)
throw new ArgumentException("There was no second specified");
DateTime valueOf = CreateDateTime(target.ToNumber()).ToLocalTime();
valueOf = valueOf.AddSeconds(-valueOf.Second);
valueOf = valueOf.AddSeconds(parameters[0].ToNumber());
target.Value = valueOf;
if (parameters.Length > 1) {
JsInstance[] innerParams = new JsInstance[parameters.Length - 1];
Array.Copy(parameters,1, innerParams, 0, innerParams.Length);
target = (JsDate)SetMillisecondsImpl(target, innerParams);
}
return target;
}
示例15: GetUTCMonthImpl
/// <summary>
/// 15.9.5.13
/// </summary>
/// <param name="target"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public JsInstance GetUTCMonthImpl(JsDictionaryObject target, JsInstance[] parameters)
{
if (double.IsNaN(target.ToNumber()))
{
return Global.NaN;
}
return Global.NumberClass.New(CreateDateTime(target.ToNumber()).Month - 1);
}