本文整理汇总了C#中Loop类的典型用法代码示例。如果您正苦于以下问题:C# Loop类的具体用法?C# Loop怎么用?C# Loop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Loop类属于命名空间,在下文中一共展示了Loop类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EdiMapping
private EdiMapping(XDocument xml)
{
if (xml.Root == null)
throw new Exception("XML is missing a root element.");
Errors = new List<string>();
_root = ReadLoop(xml.Root);
}
示例2: Compile
public override void Compile(ByteCode bc)
{
var L = new Loop
{
Scope = m_StackFrame
};
bc.PushSourceRef(m_Repeat);
bc.LoopTracker.Loops.Push(L);
var start = bc.GetJumpPointForNextInstruction();
bc.Emit_Enter(m_StackFrame);
m_Block.Compile(bc);
bc.PopSourceRef();
bc.PushSourceRef(m_Until);
bc.Emit_Debug("..end");
m_Condition.Compile(bc);
bc.Emit_Leave(m_StackFrame);
bc.Emit_Jump(OpCode.Jf, start);
bc.LoopTracker.Loops.Pop();
var exitpoint = bc.GetJumpPointForNextInstruction();
foreach (var i in L.BreakJumps)
i.NumVal = exitpoint;
bc.PopSourceRef();
}
示例3: BlockingPipeListener
BlockingPipeListener(Loop loop)
: base(loop)
{
PipeListener = new PipeListener(loop);
Listener = PipeListener as Listener;
Handle = PipeListener;
}
示例4: Dispose_should_throw_if_child_loops_not_disposed
public void Dispose_should_throw_if_child_loops_not_disposed()
{
using (var loop = new Loop(Times.Once()))
{
loop.CreateLoop(Times.Exactly(2));
}
}
示例5: PrepareWatcher
public PrepareWatcher(Loop loop, Action<PrepareWatcher, EventTypes> callback)
: base(loop)
{
this.callback = callback;
watcher_ptr = manos_prepare_watcher_create (unmanaged_callback, GCHandle.ToIntPtr (gc_handle));
}
示例6: Routine
public IEnumerator Routine(Loop loop,float loopTime)
{
if (loop.actionDictionary.Count > 0)
{
List<Action> actionList = new List<Action>();
actionList.AddRange(loop.actionDictionary.Values);
while (runningLoop)
{
foreach (Action action in actionList)
switch (action.actionType)
{
case Action.ActionTypes.Move:
Move move = (Move)action;
move.ExecuteAction(this.gameObject);
break;
default:
CodeInputHandler.abortPlay("type failed ! check your action type - 66 action.cs ");
runningLoop = false;
break;
}
yield return new WaitForSeconds(loopTime);
}
}
else
{
yield return new WaitForSeconds(loopTime);
}
}
示例7: BlockingTcpListener
BlockingTcpListener(Loop loop)
: base(loop)
{
TcpListener = new TcpListener(loop);
Listener = TcpListener as Listener;
Handle = TcpListener;
}
示例8: Dispose_should_do_nothing_if_called_multiple_times
public void Dispose_should_do_nothing_if_called_multiple_times()
{
using (var loop = new Loop(Times.Once()))
{
loop.Dispose();
loop.Dispose();
}
}
示例9: A_new_step_should_be_added_directly_if_it_contains_no_child_loops
public void A_new_step_should_be_added_directly_if_it_contains_no_child_loops()
{
using (var loop = new Loop(Times.Once()))
{
var step = loop.CreateStep("", Times.Once());
Assert.That(loop.Steps.Contains(step));
}
}
示例10: MicroThread
public MicroThread(Loop loop, Action callback)
{
Loop = loop;
State = MicroThreadState.NotStarted;
Loop.GetMicroThreadCollection().Add(this);
cb = callback;
}
示例11: FlatLoop
public FlatLoop(Loop sourceLoop, FlatFace flatFace)
{
this.sourceLoop = sourceLoop;
this.flatFace = flatFace;
fins = new List<FlatFin>();
foreach (Fin fin in sourceLoop.Fins)
fins.Add(new FlatFin(this, fin));
}
示例12: A_new_loop_should_be_added_directly_if_it_contains_no_child_loops
public void A_new_loop_should_be_added_directly_if_it_contains_no_child_loops()
{
using (var loop = new Loop(Times.Once()))
{
using (var child = loop.CreateLoop(Times.Once()))
{
Assert.That(loop.Steps.Contains(child));
}
}
}
示例13: Compute
public static void Compute(Loop loop, string file)
{
var @in = new UVFileStream(loop);
@in.Open(file, UVFileAccess.Read, (ex) => {
HashStream.ComputeString(SHA1Managed.Create(), @in, (str) => {
Console.WriteLine ("{0} {1}", str, file);
});
@in.Resume();
});
}
示例14: InvalidRange
public void InvalidRange()
{
var stringlit = new StringLiteral("foo", 0);
var range = new Range(stringlit, stringlit, 0);
var variabledecl = new VariableDeclaration("foo", "int", 0);
var variable = new VariableReference("foo", 0);
var loop = new Loop(variable, range, new List<Statement>(), 0);
statementlist.Add(variabledecl);
statementlist.Add(loop);
var parsetree = new Program(statementlist);
Assert.Throws<SemanticError>(() => symbolTableBuilder.BuildSymbolTableAndTypeCheck(parsetree));
}
示例15: visit
public void visit(Loop node)
{
if (symboltable.resolve(node.VarName).Type != "int")
throw new SemanticError("Loop variable " + node.VarName +
" on row " + node.Row + " is not an int.");
for (int i = 0; i < 2; i++)
{ // Check twice to prevent variable declarations inside the loop body
// (would cause problems because of singular scope).
foreach (Statement statement in node.LoopBody)
statement.accept(this);
}
}