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


C# ITextOutput类代码示例

本文整理汇总了C#中ITextOutput的典型用法代码示例。如果您正苦于以下问题:C# ITextOutput类的具体用法?C# ITextOutput怎么用?C# ITextOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: WriteTo

		public static void WriteTo(this ExceptionHandler exceptionHandler, ITextOutput writer, MethodDef method)
		{
			writer.Write("Try", TextTokenType.Keyword);
			writer.WriteSpace();
			WriteOffsetReference(writer, exceptionHandler.TryStart, method);
			writer.Write('-', TextTokenType.Operator);
			WriteOffsetReference(writer, exceptionHandler.TryEnd, method);
			writer.WriteSpace();
			writer.Write(exceptionHandler.HandlerType.ToString(), TextTokenType.Keyword);
			if (exceptionHandler.FilterStart != null) {
				writer.WriteSpace();
				WriteOffsetReference(writer, exceptionHandler.FilterStart, method);
				writer.WriteSpace();
				writer.Write("handler", TextTokenType.Keyword);
				writer.WriteSpace();
			}
			if (exceptionHandler.CatchType != null) {
				writer.WriteSpace();
				exceptionHandler.CatchType.WriteTo(writer);
			}
			writer.WriteSpace();
			WriteOffsetReference(writer, exceptionHandler.HandlerStart, method);
			writer.Write('-', TextTokenType.Operator);
			WriteOffsetReference(writer, exceptionHandler.HandlerEnd, method);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:25,代码来源:DisassemblerHelpers.cs

示例2: Write

 protected override void Write(ITextOutput output, Language language)
 {
     if (name != null)
         output.Write(name, TextTokenType.Keyword);
     else
         base.Write(output, language);
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:7,代码来源:AnalyzedEventAccessorTreeNode.cs

示例3: AcceptWriter

        public override void AcceptWriter(ITextOutput writer)
        {
            List<string> keyList = new List<string>(Values.Keys);
            int keyCount = keyList.Count;

            JsonValue jsonValue;
            bool isFirst = true;
            for (int i = 0; i < keyCount; i++)
            {
                if (isFirst)
                {
                    writer.Write('{');
                    isFirst = false;
                }
                else
                {
                    writer.Write(", ");
                }
                writer.Write('"');
                writer.Write(keyList[i]);
                writer.Write('"');
                writer.Write(':');
                if (Values.TryGetValue(keyList[i], out jsonValue))
                {
                    jsonValue.AcceptWriter(writer);
                }
            }
            if (!isFirst)
                writer.Write('}');
        }
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:30,代码来源:MyJson.cs

示例4: DecompileMethod

		public override void DecompileMethod(MethodDefinition method, ITextOutput output, DecompilationOptions options)
		{
			WriteCommentLine(output, TypeToString(method.DeclaringType, includeNamespace: true));
			AstBuilder codeDomBuilder = CreateAstBuilder(options, method.DeclaringType);
			codeDomBuilder.AddMethod(method);
			codeDomBuilder.GenerateCode(output, transformAbortCondition);
		}
开发者ID:tanujmathur,项目名称:ILSpy,代码行数:7,代码来源:CSharpLanguage.cs

示例5: DecompileAssembly

        public override void DecompileAssembly(AssemblyDefinition assembly, string fileName, ITextOutput output, DecompilationOptions options)
        {
            output.WriteLine("// " + fileName);
            output.WriteLine();

            new ReflectionDisassembler(output, detectControlStructure, options.CancellationToken).WriteAssemblyHeader(assembly);
        }
开发者ID:richardschneider,项目名称:ILSpy,代码行数:7,代码来源:ILLanguage.cs

示例6: WriteTo

		public static void WriteTo(this Instruction instruction, ITextOutput writer, Func<OpCode, string> getOpCodeDocumentation)
		{
			writer.WriteDefinition(DnlibExtensions.OffsetToString(instruction.GetOffset()), instruction, TextTokenType.Label, false);
			writer.Write(':', TextTokenType.Operator);
			writer.WriteSpace();
			writer.WriteReference(instruction.OpCode.Name, instruction.OpCode, TextTokenType.OpCode);
			if (instruction.Operand != null) {
				writer.WriteSpace();
				if (instruction.OpCode == OpCodes.Ldtoken) {
					var member = instruction.Operand as IMemberRef;
					if (member != null && member.IsMethod) {
						writer.Write("method", TextTokenType.Keyword);
						writer.WriteSpace();
					}
					else if (member != null && member.IsField) {
						writer.Write("field", TextTokenType.Keyword);
						writer.WriteSpace();
					}
				}
				WriteOperand(writer, instruction.Operand);
			}
			if (getOpCodeDocumentation != null) {
				var doc = getOpCodeDocumentation(instruction.OpCode);
				if (doc != null) {
					writer.Write("\t", TextTokenType.Text);
					writer.Write("// " + doc, TextTokenType.Comment);
				}
			}
		}
开发者ID:lisong521,项目名称:dnSpy,代码行数:29,代码来源:DisassemblerHelpers.cs

示例7: CppTextOutputFormatter

 public CppTextOutputFormatter(ITextOutput output)
 {
     if (output == null)
         throw new ArgumentNullException("output");
     this.output = output;
     this.IndentationString = "\t";
 }
开发者ID:KAW0,项目名称:Alter-Native,代码行数:7,代码来源:CppTextOutputFormatter.cs

示例8: Write

		public static ITextOutput Write(ITextOutput output, MethodDef method, Language language) {
			output.Write(UIUtils.CleanUpIdentifier(method.Name), TextTokenHelper.GetTextTokenType(method));
			output.Write('(', TextTokenType.Operator);
			for (int i = 0; i < method.Parameters.Count; i++) {
				if (method.Parameters[i].IsHiddenThisParameter)
					continue;
				if (method.Parameters[i].MethodSigIndex > 0) {
					output.Write(',', TextTokenType.Operator);
					output.WriteSpace();
				}
				language.TypeToString(output, method.Parameters[i].Type.ToTypeDefOrRef(), false, method.Parameters[i].ParamDef);
			}
			if (method.CallingConvention == CallingConvention.VarArg || method.CallingConvention == CallingConvention.NativeVarArg) {
				if (method.MethodSig.GetParamCount() > 0) {
					output.Write(',', TextTokenType.Operator);
					output.WriteSpace();
				}
				output.Write("...", TextTokenType.Operator);
			}
			output.Write(')', TextTokenType.Operator);
			output.WriteSpace();
			output.Write(':', TextTokenType.Operator);
			output.WriteSpace();
			language.TypeToString(output, method.ReturnType.ToTypeDefOrRef(), false, method.Parameters.ReturnParameter.ParamDef);
			method.MDToken.WriteSuffixString(output);
			return output;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:27,代码来源:MethodTreeNode.cs

示例9: DecompileMethod

		public override void DecompileMethod(MethodDefinition method, ITextOutput output, DecompilationOptions options)
		{
			if (!method.HasBody) {
				return;
			}
			
			ILAstBuilder astBuilder = new ILAstBuilder();
			ILBlock ilMethod = new ILBlock();
			ilMethod.Body = astBuilder.Build(method, inlineVariables);
			
			if (abortBeforeStep != null) {
				DecompilerContext context = new DecompilerContext(method.Module) { CurrentType = method.DeclaringType, CurrentMethod = method };
				new ILAstOptimizer().Optimize(context, ilMethod, abortBeforeStep.Value);
			}
			
			var allVariables = ilMethod.GetSelfAndChildrenRecursive<ILExpression>().Select(e => e.Operand as ILVariable)
				.Where(v => v != null && !v.IsParameter).Distinct();
			foreach (ILVariable v in allVariables) {
				output.WriteDefinition(v.Name, v);
				if (v.Type != null) {
					output.Write(" : ");
					if (v.IsPinned)
						output.Write("pinned ");
					v.Type.WriteTo(output, ILNameSyntax.ShortTypeName);
				}
				output.WriteLine();
			}
			output.WriteLine();
			
			foreach (ILNode node in ilMethod.Body) {
				node.WriteTo(output);
				output.WriteLine();
			}
		}
开发者ID:rmattuschka,项目名称:ILSpy,代码行数:34,代码来源:ILAstLanguage.cs

示例10: VBTextOutputFormatter

 public VBTextOutputFormatter(ITextOutput output, VBFormattingOptions formattingPolicy)
 {
     if (output == null)
         throw new ArgumentNullException("output");
     this.output = output;
     this.policy = formattingPolicy;
 }
开发者ID:pmeaster,项目名称:ILSpy,代码行数:7,代码来源:VBTextOutputFormatter.cs

示例11: Decompile

		public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
		{
			App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureChildrenFiltered));
			foreach (ILSpyTreeNode child in this.Children) {
				child.Decompile(language, output, options);
			}
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:7,代码来源:BaseTypesTreeNode.cs

示例12: Decompile

 public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
 {
     EnsureChildrenFiltered();
     base.Decompile(language, output, options);
     if (stringTableEntries.Count != 0) {
         ISmartTextOutput smartOutput = output as ISmartTextOutput;
         if (null != smartOutput) {
             smartOutput.AddUIElement(
                 delegate {
                     var textView = options.DecompilerTextView;
                     if (textView != null)
                         return new ResourceStringTable(stringTableEntries, textView) { Cursor = Cursors.Arrow };
                     return new TextBlock { Text = "no active tab!" };
                 }
             );
         }
         output.WriteLine();
         output.WriteLine();
     }
     if (otherEntries.Count != 0) {
         ISmartTextOutput smartOutput = output as ISmartTextOutput;
         if (null != smartOutput) {
             smartOutput.AddUIElement(
                 delegate {
                     var textView = options.DecompilerTextView;
                     if (textView != null)
                         return new ResourceObjectTable(otherEntries, textView) { Cursor = Cursors.Arrow };
                     return new TextBlock { Text = "no active tab!" };
                 }
             );
         }
         output.WriteLine();
     }
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:34,代码来源:ResourcesFileTreeNode.cs

示例13: DecompileMethod

		public override void DecompileMethod(MethodDefinition method, ITextOutput output, DecompilationOptions options)
		{
			WriteCommentLine(output, TypeToString(method.DeclaringType, includeNamespace: true));
			AstBuilder codeDomBuilder = CreateAstBuilder(options, currentType: method.DeclaringType, isSingleMember: true);
			codeDomBuilder.AddMethod(method);
			RunTransformsAndGenerateCode(codeDomBuilder, output, options, method.Module);
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:7,代码来源:VBLanguage.cs

示例14: DecompileMethod

        public override void DecompileMethod(ilspy::Mono.Cecil.MethodDefinition method, ITextOutput output, DecompilationOptions options)
        {
            var xMethod = GetXMethodDefinition(method);
            var ilMethod = xMethod as XBuilder.ILMethodDefinition;

            CompiledMethod cmethod;

            if (ilMethod == null || !ilMethod.OriginalMethod.HasBody)
            {
                output.Write("");
                output.WriteLine("// not an il method or method without body.");
                return;
            }
            
            var methodSource = new MethodSource(xMethod, ilMethod.OriginalMethod);
            var target = (DexTargetPackage) AssemblyCompiler.TargetPackage;
            var dMethod = (MethodDefinition)xMethod.GetReference(target);
            DexMethodBodyCompiler.TranslateToRL(AssemblyCompiler, target, methodSource, dMethod, GenerateSetNextInstructionCode, out cmethod);

            var rlBody = cmethod.RLBody;

            // Optimize RL code
            string lastApplied = RLTransformations.Transform(target.DexFile, rlBody, StopOptimizationAfter == -1?int.MaxValue:StopOptimizationAfter);
            if(lastApplied != null)
                output.WriteLine("// Stop after " + lastApplied);

            PrintMethod(cmethod, output, options);
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:28,代码来源:RLLanguage.cs

示例15: Decompile

 public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
 {
     EnsureLazyChildren();
     base.Decompile(language, output, options);
     if (stringTableEntries.Count != 0) {
         ISmartTextOutput smartOutput = output as ISmartTextOutput;
         if (null != smartOutput) {
             smartOutput.AddUIElement(
                 delegate {
                     return new ResourceStringTable(stringTableEntries,
                         new System.Windows.Size(MainWindow.Instance.mainPane.ActualWidth - 45,
                                                 MainWindow.Instance.mainPane.ActualHeight));
                 }
             );
         }
         output.WriteLine();
         output.WriteLine();
     }
     if (otherEntries.Count != 0) {
         ISmartTextOutput smartOutput = output as ISmartTextOutput;
         if (null != smartOutput) {
             smartOutput.AddUIElement(
                 delegate {
                     return new ResourceObjectTable(otherEntries,
                         new System.Windows.Size(MainWindow.Instance.mainPane.ActualWidth - 45,
                                                 MainWindow.Instance.mainPane.ActualHeight));
                 }
             );
         }
         output.WriteLine();
     }
 }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:32,代码来源:ResourcesFileTreeNode.cs


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