本文整理汇总了C#中MessageReader.StepOver方法的典型用法代码示例。如果您正苦于以下问题:C# MessageReader.StepOver方法的具体用法?C# MessageReader.StepOver怎么用?C# MessageReader.StepOver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageReader
的用法示例。
在下文中一共展示了MessageReader.StepOver方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
public static void Test (HashSet<ArgMatchTest> a, Message msg)
{
List<Signature> sigs = new List<Signature> ();
sigs.AddRange (msg.Signature.GetParts ());
if (sigs.Count == 0) {
a.Clear ();
return;
}
a.RemoveWhere ( delegate (ArgMatchTest t) { return t.ArgNum >= sigs.Count || t.Signature != sigs[t.ArgNum]; } );
// Sorting the list here is not ideal
List<ArgMatchTest> tests = new List<ArgMatchTest> (a);
tests.Sort ( delegate (ArgMatchTest aa, ArgMatchTest bb) { return aa.ArgNum - bb.ArgNum; } );
if (tests.Count == 0) {
a.Clear ();
return;
}
MessageReader reader = new MessageReader (msg);
int argNum = 0;
foreach (ArgMatchTest test in tests) {
if (argNum > test.ArgNum) {
// This test cannot pass because a previous test already did.
// So we already know it will fail without even trying.
// This logic will need to be changed to support wildcards.
a.Remove (test);
continue;
}
while (argNum != test.ArgNum) {
Signature sig = sigs[argNum];
if (!reader.StepOver (sig))
throw new Exception ();
argNum++;
}
// TODO: Avoid re-reading values
if (!reader.PeekValue (test.Signature[0]).Equals (test.Value)) {
a.Remove (test);
continue;
}
argNum++;
}
}