当前位置: 首页>>代码示例>>C#>>正文


C# IScriptContext.GetItem方法代码示例

本文整理汇总了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;
        }
开发者ID:Temperament,项目名称:FiestaShark,代码行数:25,代码来源:EvalFunc.cs

示例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();
        }
      }
    }
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:27,代码来源:ScriptQualifiedName.cs

示例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;
    }
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:20,代码来源:ScriptQualifiedName.cs

示例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);
        }
开发者ID:kayateia,项目名称:scriptdotnet,代码行数:10,代码来源:ScriptQualifiedName.cs

示例5: Execute

 public override int Execute(IScriptContext context)
 {
   Machine.AX = context.GetItem(Id, true);
   return 1;
 }
开发者ID:eightrivers,项目名称:SSharp,代码行数:5,代码来源:ValueOperations.cs


注:本文中的IScriptContext.GetItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。