3using System.Threading.Tasks;
79 FileName = Path.Combine(Directory.GetCurrentDirectory(), FileName);
90 using (FileStream fs = File.OpenRead(FileName))
92 Bin = await this.LoadBin(fs);
97 string TempFileName = Path.GetTempFileName();
98 File.Copy(FileName, TempFileName,
true);
102 using (FileStream fs = File.OpenRead(TempFileName))
104 Bin = await this.LoadBin(fs);
109 File.Delete(TempFileName);
118 private async Task<byte[]> LoadBin(FileStream fs)
121 if (l >
int.MaxValue)
125 byte[] Bin =
new byte[Len];
130 int i = await fs.ReadAsync(Bin, Pos, Len - Pos);
Static class managing encoding and decoding of internet content.
static Task< object > DecodeAsync(string ContentType, byte[] Data, Encoding Encoding, KeyValuePair< string, string >[] Fields, Uri BaseUri)
Decodes an object.
static string GetContentType(string FileExtension)
Gets the content type of an item, given its file extension. It uses the TryGetContentType to see if a...
LoadFile(ScriptNode FileName, int Start, int Length, Expression Expression)
LoadFile(FileName)
override string FunctionName
Name of the function
override async Task< IElement > EvaluateAsync(IElement[] Arguments, Variables Variables)
Evaluates the function.
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
override string[] DefaultArgumentNames
Default Argument names
LoadFile(ScriptNode FileName, ScriptNode ContentType, int Start, int Length, Expression Expression)
LoadFile(FileName, ContentType)
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Script runtime exception.
Class managing a script expression.
static IElement Encapsulate(object Value)
Encapsulates an object.
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes2Scalar
Two scalar parameters.
static readonly ArgumentType[] argumentTypes1Scalar
One scalar parameter.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
override string ToString()
Expression Expression
Expression of which the node is a part.
int Start
Start position in script expression.
Basic interface for all types of elements.