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


C# TextChange.Normalize方法代码示例

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


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

示例1: WriteDebugTree

        internal static void WriteDebugTree(string sourceFile, Block document, PartialParseResult result, TextChange change, RazorEditorParser parser, bool treeStructureChanged) {
            if (!OutputDebuggingEnabled) {
                return;
            }

            RunTask(() => {
                string outputFileName = Normalize(sourceFile) + "_tree";
                string outputPath = Path.Combine(Path.GetDirectoryName(sourceFile), outputFileName);

                var treeBuilder = new StringBuilder();
                WriteTree(document, treeBuilder);
                treeBuilder.AppendLine();
                treeBuilder.AppendFormat(CultureInfo.CurrentCulture, "Last Change: {0}", change);
                treeBuilder.AppendLine();
                treeBuilder.AppendFormat(CultureInfo.CurrentCulture, "Normalized To: {0}", change.Normalize());
                treeBuilder.AppendLine();
                treeBuilder.AppendFormat(CultureInfo.CurrentCulture, "Partial Parse Result: {0}", result);
                treeBuilder.AppendLine();
                if (result.HasFlag(PartialParseResult.Rejected)) {
                    treeBuilder.AppendFormat(CultureInfo.CurrentCulture, "Tree Structure Changed: {0}", treeStructureChanged);
                    treeBuilder.AppendLine();
                }
                if (result.HasFlag(PartialParseResult.AutoCompleteBlock)) {
                    treeBuilder.AppendFormat(CultureInfo.CurrentCulture, "Auto Complete Insert String: \"{0}\"", parser.GetAutoCompleteString());
                    treeBuilder.AppendLine();
                }
                File.WriteAllText(outputPath, treeBuilder.ToString());
            });

        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:30,代码来源:RazorDebugHelpers.cs

示例2: ApplyChange

        public virtual EditResult ApplyChange(Span target, TextChange change, bool force)
        {
            PartialParseResult result = PartialParseResult.Accepted;
            TextChange normalized = change.Normalize();
            if (!force)
            {
                result = CanAcceptChange(target, normalized);
            }

            // If the change is accepted then apply the change
            if (result.HasFlag(PartialParseResult.Accepted))
            {
                return new EditResult(result, UpdateSpan(target, normalized));
            }
            return new EditResult(result, new SpanBuilder(target));
        }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:16,代码来源:SpanEditHandler.cs

示例3: NormalizeDoesntAffectShrinkingReplacements

        public void NormalizeDoesntAffectShrinkingReplacements()
        {
            // Arrange
            var newBuffer = new StringTextBuffer("D");
            var oldBuffer = new StringTextBuffer("DateTime");
            var original = new TextChange(0, 8, oldBuffer, 1, newBuffer);

            // Act
            TextChange normalized = original.Normalize();

            // Assert
            Assert.Equal(original, normalized);
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:13,代码来源:TextChangeTest.cs

示例4: NormalizeDoesntAffectChangesWithoutCommonPrefixes

        public void NormalizeDoesntAffectChangesWithoutCommonPrefixes()
        {
            // Arrange
            var newBuffer = new StringTextBuffer("DateTime.");
            var oldBuffer = new StringTextBuffer("Date.");
            var original = new TextChange(0, 5, oldBuffer, 9, newBuffer);

            // Act
            TextChange normalized = original.Normalize();

            // Assert
            Assert.Equal(original, normalized);
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:13,代码来源:TextChangeTest.cs

示例5: NormalizeFixesUpIntelliSenseStyleReplacements

        public void NormalizeFixesUpIntelliSenseStyleReplacements()
        {
            // Arrange
            var newBuffer = new StringTextBuffer("Date.");
            var oldBuffer = new StringTextBuffer("Date");
            var original = new TextChange(0, 4, oldBuffer, 5, newBuffer);

            // Act
            TextChange normalized = original.Normalize();

            // Assert
            Assert.Equal(new TextChange(4, 0, oldBuffer, 1, newBuffer), normalized);
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:13,代码来源:TextChangeTest.cs

示例6: ApplyChange

        /// <summary>
        /// Applies the specified change to this span, optionally forcing it to accept it
        /// </summary>
        /// <param name="force">If true, no evaluation is performed, the content of the span is simply updated based on the change</param>
        /// <remarks>
        /// If this method returns a value with the PartialParseResults.Accepted flag, the change has been applied to the span.
        /// If force was specified, this does not indicate that the partial parsing was successful, only that the Span now reflects the applied change.
        /// </remarks>
        /// <returns>true if the change was successfully applied, false if it wasn't</returns>
        public PartialParseResult ApplyChange(TextChange change, bool force) {
            PartialParseResult result = PartialParseResult.Accepted;
            TextChange normalized = change.Normalize();
            if (!force) {
                result = CanAcceptChange(normalized);
            }
            
            // If the change is accepted then apply the change
            if (result.HasFlag(PartialParseResult.Accepted)) {
                UpdateContent(normalized);
            }

            return result;
        }
开发者ID:jesshaw,项目名称:ASP.NET-Mvc-3,代码行数:23,代码来源:Span.cs


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