本文整理汇总了C#中ScriptProcessor.Run方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptProcessor.Run方法的具体用法?C# ScriptProcessor.Run怎么用?C# ScriptProcessor.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScriptProcessor
的用法示例。
在下文中一共展示了ScriptProcessor.Run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Call
/// <summary>
/// Executes the function.
/// </summary>
/// <param name="processor">The processor with context that called this functions.</param>
/// <param name="caller">The calling object.</param>
/// <param name="This">The "This" reference used in the call context.</param>
/// <param name="parameters">The parameters used in this function call.</param>
public SObject Call(ScriptProcessor processor, SObject caller, SObject This, SObject[] parameters)
{
ScriptProcessor functionProcessor = new ScriptProcessor(processor.Context);
SObject functionReturnObject;
if (_method != null)
{
functionReturnObject = _method(functionProcessor, caller, This, parameters);
}
else
{
for (int i = 0; i < _parameters.Length; i++)
{
if (parameters.Length > i)
{
functionProcessor.Context.AddVariable(_parameters[i], parameters[i]);
}
else
{
functionProcessor.Context.AddVariable(_parameters[i], functionProcessor.Undefined);
}
}
functionProcessor.Context.This = This;
functionReturnObject = functionProcessor.Run(Body);
}
if (functionProcessor.ErrorHandler.ThrownError)
processor.ErrorHandler.ThrowError(functionProcessor.ErrorHandler.ErrorObject);
return functionReturnObject;
}
示例2: Call
/// <summary>
/// Executes the function.
/// </summary>
/// <param name="processor">The processor with context that called this functions.</param>
/// <param name="caller">The calling object.</param>
/// <param name="This">The "This" reference used in the call context.</param>
/// <param name="parameters">The parameters used in this function call.</param>
public SObject Call(ScriptProcessor processor, SObject caller, SObject This, SObject[] parameters)
{
var functionProcessor = new ScriptProcessor(processor.Context, processor.GetLineNumber());
SObject functionReturnObject;
if (HasBuiltInMethod)
{
if (Method != null)
{
functionReturnObject = Method(functionProcessor, caller, This, parameters);
}
else
{
var dotNetParams = parameters.Select(p => ScriptOutAdapter.Translate(p));
var dotNetReturnObj = DotNetMethod(ScriptOutAdapter.Translate(caller), new ScriptObjectLink(processor, caller), dotNetParams.ToArray());
functionReturnObject = ScriptInAdapter.Translate(processor, dotNetReturnObj);
}
}
else
{
for (var i = 0; i < _parameters.Length; i++)
{
if (parameters.Length > i)
{
functionProcessor.Context.AddVariable(_parameters[i], parameters[i]);
}
else
{
functionProcessor.Context.AddVariable(_parameters[i], functionProcessor.Undefined);
}
}
functionProcessor.Context.This = This;
functionReturnObject = functionProcessor.Run(Body);
}
return functionReturnObject;
}