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


C# ITextOutput.WriteSpace方法代码示例

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


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

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

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

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

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

示例5: Write

		public static ITextOutput Write(ITextOutput output, PropertyDef property, Language language, bool? isIndexer = null) {
			language.FormatPropertyName(output, property, isIndexer);
			output.WriteSpace();
			output.Write(':', TextTokenType.Operator);
			output.WriteSpace();
			language.TypeToString(output, property.PropertySig.GetRetType().ToTypeDefOrRef(), false, property);
			property.MDToken.WriteSuffixString(output);
			return output;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:9,代码来源:PropertyTreeNode.cs

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

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

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

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

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

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

示例12: WriteTo

        public static void WriteTo(this ITypeDefOrRef type, ITextOutput writer, ILNameSyntax syntax, int depth)
        {
            if (depth++ > MAX_CONVERTTYPE_DEPTH || type == null)
                return;
            var ts = type as TypeSpec;
            if (ts != null && !(ts.TypeSig is FnPtrSig)) {
                WriteTo(((TypeSpec)type).TypeSig, writer, syntax, depth);
                return;
            }
            string typeFullName = type.FullName;
            string typeName = type.Name.String;
            if (ts != null) {
                var fnPtrSig = ts.TypeSig as FnPtrSig;
                typeFullName = DnlibExtensions.GetFnPtrFullName(fnPtrSig);
                typeName = DnlibExtensions.GetFnPtrName(fnPtrSig);
            }
            TypeSig typeSig = null;
            string name = type.DefinitionAssembly.IsCorLib() ? PrimitiveTypeName(typeFullName, type.Module, out typeSig) : null;
            if (syntax == ILNameSyntax.ShortTypeName) {
                if (name != null)
                    WriteKeyword(writer, name, typeSig.ToTypeDefOrRef());
                else
                    writer.WriteReference(Escape(typeName), type, TextTokenHelper.GetTextTokenType(type));
            } else if ((syntax == ILNameSyntax.Signature || syntax == ILNameSyntax.SignatureNoNamedTypeParameters) && name != null) {
                WriteKeyword(writer, name, typeSig.ToTypeDefOrRef());
            } else {
                if (syntax == ILNameSyntax.Signature || syntax == ILNameSyntax.SignatureNoNamedTypeParameters) {
                    writer.Write(DnlibExtensions.IsValueType(type) ? "valuetype" : "class", TextTokenType.Keyword);
                    writer.WriteSpace();
                }

                if (type.DeclaringType != null) {
                    type.DeclaringType.WriteTo(writer, ILNameSyntax.TypeName, depth);
                    writer.Write('/', TextTokenType.Operator);
                    writer.WriteReference(Escape(typeName), type, TextTokenHelper.GetTextTokenType(type));
                } else {
                    if (!(type is TypeDef) && type.Scope != null && !(type is TypeSpec)) {
                        writer.Write('[', TextTokenType.Operator);
                        writer.Write(Escape(type.Scope.GetScopeName()), TextTokenType.ILModule);
                        writer.Write(']', TextTokenType.Operator);
                    }
                    if (ts != null || MustEscape(typeFullName))
                        writer.WriteReference(Escape(typeFullName), type, TextTokenHelper.GetTextTokenType(type));
                    else {
                        WriteNamespace(writer, type.Namespace);
                        if (!string.IsNullOrEmpty(type.Namespace))
                            writer.Write('.', TextTokenType.Operator);
                        writer.WriteReference(IdentifierEscaper.Escape(type.Name), type, TextTokenHelper.GetTextTokenType(type));
                    }
                }
            }
        }
开发者ID:gsong2014,项目名称:dnSpy,代码行数:52,代码来源:DisassemblerHelpers.cs

示例13: WriteKeyword

 internal static void WriteKeyword(ITextOutput writer, string name, ITypeDefOrRef tdr)
 {
     var parts = name.Split(' ');
     for (int i = 0; i < parts.Length; i++) {
         if (i > 0)
             writer.WriteSpace();
         if (tdr != null)
             writer.WriteReference(parts[i], tdr, TextTokenType.Keyword);
         else
             writer.Write(parts[i], TextTokenType.Keyword);
     }
 }
开发者ID:gsong2014,项目名称:dnSpy,代码行数:12,代码来源:DisassemblerHelpers.cs

示例14: WriteToolTip

		public virtual void WriteToolTip(ITextOutput output, IVariable variable, string name)
		{
			output.Write(variable is Local ? "(local variable)" : "(parameter)", TextTokenType.Text);
			output.WriteSpace();
			WriteToolTip(output, variable.Type.ToTypeDefOrRef(), variable is Parameter ? ((Parameter)variable).ParamDef : null);
			output.WriteSpace();
			output.Write(IdentifierEscaper.Escape(GetName(variable, name)), variable is Local ? TextTokenType.Local : TextTokenType.Parameter);
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:8,代码来源:Language.cs

示例15: WriteMethodName

 void WriteMethodName(ITextOutput output, IMethod method, string name)
 {
     string[] list;
     if (nameToOperatorName.TryGetValue(name, out list)) {
         for (int i = 0; i < list.Length; i++) {
             if (i > 0)
                 output.WriteSpace();
             var s = list[i];
             output.Write(s, 'a' <= s[0] && s[0] <= 'z' ? TextTokenType.Keyword : TextTokenType.Operator);
         }
     }
     else
         output.Write(IdentifierEscaper.Escape(name), TextTokenHelper.GetTextTokenType(method));
 }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:14,代码来源:CSharpLanguage.cs


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