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


C# ProcessingContext.PeekString方法代码示例

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


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

示例1: BooleanLang

 internal static void BooleanLang(ProcessingContext context)
 {
     StackFrame topArg = context.TopArg;
     StackFrame topSequenceArg = context.TopSequenceArg;
     Value[] sequences = context.Sequences;
     while (topSequenceArg.basePtr <= topSequenceArg.endPtr)
     {
         NodeSequence sequence = sequences[topSequenceArg.basePtr++].Sequence;
         for (int i = 0; i < sequence.Count; i++)
         {
             string strA = context.PeekString(topArg.basePtr).ToUpperInvariant();
             QueryNode node = sequence.Items[i].Node;
             long currentPosition = node.Node.CurrentPosition;
             node.Node.CurrentPosition = node.Position;
             string strB = node.Node.XmlLang.ToUpperInvariant();
             node.Node.CurrentPosition = currentPosition;
             if ((strA.Length == strB.Length) && (string.CompareOrdinal(strA, strB) == 0))
             {
                 context.SetValue(context, topArg.basePtr++, true);
             }
             else if (((strB.Length > 0) && (strA.Length < strB.Length)) && (strB.StartsWith(strA, StringComparison.Ordinal) && (strB[strA.Length] == '-')))
             {
                 context.SetValue(context, topArg.basePtr++, true);
             }
             else
             {
                 context.SetValue(context, topArg.basePtr++, false);
             }
         }
         topSequenceArg.basePtr++;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:XPathFunction.cs

示例2: Eval

 internal override void Eval(ProcessingContext context)
 {
     StackFrame[] frameArray = new StackFrame[this.argCount];
     for (int i = 0; i < this.argCount; i++)
     {
         frameArray[i] = context[i];
     }
     StringBuilder builder = new StringBuilder();
     while (frameArray[0].basePtr <= frameArray[0].endPtr)
     {
         builder.Length = 0;
         for (int k = 0; k < this.argCount; k++)
         {
             builder.Append(context.PeekString(frameArray[k].basePtr));
         }
         context.SetValue(context, frameArray[this.argCount - 1].basePtr, builder.ToString());
         for (int m = 0; m < this.argCount; m++)
         {
             frameArray[m].basePtr++;
         }
     }
     for (int j = 0; j < (this.argCount - 1); j++)
     {
         context.PopFrame();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:ConcatFunction.cs

示例3: InvokeInternal

 internal override void InvokeInternal(ProcessingContext context, int argCount)
 {
     StackFrame topArg = context.TopArg;
     SeekableXPathNavigator contextNode = context.Processor.ContextNode;
     long currentPosition = contextNode.CurrentPosition;
     while (topArg.basePtr <= topArg.endPtr)
     {
         string str = context.PeekString(topArg.basePtr);
         NodeSequence val = context.CreateSequence();
         if (XPathMessageFunction.MoveToHeader(contextNode) && contextNode.MoveToFirstChild())
         {
             do
             {
                 long num2 = contextNode.CurrentPosition;
                 string str2 = XPathMessageFunctionActor.ExtractFromNavigator(contextNode);
                 contextNode.CurrentPosition = num2;
                 if (str2 == str)
                 {
                     val.Add(contextNode);
                 }
             }
             while (contextNode.MoveToNext());
         }
         context.SetValue(context, topArg.basePtr, val);
         topArg.basePtr++;
     }
     contextNode.CurrentPosition = currentPosition;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:XPathMessageFunctionHeadersWithActor.cs

示例4: InvokeInternal

 internal override void InvokeInternal(ProcessingContext context, int argCount)
 {
     StackFrame topArg = context.TopArg;
     while (topArg.basePtr <= topArg.endPtr)
     {
         string dateStr = context.PeekString(topArg.basePtr);
         context.SetValue(context, topArg.basePtr, Convert(dateStr));
         topArg.basePtr++;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:XPathMessageFunctionDateStr.cs

示例5: InvokeInternal

 internal override void InvokeInternal(ProcessingContext context, int argCount)
 {
     StackFrame topArg = context.TopArg;
     Message contextMessage = context.Processor.ContextMessage;
     CorrelationDataMessageProperty property = null;
     CorrelationDataMessageProperty.TryGet(contextMessage, out property);
     while (topArg.basePtr <= topArg.endPtr)
     {
         string str;
         if ((property == null) || !property.TryGetValue(context.PeekString(topArg.basePtr), out str))
         {
             str = string.Empty;
         }
         context.SetValue(context, topArg.basePtr, str);
         topArg.basePtr++;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:XPathMessageFunctionCorrelationData.cs

示例6: SubstringAfter

        internal static void SubstringAfter(ProcessingContext context)
        {
            StackFrame arg1 = context.TopArg;
            StackFrame arg2 = context.SecondArg;

            Fx.Assert(arg1.Count == arg2.Count, "");
            while (arg1.basePtr <= arg1.endPtr)
            {
                string str1 = context.PeekString(arg1.basePtr);
                string str2 = context.PeekString(arg2.basePtr);
                int idx = str1.IndexOf(str2, StringComparison.Ordinal);
                context.SetValue(context, arg2.basePtr, idx == -1 ? string.Empty : str1.Substring(idx + str2.Length));
                arg1.basePtr++;
                arg2.basePtr++;
            }
            context.PopFrame();
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:17,代码来源:QueryFunctions.cs

示例7: StringStartsWith

        internal static void StringStartsWith(ProcessingContext context)
        {
            StackFrame arg1 = context.TopArg;
            StackFrame arg2 = context.SecondArg;

            Fx.Assert(arg1.Count == arg2.Count, "");
            while (arg1.basePtr <= arg1.endPtr)
            {
                string leftString = context.PeekString(arg1.basePtr);
                string rightString = context.PeekString(arg2.basePtr);
                context.SetValue(context, arg2.basePtr, leftString.StartsWith(rightString, StringComparison.Ordinal));
                arg1.basePtr++;
                arg2.basePtr++;
            }
            context.PopFrame();
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:16,代码来源:QueryFunctions.cs

示例8: StringLength

 internal static void StringLength(ProcessingContext context)
 {
     StackFrame arg = context.TopArg;
     while (arg.basePtr <= arg.endPtr)
     {
         context.SetValue(context, arg.basePtr, context.PeekString(arg.basePtr).Length);
         arg.basePtr++;
     }
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:9,代码来源:QueryFunctions.cs

示例9: StringLength

 internal static void StringLength(ProcessingContext context)
 {
     StackFrame topArg = context.TopArg;
     while (topArg.basePtr <= topArg.endPtr)
     {
         context.SetValue(context, topArg.basePtr, (double) context.PeekString(topArg.basePtr).Length);
         topArg.basePtr++;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:XPathFunction.cs

示例10: 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;
//.........这里部分代码省略.........
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:101,代码来源:QueryFunctions.cs

示例11: Translate

        internal static void Translate(ProcessingContext context)
        {
            StackFrame argSource = context.TopArg;
            StackFrame argKeys = context.SecondArg;
            StackFrame argValues = context[2];

            // PERF, [....], this is really slow.
            StringBuilder builder = new StringBuilder();
            while (argSource.basePtr <= argSource.endPtr)
            {
                builder.Length = 0;

                string source = context.PeekString(argSource.basePtr);
                string keys = context.PeekString(argKeys.basePtr);
                string values = context.PeekString(argValues.basePtr);
                for (int i = 0; i < source.Length; ++i)
                {
                    char c = source[i];
                    int idx = keys.IndexOf(c);
                    if (idx < 0)
                    {
                        builder.Append(c);
                    }
                    else if (idx < values.Length)
                    {
                        builder.Append(values[idx]);
                    }
                }
                context.SetValue(context, argValues.basePtr, builder.ToString());
                argSource.basePtr++;
                argKeys.basePtr++;
                argValues.basePtr++;
            }

            context.PopFrame();
            context.PopFrame();
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:37,代码来源:QueryFunctions.cs

示例12: InvokeInternal

        internal override void InvokeInternal(ProcessingContext context, int argCount)
        {
            StackFrame nameArg = context.TopArg;
            Message message = context.Processor.ContextMessage;
            CorrelationDataMessageProperty data = null;

            CorrelationDataMessageProperty.TryGet(message, out data);

            while (nameArg.basePtr <= nameArg.endPtr)
            {
                string value;

                if (data == null || !data.TryGetValue(context.PeekString(nameArg.basePtr), out value))
                {
                    value = string.Empty;
                }

                context.SetValue(context, nameArg.basePtr, value);
                nameArg.basePtr++;
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:21,代码来源:XPathMessageContext.cs

示例13: Translate

 internal static void Translate(ProcessingContext context)
 {
     StackFrame topArg = context.TopArg;
     StackFrame secondArg = context.SecondArg;
     StackFrame frame3 = context[2];
     StringBuilder builder = new StringBuilder();
     while (topArg.basePtr <= topArg.endPtr)
     {
         builder.Length = 0;
         string str = context.PeekString(topArg.basePtr);
         string str2 = context.PeekString(secondArg.basePtr);
         string str3 = context.PeekString(frame3.basePtr);
         for (int i = 0; i < str.Length; i++)
         {
             char ch = str[i];
             int index = str2.IndexOf(ch);
             if (index < 0)
             {
                 builder.Append(ch);
             }
             else if (index < str3.Length)
             {
                 builder.Append(str3[index]);
             }
         }
         context.SetValue(context, frame3.basePtr, builder.ToString());
         topArg.basePtr++;
         secondArg.basePtr++;
         frame3.basePtr++;
     }
     context.PopFrame();
     context.PopFrame();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:XPathFunction.cs

示例14: SubstringLimit

 internal static void SubstringLimit(ProcessingContext context)
 {
     StackFrame topArg = context.TopArg;
     StackFrame secondArg = context.SecondArg;
     StackFrame frame3 = context[2];
     while (topArg.basePtr <= topArg.endPtr)
     {
         string str2;
         string str = context.PeekString(topArg.basePtr);
         int startIndex = ((int) Math.Round(context.PeekDouble(secondArg.basePtr))) - 1;
         if (startIndex < 0)
         {
             startIndex = 0;
         }
         int length = (int) Math.Round(context.PeekDouble(frame3.basePtr));
         if ((length < 1) || ((startIndex + length) >= str.Length))
         {
             str2 = string.Empty;
         }
         else
         {
             str2 = str.Substring(startIndex, length);
         }
         context.SetValue(context, frame3.basePtr, str2);
         secondArg.basePtr++;
         topArg.basePtr++;
         frame3.basePtr++;
     }
     context.PopFrame();
     context.PopFrame();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:XPathFunction.cs

示例15: SubstringBefore

 internal static void SubstringBefore(ProcessingContext context)
 {
     StackFrame topArg = context.TopArg;
     StackFrame secondArg = context.SecondArg;
     while (topArg.basePtr <= topArg.endPtr)
     {
         string str = context.PeekString(topArg.basePtr);
         string str2 = context.PeekString(secondArg.basePtr);
         int index = str.IndexOf(str2, StringComparison.Ordinal);
         context.SetValue(context, secondArg.basePtr, (index == -1) ? string.Empty : str.Substring(0, index));
         topArg.basePtr++;
         secondArg.basePtr++;
     }
     context.PopFrame();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:XPathFunction.cs


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