本文整理汇总了C#中IScriptContext.GetItem方法的典型用法代码示例。如果您正苦于以下问题:C# IScriptContext.GetItem方法的具体用法?C# IScriptContext.GetItem怎么用?C# IScriptContext.GetItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScriptContext
的用法示例。
在下文中一共展示了IScriptContext.GetItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Invoke
public object Invoke(IScriptContext context, object[] args)
{
string code = (String)args[0];
ScriptAst result = null;
LanguageCompiler compiler = (LanguageCompiler) context.GetItem("Compiler", true);
RuntimeHost.Lock();
try
{
result = Script.Parse(code + ";", false) as ScriptAst;
//TODO: Create LocalOnlyScope that can't change Parent's variables
//No, need for doing these. It is already done
context.CreateScope();
}
finally
{
RuntimeHost.UnLock();
}
result.Evaluate(context);
context.RemoveLocalScope();
return context.Result;
}
示例2: AssignArray
private void AssignArray(object value, IScriptContext context)
{
var obj = context.GetItem(_identifier, true);
foreach (var node in _modifiers)
{
var functionCall = node as ScriptFunctionCall;
if (functionCall != null)
{
obj = CallFunction(context.GetFunctionDefinition(_identifier), functionCall, context);
continue;
}
var arrayResolution = node as ScriptArrayResolution;
if (arrayResolution != null)
{
SetArrayValue(obj, arrayResolution, context, value);
continue;
}
var genericPostfix = node as ScriptGenericsPostfix;
if (genericPostfix != null)
{
throw new NotSupportedException();
}
}
}
示例3: CreateRef
private IValueReference CreateRef(string id, IScriptContext context, bool resolve, out object value)
{
IValueReference result = context.Ref(id);
value = RuntimeHost.NoVariable;
if (result != null)
{
result.Removed += ReferenceRemoved;
if (resolve)
value = result.Value;
}
else
{
if (resolve)
value = context.GetItem(_identifier, false);
}
return result;
}
示例4: GetIndentifierValue
private static object GetIndentifierValue(IScriptContext context, string identifier)
{
object result = context.GetItem(identifier, false);
if (result != RuntimeHost.NoVariable) return result;
if (RuntimeHost.HasType(identifier))
return RuntimeHost.GetType(identifier);
else
return NameSpaceResolver.Get(identifier);
}
示例5: Execute
public override int Execute(IScriptContext context)
{
Machine.AX = context.GetItem(Id, true);
return 1;
}