1.
Using the NuGet package "Jurassic", note that if the packages on NuGet are faulty, download the GitHub code yourself, compile the latest code into a DLL, and then refer to it.
The official NuGet package is probably not up to date.
2.
I am the latest source code download compiled, self-referencing. Because the latest package on NuGet (version number "2.2.2") lacks support for Uint8array.
The latest source code compiled assemblies only support the. net4.5 and. Netstandard 2.0
3.
Examples of compiled usages:
//Test 3 Public Static BOOLExecutescript (stringRawess,stringCype) { Object[] para =New Object[] {rawess, cype}; varFuncName ="Validate"; Jurassic.scriptengine engine=NewJurassic.scriptengine (); stringScript =Jsconsts.jscodes; Engine. Execute (script); varDD = engine. Getglobalvalue ("Wavalidator"); varValidatefunc = ((objectinstance) dd). Properties.where (q=>q.key=="Validate"). First (); Engine. Setglobalvalue ("Validate", Validatefunc. Value);//This step is to manually add the function to global to facilitate the following code invocation. varD = engine. callglobalfunction<BOOL>(FuncName, para); returnD; }
4. Execute pass, perfect output JS result! Note that my JS file is the last mini compressed version, using REQUIREJS and other packaged results.
C # executes JavaScript code and executes a new way of complex JavaScript code