本文整理汇总了C#中System.ServiceModel.Dispatcher.ProcessingContext.PeekSequence方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessingContext.PeekSequence方法的具体用法?C# ProcessingContext.PeekSequence怎么用?C# ProcessingContext.PeekSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Dispatcher.ProcessingContext
的用法示例。
在下文中一共展示了ProcessingContext.PeekSequence方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvokeInternal
internal override void InvokeInternal(ProcessingContext context, int argCount)
{
StackFrame topArg = context.TopArg;
while (topArg.basePtr <= topArg.endPtr)
{
string val = string.Empty;
NodeSequence sequence = context.PeekSequence(topArg.basePtr);
if (sequence.Count > 0)
{
NodeSequenceItem item = sequence[0];
SeekableXPathNavigator node = item.Node.Node;
long currentPosition = node.CurrentPosition;
NodeSequenceItem item2 = sequence[0];
node.CurrentPosition = item2.Node.Position;
val = ExtractFromNavigator(node);
node.CurrentPosition = currentPosition;
}
context.SetValue(context, topArg.basePtr, val);
topArg.basePtr++;
}
}
示例2: NumberSum
internal static void NumberSum(ProcessingContext context)
{
StackFrame arg = context.TopArg;
while (arg.basePtr <= arg.endPtr)
{
NodeSequence sequence = context.PeekSequence(arg.basePtr);
double sum = 0.0;
for (int item = 0; item < sequence.Count; ++item)
{
sum += QueryValueModel.Double(sequence[item].StringValue());
}
context.SetValue(context, arg.basePtr, sum);
arg.basePtr++;
}
}
示例3: Eval
internal override Opcode Eval(ProcessingContext context)
{
XPathNavigator nav = context.Processor.ContextNode;
if (nav != null && context.Processor.ContextMessage != null)
{
((SeekableMessageNavigator)nav).Atomize();
}
if (this.argCount == 0)
{
context.PushFrame();
int count = context.IterationCount;
if (count > 0)
{
object ret = this.function.Invoke(this.xsltContext, NullArgs, nav);
switch (this.function.ReturnType)
{
case XPathResultType.String:
context.Push((string)ret, count);
break;
case XPathResultType.Number:
context.Push((double)ret, count);
break;
case XPathResultType.Boolean:
context.Push((bool)ret, count);
break;
case XPathResultType.NodeSet:
NodeSequence seq = context.CreateSequence();
XPathNodeIterator iter = (XPathNodeIterator)ret;
seq.Add(iter);
context.Push(seq, count);
break;
default:
// This should never be reached
throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.Unexpected, SR.GetString(SR.QueryFunctionTypeNotSupported, this.function.ReturnType.ToString())));
}
}
}
else
{
// PERF, [....], see if we can cache these arrays to avoid allocations
object[] xsltArgs = new object[this.argCount];
int iterationCount = context.TopArg.Count;
for (int iteration = 0; iteration < iterationCount; ++iteration)
{
for (int i = 0; i < this.argCount; ++i)
{
StackFrame arg = context[i];
Fx.Assert(iteration < arg.Count, "");
switch (this.function.ArgTypes[i])
{
case XPathResultType.String:
xsltArgs[i] = context.PeekString(arg[iteration]);
break;
case XPathResultType.Number:
xsltArgs[i] = context.PeekDouble(arg[iteration]);
break;
case XPathResultType.Boolean:
xsltArgs[i] = context.PeekBoolean(arg[iteration]);
break;
case XPathResultType.NodeSet:
NodeSequenceIterator iter = new NodeSequenceIterator(context.PeekSequence(arg[iteration]));
xsltArgs[i] = iter;
this.iterList.Add(iter);
break;
default:
// This should never be reached
throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.Unexpected, SR.GetString(SR.QueryFunctionTypeNotSupported, this.function.ArgTypes[i].ToString())));
}
}
object ret = this.function.Invoke(this.xsltContext, xsltArgs, nav);
if (this.iterList != null)
{
for (int i = 0; i < this.iterList.Count; ++i)
{
this.iterList[i].Clear();
}
this.iterList.Clear();
}
switch (this.function.ReturnType)
{
case XPathResultType.String:
context.SetValue(context, context[this.argCount - 1][iteration], (string)ret);
break;
case XPathResultType.Number:
context.SetValue(context, context[this.argCount - 1][iteration], (double)ret);
break;
//.........这里部分代码省略.........
示例4: NodesetNamespaceUri
internal static void NodesetNamespaceUri(ProcessingContext context)
{
StackFrame arg = context.TopArg;
while (arg.basePtr <= arg.endPtr)
{
NodeSequence sequence = context.PeekSequence(arg.basePtr);
context.SetValue(context, arg.basePtr, sequence.Namespace);
arg.basePtr++;
}
}
示例5: NodesetCount
internal static void NodesetCount(ProcessingContext context)
{
StackFrame arg = context.TopArg;
while (arg.basePtr <= arg.endPtr)
{
context.SetValue(context, arg.basePtr, context.PeekSequence(arg.basePtr).Count);
arg.basePtr++;
}
}
示例6: InvokeInternal
internal override void InvokeInternal(ProcessingContext context, int argCount)
{
StackFrame seqArg = context.TopArg;
while (seqArg.basePtr <= seqArg.endPtr)
{
string actor = string.Empty;
NodeSequence seq = context.PeekSequence(seqArg.basePtr);
if (seq.Count > 0)
{
SeekableXPathNavigator nav = seq[0].Node.Node;
long p = nav.CurrentPosition;
nav.CurrentPosition = seq[0].Node.Position;
actor = ExtractFromNavigator(nav);
nav.CurrentPosition = p;
}
context.SetValue(context, seqArg.basePtr, actor);
seqArg.basePtr++;
}
}
示例7: NumberSum
internal static void NumberSum(ProcessingContext context)
{
StackFrame topArg = context.TopArg;
while (topArg.basePtr <= topArg.endPtr)
{
NodeSequence sequence = context.PeekSequence(topArg.basePtr);
double val = 0.0;
for (int i = 0; i < sequence.Count; i++)
{
NodeSequenceItem item = sequence[i];
val += QueryValueModel.Double(item.StringValue());
}
context.SetValue(context, topArg.basePtr, val);
topArg.basePtr++;
}
}
示例8: NodesetName
internal static void NodesetName(ProcessingContext context)
{
StackFrame topArg = context.TopArg;
while (topArg.basePtr <= topArg.endPtr)
{
NodeSequence sequence = context.PeekSequence(topArg.basePtr);
context.SetValue(context, topArg.basePtr, sequence.Name);
topArg.basePtr++;
}
}
示例9: NodesetCount
internal static void NodesetCount(ProcessingContext context)
{
StackFrame topArg = context.TopArg;
while (topArg.basePtr <= topArg.endPtr)
{
context.SetValue(context, topArg.basePtr, (double) context.PeekSequence(topArg.basePtr).Count);
topArg.basePtr++;
}
}
示例10: Eval
internal override Opcode Eval(ProcessingContext context)
{
XPathNavigator contextNode = context.Processor.ContextNode;
if ((contextNode != null) && (context.Processor.ContextMessage != null))
{
((SeekableMessageNavigator) contextNode).Atomize();
}
if (this.argCount == 0)
{
context.PushFrame();
int iterationCount = context.IterationCount;
if (iterationCount > 0)
{
object obj2 = this.function.Invoke(this.xsltContext, NullArgs, contextNode);
switch (this.function.ReturnType)
{
case XPathResultType.Number:
context.Push((double) obj2, iterationCount);
goto Label_03F6;
case XPathResultType.String:
context.Push((string) obj2, iterationCount);
goto Label_03F6;
case XPathResultType.Boolean:
context.Push((bool) obj2, iterationCount);
goto Label_03F6;
case XPathResultType.NodeSet:
{
NodeSequence sequence = context.CreateSequence();
XPathNodeIterator iter = (XPathNodeIterator) obj2;
sequence.Add(iter);
context.Push(sequence, iterationCount);
goto Label_03F6;
}
}
throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.Unexpected, System.ServiceModel.SR.GetString("QueryFunctionTypeNotSupported", new object[] { this.function.ReturnType.ToString() })));
}
}
else
{
object[] args = new object[this.argCount];
int count = context.TopArg.Count;
for (int i = 0; i < count; i++)
{
for (int k = 0; k < this.argCount; k++)
{
StackFrame frame = context[k];
switch (this.function.ArgTypes[k])
{
case XPathResultType.Number:
args[k] = context.PeekDouble(frame[i]);
break;
case XPathResultType.String:
args[k] = context.PeekString(frame[i]);
break;
case XPathResultType.Boolean:
args[k] = context.PeekBoolean(frame[i]);
break;
case XPathResultType.NodeSet:
{
NodeSequenceIterator item = new NodeSequenceIterator(context.PeekSequence(frame[i]));
args[k] = item;
this.iterList.Add(item);
break;
}
default:
throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.Unexpected, System.ServiceModel.SR.GetString("QueryFunctionTypeNotSupported", new object[] { this.function.ArgTypes[k].ToString() })));
}
}
object obj3 = this.function.Invoke(this.xsltContext, args, contextNode);
if (this.iterList != null)
{
for (int m = 0; m < this.iterList.Count; m++)
{
this.iterList[m].Clear();
}
this.iterList.Clear();
}
switch (this.function.ReturnType)
{
case XPathResultType.Number:
{
StackFrame frame4 = context[this.argCount - 1];
context.SetValue(context, frame4[i], (double) obj3);
break;
}
case XPathResultType.String:
{
StackFrame frame3 = context[this.argCount - 1];
context.SetValue(context, frame3[i], (string) obj3);
break;
}
case XPathResultType.Boolean:
{
StackFrame frame5 = context[this.argCount - 1];
//.........这里部分代码省略.........