本文整理汇总了C#中Rhino.Context.DecompileScript方法的典型用法代码示例。如果您正苦于以下问题:C# Context.DecompileScript方法的具体用法?C# Context.DecompileScript怎么用?C# Context.DecompileScript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Context
的用法示例。
在下文中一共展示了Context.DecompileScript方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public object Run(Context cx)
{
Script script = cx.CompileString(source, "my script", 0, null);
NUnit.Framework.Assert.AreEqual(source, cx.DecompileScript(script, 4).Trim());
return null;
}
示例2: ExecIdCall
public override object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args)
{
if (!f.HasTag(SCRIPT_TAG))
{
return base.ExecIdCall(f, cx, scope, thisObj, args);
}
int id = f.MethodId();
switch (id)
{
case Id_constructor:
{
string source = (args.Length == 0) ? string.Empty : ScriptRuntime.ToString(args[0]);
Script script = Compile(cx, source);
Rhino.NativeScript nscript = new Rhino.NativeScript(script);
ScriptRuntime.SetObjectProtoAndParent(nscript, scope);
return nscript;
}
case Id_toString:
{
Rhino.NativeScript real = RealThis(thisObj, f);
Script realScript = real.script;
if (realScript == null)
{
return string.Empty;
}
return cx.DecompileScript(realScript, 0);
}
case Id_exec:
{
throw Context.ReportRuntimeError1("msg.cant.call.indirect", "exec");
}
case Id_compile:
{
Rhino.NativeScript real = RealThis(thisObj, f);
string source = ScriptRuntime.ToString(args, 0);
real.script = Compile(cx, source);
return real;
}
}
throw new ArgumentException(id.ToString());
}