2using System.Collections.Generic;
57 : base(new
ScriptNode[] {
Year,
Month,
Day,
Hour,
Minute,
Second, TimeZone },
argumentTypes7Scalar,
Start,
Length,
Expression)
77 : base(new
ScriptNode[] {
Year,
Month,
Day,
Hour,
Minute,
Second, MSecond, TimeZone },
argumentTypes8Scalar,
Start,
Length,
Expression)
91 get {
return new string[] {
"Year",
"Month",
"Day",
"Hour",
"Minute",
"Second",
"MSecond",
"TZ" }; }
107 Obj =
Arguments[0].AssociatedObjectValue;
108 string s = Obj?.
ToString() ??
string.Empty;
110 if (
TryParse(s, out System.DateTimeOffset TP))
116 Obj =
Arguments[c - 1].AssociatedObjectValue;
118 if (!(Obj is System.TimeSpan TimeZone))
120 string s = Obj?.
ToString() ??
string.Empty;
128 double[] d =
new double[c];
131 for (i = 0; i < c; i++)
143 return new ObjectValue(
new System.DateTimeOffset((
int)d[0], (
int)d[1], (
int)d[2], 0, 0, 0, TimeZone));
146 return new ObjectValue(
new System.DateTimeOffset((
int)d[0], (
int)d[1], (
int)d[2], (
int)d[3], (
int)d[4], (
int)d[5], TimeZone));
149 return new ObjectValue(
new System.DateTimeOffset((
int)d[0], (
int)d[1], (
int)d[2], (
int)d[3], (
int)d[4], (
int)d[5], (
int)d[6], TimeZone));
162 public static bool TryParse(
string s, out System.DateTimeOffset TP)
166 System.TimeSpan TimeZone;
168 if (s.EndsWith(
"z", StringComparison.CurrentCultureIgnoreCase))
170 TimeZone = System.TimeSpan.Zero;
171 s = s.Substring(0, s.Length - 1).TrimEnd();
175 int i = s.LastIndexOfAny(PlusMinus);
189 TimeZone = -TimeZone;
191 s = s.Substring(0, i).TrimEnd();
200 TP =
new System.DateTimeOffset(TP0, TimeZone);
204 private static readonly
char[] PlusMinus =
new char[] {
'+',
'-' };
216 if (!(Obj is System.DateTimeOffset TPO))
218 if (Obj is System.DateTime TP)
222 case DateTimeKind.Utc:
224 TPO =
new System.DateTimeOffset(TP, System.TimeSpan.Zero);
227 case DateTimeKind.Local:
228 TPO =
new System.DateTimeOffset(TP, TimeZoneInfo.Local.GetUtcOffset(System.DateTime.Now));
232 else if (Obj is
double d)
235 TPO =
new System.DateTimeOffset(TP, System.TimeSpan.Zero);
239 string s = Obj?.
ToString() ??
string.Empty;
Script runtime exception.
Class managing a script expression.
Creates a DateTime value.
static System.DateTime FromInteger(long Nr, DateTimeKind Kind)
Converts an integer to a System.DateTime. If integer is a 32-bit integer, it is considered a UNIX tim...
static bool TryParse(string s, out System.DateTime TP)
Parses DateTime values from short forms of strings.
Creates a DateTimeOffset value.
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
static bool TryParse(string s, out System.DateTimeOffset TP)
Parses DateTimeOffset values from short forms of strings.
DateTimeOffset(ScriptNode Year, ScriptNode Month, ScriptNode Day, ScriptNode Hour, ScriptNode Minute, ScriptNode Second, ScriptNode MSecond, ScriptNode TimeZone, int Start, int Length, Expression Expression)
Creates a DateTimeOffset value.
override string FunctionName
Name of the function
DateTimeOffset(ScriptNode String, int Start, int Length, Expression Expression)
Creates a DateTimeOffset value.
override PatternMatchResult PatternMatch(IElement CheckAgainst, Dictionary< string, IElement > AlreadyFound)
Performs a pattern match operation.
DateTimeOffset(ScriptNode Year, ScriptNode Month, ScriptNode Day, ScriptNode Hour, ScriptNode Minute, ScriptNode Second, ScriptNode TimeZone, int Start, int Length, Expression Expression)
Creates a DateTimeOffset value.
DateTimeOffset(ScriptNode Year, ScriptNode Month, ScriptNode Day, ScriptNode TimeZone, int Start, int Length, Expression Expression)
Creates a DateTimeOffset value.
override string[] DefaultArgumentNames
Default Argument names
Creates a TimeSpan value.
static bool TryParse(string s, out System.TimeSpan TS)
Parses TimeSpan values from short forms of strings.
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes7Scalar
Seven scalar parameters.
static readonly ArgumentType[] argumentTypes8Scalar
Eight scalar parameters.
static readonly ArgumentType[] argumentTypes1Scalar
One scalar parameter.
static readonly ArgumentType[] argumentTypes4Scalar
Four scalar parameters.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
override string ToString()
virtual PatternMatchResult PatternMatch(IElement CheckAgainst, Dictionary< string, IElement > AlreadyFound)
Performs a pattern match operation.
Expression Expression
Expression of which the node is a part.
int Start
Start position in script expression.
double Value
Double value.
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
PatternMatchResult
Status result of a pattern matching operation.