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


C# Engine.Get方法代码示例

本文整理汇总了C#中Engine.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Engine.Get方法的具体用法?C# Engine.Get怎么用?C# Engine.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Engine的用法示例。


在下文中一共展示了Engine.Get方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnExecute

 protected override void OnExecute(Engine engine)
 {
     var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
     var value = engine.Get(ValueProperty, Path, CodeTree, type);
     bool foundMatch = false;
     bool executedStatement = false;
     foreach (var statement in Body)
     {
         if (statement is Case)
         {
             // Fell through to a new case group.
             if (executedStatement) return;
             var caseStatement = statement as Case;
             if (!foundMatch)
             {
                 var testValue = caseStatement.Get(engine);
                 if (engine.ShouldInterrupt) return;
                 foundMatch = (bool)engine.Operator(Op.Equals, value, testValue);
             }
         }
         else
         {
             // Found a match
             if (foundMatch)
             {
                 statement.Execute(engine);
                 executedStatement = true;
                 if (engine.ShouldInterrupt) return;
             }
         }
     }
     if (!executedStatement) Default.Execute(engine);
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:33,代码来源:Switch.cs

示例2: OnExecute

 protected override void OnExecute(Engine engine)
 {
     if (!ShouldExecute(engine)) return;
     var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
     var value = engine.Get(ValueProperty, Path, CodeTree, type);
     if (Merge)
         foreach (var item in value as IList) engine.YieldValue(TypeHelper.Convert(item, type));
     else
         engine.YieldValue(value);
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:10,代码来源:Yield.cs

示例3: OnExecute

 protected override void OnExecute(Engine engine)
 {
     var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
     var value = engine.Get(ValueProperty, Path, CodeTree) as IEnumerable;
     var name = engine.GetVariable(Var, VarCodeTree);
     foreach (object item in value)
     {
         engine.DefineVariable(name, TypeHelper.Convert(item, type));
         Body.Execute(engine);
         engine.ClearShouldContinue();
         if (engine.ShouldInterrupt) break;
     }
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:13,代码来源:ForEach.cs

示例4: OnExecute

 protected override void OnExecute(Engine engine)
 {
     if (engine.HasBindingOrValue(ValueProperty, Path))
     {
         if ((bool)engine.Get(ValueProperty, Path, CodeTree, typeof(bool))) Body.Execute(engine);
         return;
     }
     if (Body.Count == 0) engine.Throw("missing condition");
     var expression = Body[0] as IExpression;
     if (expression == null) engine.Throw("missing expression");
     if (!TypeHelper.ConvertToBool(expression.Get(engine))) return;
     Body.ExecuteSkipOne(engine);
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:13,代码来源:When.cs

示例5: AccessItem

 private object AccessItem(bool isSet, Engine engine, object value)
 {
     var op = isSet ? Op.SetItem : Op.GetItem;
     var context = engine.GetContext(Path, CodeTree);
     if (Arguments.Count != 0)
     {
         var combinedArgs = new object[] { context }.Concat(Arguments.Get(engine));
         if (isSet) combinedArgs.Concat(new object[] { value });
         return engine.Operator(op, combinedArgs.ToArray());
     }
     var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
     var index = engine.Get(IndexProperty, IndexPath, IndexCodeTree, type);
     if (!isSet) return engine.Operator(op, context, index);
     return engine.Operator(op, context, index, value);
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:15,代码来源:ItemAccessor.cs

示例6: OnGet

 protected override object OnGet(Engine engine)
 {
     return SetItem(engine, engine.Get(ValueProperty, ValuePath, ValueCodeTree));
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:4,代码来源:SetItem.cs

示例7: OnGet

 protected override object OnGet(Engine engine)
 {
     if (Var != null) return engine.GetVariable(engine.GetVariable(Var, VarCodeTree));
     var context = engine.GetContext(Path, CodeTree);
     var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
     if (PropertyName != null)
         return PathHelper.GetProperty(engine, context, PropertyName);
     if (FieldName != null)
         return PathHelper.GetField(engine, context, FieldName);
     if (DependencyProperty != null)
         return PathHelper.GetDependencyProperty(engine, context as DependencyObject, DependencyProperty);
     if (StaticPropertyName != null)
         return PathHelper.GetStaticProperty(engine, type, StaticPropertyName);
     if (StaticFieldName != null)
         return PathHelper.GetStaticField(engine, type, StaticFieldName);
     if (Path != null)
         return context;
     return engine.Get(SourceProperty);
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:19,代码来源:Get.cs

示例8: ShouldExecute

 protected bool ShouldExecute(Engine engine)
 {
     var when = engine.Get(WhenProperty, WhenPath, WhenCodeTree);
     if (when == null) return true;
     return TypeHelper.ConvertToBool(when);
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:6,代码来源:ConditionalValueStatement.cs

示例9: OnGet

 protected override object OnGet(Engine engine)
 {
     return new DictionaryEntry(engine.Get(KeyProperty, KeyPath, KeyCodeTree), engine.Get(ValueProperty, ValuePath, CodeTree));
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:4,代码来源:Pair.cs

示例10: OnExecute

        protected override void OnExecute(Engine engine)
        {
            // Use the same name and type for the whole loop.
            var name = engine.GetVariable(Var, VarCodeTree);
            var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
            if (type == null && (UpperLimit != null || Increment != null)) type = typeof(int);

            // If no name is specified then forever.
            if (name == null)
            {
                engine.SetBreakFrame();
                while (true)
                {
                    Body.Execute(engine);
                    engine.ClearShouldContinue();
                    if (engine.ShouldInterrupt) break;
                }
                return;
            }

            // Normal loop processing.
            SetLoopValue(name, engine.Get(ValueProperty, Path, CodeTree, type), type, engine);
            engine.SetBreakFrame();
            while (true)
            {
                if (While != null)
                {
                    if (!(bool)engine.Get(WhileProperty, WhilePath, WhileCodeTree, typeof(bool))) break;
                }
                else if (UpperLimit != null)
                {
                    var limit = engine.Get(UpperLimitProperty, UpperLimitPath, UpperLimitCodeTree, type);
                    if (!(bool)engine.Operator(Op.LessThan, GetLoopValue(name, type, engine), limit)) break;
                }
                Body.Execute(engine);
                engine.ClearShouldContinue();
                if (engine.ShouldInterrupt) break;
                if (Next.Count != 0)
                    Next.Execute(engine);
                else if (Increment != null)
                {
                    var increment = engine.Get(IncrementProperty, IncrementPath, IncrementCodeTree, type);
                    SetLoopValue(name, engine.Operator(Op.Plus, GetLoopValue(name, type, engine), increment), type, engine);
                }
            }
        }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:46,代码来源:For.cs

示例11: Get

 public object Get(Engine engine)
 {
     return engine.FrameFunc(this, e => engine.Get(ValueProperty, Path, CodeTree));
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:4,代码来源:Property.cs

示例12: OnGet

 protected override object OnGet(Engine engine)
 {
     if (Path != null && CodeTree.Compile(engine, CodeType.Get, Path).IsSetOrIncrement)
         return CodeTree.Get(engine);
     var value = engine.Get(ValueProperty, ValuePath, ValueCodeTree);
     if (Var != null)
     {
         var variable = engine.GetVariable(Var, VarCodeTree);
         if (Op != AssignmentOp.Assign)
         {
             var oldValue = engine.GetVariable(variable);
             value = engine.Operator(Op, oldValue, value);
         }
         engine.DefineVariableInParentScope(variable, value);
         return value;
     }
     if (IsBareTarget)
     {
         var target = engine.Get(TargetProperty);
         target = engine.Operator(Op, target, value);
         Target = value;
         return value;
     }
     var context = engine.Context;
     var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
     if (Op != AssignmentOp.Assign)
     {
         object oldValue = null;
         if (DependencyProperty != null)
             oldValue = PathHelper.GetDependencyProperty(engine, context as DependencyObject, DependencyProperty);
         else if (PropertyName != null)
             oldValue = PathHelper.GetProperty(engine, context, PropertyName);
         else if (FieldName != null)
             oldValue = PathHelper.GetField(engine, context, FieldName);
         else if (StaticPropertyName != null)
             oldValue = PathHelper.GetStaticProperty(engine, type, StaticPropertyName);
         else if (StaticFieldName != null)
             oldValue = PathHelper.GetStaticField(engine, type, StaticFieldName);
         else if (Path != null)
             oldValue = engine.GetPath(Path, CodeTree);
         else
             oldValue = context;
         value = engine.Operator(Op, oldValue, value);
     }
     if (DependencyProperty != null)
         PathHelper.SetDependencyProperty(engine, context as DependencyObject, DependencyProperty, value);
     else if (PropertyName != null)
         PathHelper.SetProperty(engine, context, PropertyName, value);
     else if (FieldName != null)
         PathHelper.SetField(engine, context, FieldName, value);
     else if (StaticPropertyName != null)
         PathHelper.SetStaticProperty(engine, type, StaticPropertyName, value);
     else if (StaticFieldName != null)
         PathHelper.SetStaticField(engine, type, StaticFieldName, value);
     else if (Path != null)
         engine.SetPath(Path, SetCodeTree, value);
     else
         Context = value;
     return value;
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:60,代码来源:Set.cs

示例13: OnGet

 protected override object OnGet(Engine engine)
 {
     if (Quote) return engine.Quote(ValueProperty);
     var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
     return engine.Get(ValueProperty, Path, CodeTree, type);
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:6,代码来源:Expr.cs

示例14: OnGet

 protected override object OnGet(Engine engine)
 {
     if (Op == default(Op)) engine.Throw("missing operator");
     var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
     if (Arguments.Count == 0)
     {
         var arity = Op.GetArity();
         if (arity == 1)
             return engine.Operator(Op, engine.Get(ValueProperty, Path, CodeTree, type));
         var value1 = engine.Get(Value1Property, Path1, CodeTree1, type);
         var value2 = engine.Get(Value2Property, Path2, CodeTree2, type);
         return engine.Operator(Op, value1, value2);
     }
     return engine.Operator(Op, Arguments);
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:15,代码来源:Operator.cs


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