本文整理汇总了C#中JsValue.As方法的典型用法代码示例。如果您正苦于以下问题:C# JsValue.As方法的具体用法?C# JsValue.As怎么用?C# JsValue.As使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsValue
的用法示例。
在下文中一共展示了JsValue.As方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUTCMonth
private JsValue SetUTCMonth(JsValue thisObj, JsValue[] arguments)
{
var t = EnsureDateInstance(thisObj).PrimitiveValue;
var m = TypeConverter.ToNumber(arguments.At(0));
var dt = arguments.Length <= 1 ? DateFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
var newDate = MakeDate(MakeDay(YearFromTime(t), m, dt), TimeWithinDay(t));
var u = TimeClip(newDate);
thisObj.As<DateInstance>().PrimitiveValue = u;
return u;
}
示例2: SetUTCFullYear
private JsValue SetUTCFullYear(JsValue thisObj, JsValue[] arguments)
{
var thisTime = EnsureDateInstance(thisObj).PrimitiveValue;
var t = double.IsNaN(thisTime) ? +0 : thisTime;
var y = TypeConverter.ToNumber(arguments.At(0));
var m = arguments.Length <= 1 ? MonthFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
var dt = arguments.Length <= 2 ? DateFromTime(t) : TypeConverter.ToNumber(arguments.At(2));
var newDate = MakeDate(MakeDay(y, m, dt), TimeWithinDay(t));
var u = TimeClip(newDate);
thisObj.As<DateInstance>().PrimitiveValue = u;
return u;
}
示例3: SetUTCHours
private JsValue SetUTCHours(JsValue thisObj, JsValue[] arguments)
{
var t = EnsureDateInstance(thisObj).PrimitiveValue;
var h = TypeConverter.ToNumber(arguments.At(0));
var m = arguments.Length <= 1 ? MinFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
var s = arguments.Length <= 2 ? SecFromTime(t) : TypeConverter.ToNumber(arguments.At(2));
var milli = arguments.Length <= 3 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(3));
var date = MakeDate(Day(t), MakeTime(h, m, s, milli));
var u = TimeClip(date);
thisObj.As<DateInstance>().PrimitiveValue = u;
return u;
}
示例4: SetDate
private JsValue SetDate(JsValue thisObj, JsValue[] arguments)
{
var t = LocalTime(EnsureDateInstance(thisObj).PrimitiveValue);
var dt = TypeConverter.ToNumber(arguments.At(0));
var newDate = MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t));
var u = TimeClip(Utc(newDate));
thisObj.As<DateInstance>().PrimitiveValue = u;
return u;
}
示例5: SetMinutes
private JsValue SetMinutes(JsValue thisObj, JsValue[] arguments)
{
var t = LocalTime(EnsureDateInstance(thisObj).PrimitiveValue);
var m = TypeConverter.ToNumber(arguments.At(0));
var s = arguments.Length <= 1 ? SecFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
var milli = arguments.Length <= 2 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(2));
var date = MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli));
var u = TimeClip(Utc(date));
thisObj.As<DateInstance>().PrimitiveValue = u;
return u;
}
示例6: SetUTCMilliseconds
private JsValue SetUTCMilliseconds(JsValue thisObj, JsValue[] arguments)
{
var t = EnsureDateInstance(thisObj).PrimitiveValue;
var time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), TypeConverter.ToNumber(arguments.At(0)));
var u = TimeClip(MakeDate(Day(t), time));
thisObj.As<DateInstance>().PrimitiveValue = u;
return u;
}
示例7: SetYear
private JsValue SetYear(JsValue thisObj, JsValue[] arguments)
{
var thisTime = thisObj.As<DateInstance>().PrimitiveValue;
var t = double.IsNaN(thisTime) ? +0 : LocalTime(thisTime);
var y = TypeConverter.ToNumber(arguments.At(0));
if (double.IsNaN(y))
{
thisObj.As<DateInstance>().PrimitiveValue = double.NaN;
return double.NaN;
}
var fy = TypeConverter.ToInteger(y);
if (y >= 0 && y <= 99)
{
fy = fy + 1900;
}
var newDate = MakeDay(fy, MonthFromTime(t), DateFromTime(t));
var u = Utc(MakeDate(newDate, TimeWithinDay(t)));
thisObj.As<DateInstance>().PrimitiveValue = TimeClip(u);
return u;
}
示例8: SetUTCSeconds
private static JsValue SetUTCSeconds(JsValue thisObj, JsValue[] arguments)
{
var t = thisObj.As<DateInstance>().PrimitiveValue;
var s = TypeConverter.ToNumber(arguments.At(0));
var milli = arguments.Length <= 1 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(1));
var date = MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, milli));
var u = TimeClip(date);
thisObj.As<DateInstance>().PrimitiveValue = u;
return u;
}
示例9: SetTime
private static JsValue SetTime(JsValue thisObj, JsValue[] arguments)
{
return thisObj.As<DateInstance>().PrimitiveValue = TimeClip(TypeConverter.ToNumber(arguments.At(0)));
}