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


C# ITextOutput.Write方法代码示例

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


在下文中一共展示了ITextOutput.Write方法的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: WriteILOffset

		static void WriteILOffset(ITextOutput output, uint offset) {
			// Offsets are always in hex
			if (offset <= ushort.MaxValue)
				output.Write(string.Format(GetHexFormatUInt16(), offset), TextTokenType.Number);
			else
				output.Write(string.Format(GetHexFormatUInt32(), offset), TextTokenType.Number);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:7,代码来源:BreakpointPrinter.cs

示例3: 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

示例4: DecompileMethod

		public override void DecompileMethod(MethodDef method, ITextOutput output, DecompilationOptions options)
		{
			WriteComment(output, "Method: ");
			output.WriteDefinition(IdentifierEscaper.Escape(method.FullName), method, TextTokenType.Comment, false);
			output.WriteLine();

			if (!method.HasBody) {
				return;
			}
			
			StartKeywordBlock(output, ".body", method);

			ILAstBuilder astBuilder = new ILAstBuilder();
			ILBlock ilMethod = new ILBlock();
			DecompilerContext context = new DecompilerContext(method.Module) { CurrentType = method.DeclaringType, CurrentMethod = method };
			ilMethod.Body = astBuilder.Build(method, inlineVariables, context);
			
			if (abortBeforeStep != null) {
				new ILAstOptimizer().Optimize(context, ilMethod, abortBeforeStep.Value);
			}
			
			if (context.CurrentMethodIsAsync) {
				output.Write("async", TextTokenType.Keyword);
				output.Write('/', TextTokenType.Operator);
				output.WriteLine("await", TextTokenType.Keyword);
			}
			
			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(IdentifierEscaper.Escape(v.Name), v, v.IsParameter ? TextTokenType.Parameter : TextTokenType.Local);
				if (v.Type != null) {
					output.WriteSpace();
					output.Write(':', TextTokenType.Operator);
					output.WriteSpace();
					if (v.IsPinned) {
						output.Write("pinned", TextTokenType.Keyword);
						output.WriteSpace();
					}
					v.Type.WriteTo(output, ILNameSyntax.ShortTypeName);
				}
				if (v.IsGenerated) {
					output.WriteSpace();
					output.Write('[', TextTokenType.Operator);
					output.Write("generated", TextTokenType.Keyword);
					output.Write(']', TextTokenType.Operator);
				}
				output.WriteLine();
			}
			
			var memberMapping = new MemberMapping(method);
			foreach (ILNode node in ilMethod.Body) {
				node.WriteTo(output, memberMapping);
				if (!node.WritesNewLine)
					output.WriteLine();
			}
			output.AddDebugSymbols(memberMapping);
			EndKeywordBlock(output);
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:59,代码来源:ILAstLanguage.cs

示例5: WriteLabelList

		static void WriteLabelList(ITextOutput writer, Instruction[] instructions)
		{
			writer.Write("(");
			for(int i = 0; i < instructions.Length; i++) {
				if(i != 0) writer.Write(", ");
				WriteOffsetReference(writer, instructions[i]);
			}
			writer.Write(")");
		}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:9,代码来源:DisassemblerHelpers.cs

示例6: Write

		protected override void Write(ITextOutput output) {
			output.Write(string.Format("{0}", index + 1), TextTokenType.Number);
			if (infoTuple != null) {
				output.WriteSpace();
				output.Write('-', TextTokenType.Operator);
				output.WriteSpace();
				infoTuple.Item2(output);
			}
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:9,代码来源:MetaDataTableRecordTreeNode.cs

示例7: Write

		public static ITextOutput Write(ITextOutput output, FieldDef field, Language language) {
			output.Write(UIUtils.CleanUpIdentifier(field.Name), TextTokenHelper.GetTextTokenType(field));
			output.WriteSpace();
			output.Write(':', TextTokenType.Operator);
			output.WriteSpace();
			language.TypeToString(output, field.FieldType.ToTypeDefOrRef(), false, field);
			field.MDToken.WriteSuffixString(output);
			return output;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:9,代码来源:FieldTreeNode.cs

示例8: Write

		protected override void Write(ITextOutput output) {
			output.Write(string.Format("{0:X2}", (byte)tablesStreamVM.Table), TextTokenType.Number);
			output.WriteSpace();
			output.Write(string.Format("{0}", tablesStreamVM.Table), TextTokenType.Type);
			output.WriteSpace();
			output.Write('(', TextTokenType.Operator);
			output.Write(string.Format("{0}", tablesStreamVM.Rows), TextTokenType.Number);
			output.Write(')', TextTokenType.Operator);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:9,代码来源:MetaDataTableTreeNode.cs

示例9: Write

		public static ITextOutput Write(ITextOutput output, EventDef ev, Language language) {
			output.Write(UIUtils.CleanUpIdentifier(ev.Name), TextTokenHelper.GetTextTokenType(ev));
			output.WriteSpace();
			output.Write(':', TextTokenType.Operator);
			output.WriteSpace();
			language.TypeToString(output, ev.EventType, false, ev);
			ev.MDToken.WriteSuffixString(output);
			return output;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:9,代码来源:EventTreeNode.cs

示例10: Write

		protected override void Write(ITextOutput output) {
			output.Write("Section", TextTokenType.Keyword);
			output.WriteSpace();
			output.Write('#', TextTokenType.Operator);
			output.Write(sectionNumber.ToString(), TextTokenType.Number);
			output.Write(':', TextTokenType.Operator);
			output.WriteSpace();
			output.Write(string.Format("{0}", imageSectionHeaderVM.NameVM.String), TextTokenType.Type);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:9,代码来源:ImageSectionHeaderTreeNode.cs

示例11: WriteTo

		public static void WriteTo(this Instruction instruction, ITextOutput writer)
		{
			writer.WriteDefinition(CecilExtensions.OffsetToString(instruction.Offset), instruction);
			writer.Write(": ");
			writer.WriteReference(instruction.OpCode.Name, instruction.OpCode);
			if(null != instruction.Operand) {
				writer.Write(' ');
				WriteOperand(writer, instruction.Operand);
			}
		}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:10,代码来源:DisassemblerHelpers.cs

示例12: Write

		protected override void Write(ITextOutput output, Language language) {
			if (hidesParent) {
				output.Write('(', TextTokenType.Operator);
				output.Write("hides", TextTokenType.Text);
				output.Write(')', TextTokenType.Operator);
				output.WriteSpace();
			}
			Language.TypeToString(output, analyzedEvent.DeclaringType, true);
			output.Write('.', TextTokenType.Operator);
			EventTreeNode.Write(output, analyzedEvent, Language);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:11,代码来源:AnalyzedEventTreeNode.cs

示例13: Write

 public static ITextOutput Write(ITextOutput output, string name)
 {
     if (name.Length == 0)
         output.Write('-', TextTokenType.Operator);
     else {
         var parts = name.Split('.');
         for (int i = 0; i < parts.Length; i++) {
             if (i > 0)
                 output.Write('.', TextTokenType.Operator);
             output.Write(IdentifierEscaper.Escape(parts[i]), TextTokenType.NamespacePart);
         }
     }
     return output;
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:14,代码来源:NamespaceTreeNode.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: 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


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