Script Engine source code release 1

Rating: No reviews yet
Downloads: 776
Released: Dec 6, 2009
Updated: Dec 7, 2009 by changwang23
Dev status: Stable Help Icon

Recommended Download

Source Code CShartScriptEngine.src.zip
source code, 156K, uploaded Dec 7, 2009 - 776 downloads

Release Notes

The script engine works as a sub-component in a big application (you can visit it in http://extractweb.com). Current the revision is 1.

In this revision, it implements mainly the logic computation. It's developed with Visual studio 2005 and based on .net 2.0.

How to use it sample (C#):
ScriptContext context = new ScriptContext();

DictionaryExternalValueProvider evp = new DictionaryExternalValueProvider();
evp.AddValue("dt", DateTime.Today);
evp.AddValue("dt2", DateTime.Today.AddDays(1));
evp.AddValue("dt3", DateTime.Today.AddDays(-1));
evp.AddValue("v", "abc");
evp.AddValue("regex", @"^\d+$");
evp.AddValue("i", 10);
evp.AddValue("f", 10.5);

context.AddPortal(evp);

ScriptProcessor processor = new ScriptProcessor(context);

try
{
Console.WriteLine(processor.Evaluate<bool>("IsToday(@dt2) && IsToday(@dt) || DoesMatchRegex(\"38883\", @regex);"));
Console.WriteLine(processor.Evaluate<bool>("!IsToday(@dt) || IsToday(@dt);"));
Console.WriteLine(processor.Evaluate<bool>("1 >=2 && IsToday(@dt);"));
Console.WriteLine(processor.Evaluate<bool>("@i >=20;"));
Console.WriteLine(processor.Evaluate<bool>("@f >=10.4;"));
Console.WriteLine(processor.Evaluate<bool>("IsAfterToday(@dt3);"));
Console.WriteLine(processor.Evaluate<bool>("IsBeforeToday(@dt3);"));
Console.WriteLine(processor.Evaluate<bool>("DoesContainWord(@v, \"d\");"));
Console.WriteLine(processor.Evaluate<bool>("2!=2 || 1==2;"));
}
catch (Exception e)
{
Console.WriteLine("Exception: " + e.Message);
}

Reviews for this release

No reviews yet for this release.