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


C# ITextOutput.WriteLine方法代码示例

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


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

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

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

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

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

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

示例6: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {
				HashSet<string> directories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				var files = WriteCodeFilesInProject(assembly.AssemblyDefinition, options, directories).ToList();
				files.AddRange(WriteResourceFilesInProject(assembly, options, directories));
				WriteProjectFile(new TextOutputWriter(output), files, assembly.AssemblyDefinition.MainModule);
			} else {
				base.DecompileAssembly(assembly, output, options);
				output.WriteLine();
				ModuleDefinition mainModule = assembly.AssemblyDefinition.MainModule;
				if (mainModule.EntryPoint != null) {
					output.Write("' Entry point: ");
					output.WriteReference(mainModule.EntryPoint.DeclaringType.FullName + "." + mainModule.EntryPoint.Name, mainModule.EntryPoint);
					output.WriteLine();
				}
				switch (mainModule.Architecture) {
					case TargetArchitecture.I386:
						if ((mainModule.Attributes & ModuleAttributes.Required32Bit) == ModuleAttributes.Required32Bit)
							WriteCommentLine(output, "Architecture: x86");
						else
							WriteCommentLine(output, "Architecture: AnyCPU");
						break;
					case TargetArchitecture.AMD64:
						WriteCommentLine(output, "Architecture: x64");
						break;
					case TargetArchitecture.IA64:
						WriteCommentLine(output, "Architecture: Itanium-64");
						break;
				}
				if ((mainModule.Attributes & ModuleAttributes.ILOnly) == 0) {
					WriteCommentLine(output, "This assembly contains unmanaged code.");
				}
				switch (mainModule.Runtime) {
					case TargetRuntime.Net_1_0:
						WriteCommentLine(output, "Runtime: .NET 1.0");
						break;
					case TargetRuntime.Net_1_1:
						WriteCommentLine(output, "Runtime: .NET 1.1");
						break;
					case TargetRuntime.Net_2_0:
						WriteCommentLine(output, "Runtime: .NET 2.0");
						break;
					case TargetRuntime.Net_4_0:
						WriteCommentLine(output, "Runtime: .NET 4.0");
						break;
				}
				output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.AssemblyDefinition.MainModule);
					codeDomBuilder.AddAssembly(assembly.AssemblyDefinition, onlyAssemblyLevel: !options.FullDecompilation);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options);
				}
			}
			OnDecompilationFinished(null);
		}
开发者ID:itsff,项目名称:ILSpy,代码行数:58,代码来源:VBLanguage.cs

示例7: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {
                var decompiler = new VBProjectDecompiler();
                decompiler.Decompile(this, assembly, output, options);
			} else {
				base.DecompileAssembly(assembly, output, options);
				output.WriteLine();
				ModuleDefinition mainModule = assembly.ModuleDefinition;
				if (mainModule.EntryPoint != null) {
					output.Write("' Entry point: ");
					output.WriteReference(mainModule.EntryPoint.DeclaringType.FullName + "." + mainModule.EntryPoint.Name, mainModule.EntryPoint);
					output.WriteLine();
				}
				WriteCommentLine(output, "Architecture: " + CSharpLanguage.GetPlatformDisplayName(mainModule));
				if ((mainModule.Attributes & ModuleAttributes.ILOnly) == 0) {
					WriteCommentLine(output, "This assembly contains unmanaged code.");
				}
				switch (mainModule.Runtime) {
					case TargetRuntime.Net_1_0:
						WriteCommentLine(output, "Runtime: .NET 1.0");
						break;
					case TargetRuntime.Net_1_1:
						WriteCommentLine(output, "Runtime: .NET 1.1");
						break;
					case TargetRuntime.Net_2_0:
						WriteCommentLine(output, "Runtime: .NET 2.0");
						break;
					case TargetRuntime.Net_4_0:
                        if (assembly.IsNet45())
                        {
                            WriteCommentLine(output, "Runtime: .NET 4.5");
                        }
                        else
                        {
                            WriteCommentLine(output, "Runtime: .NET 4.0");
                        }
						break;
				}
				output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.ModuleDefinition);
					codeDomBuilder.AddAssembly(assembly.ModuleDefinition, onlyAssemblyLevel: !options.FullDecompilation);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options, assembly.ModuleDefinition);
				}
			}
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:49,代码来源:VBLanguage.cs

示例8: DoDisassemble

		void DoDisassemble(IDnlibDef item, ITextOutput output, ReflectionDisassembler disassembler) {
			if (item is ModuleDef) {
				var module = (ModuleDef)item;
				disassembler.WriteAssemblyReferences(module);
				if (module.Assembly != null)
					disassembler.WriteAssemblyHeader(module.Assembly);
				output.WriteLine();
				disassembler.WriteModuleHeader(module);
			}
			else if (item is TypeDef) {
				disassembler.DisassembleType((TypeDef)item);
			}
			else if (item is MethodDef) {
				disassembler.DisassembleMethod((MethodDef)item);
			}
			else if (item is FieldDef) {
				disassembler.DisassembleField((FieldDef)item);
			}
			else if (item is PropertyDef) {
				disassembler.DisassembleProperty((PropertyDef)item);
			}
			else if (item is EventDef) {
				disassembler.DisassembleEvent((EventDef)item);
			}
		}
开发者ID:mamingxiu,项目名称:dnExplorer,代码行数:25,代码来源:CILLanguage.cs

示例9: Decompile

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

示例10: DecompileType

        public override void DecompileType(TypeDefinition type, ITextOutput output, DecompilationOptions options)
        {
            var xType = GetXTypeDefinition(type);
            
            output.WriteLine("class " + type.Name);
            output.WriteLine("{");

            foreach (var field in xType.Fields)
            {
                if (!field.IsReachable)
                    continue;
                output.WriteLine("\t{0} {1};", field.FieldType.Name, field.Name);
            }
                
            output.WriteLine();

            foreach (var method in xType.Methods)
            {
                var ilMethod = method as XBuilder.ILMethodDefinition;
                if (ilMethod != null && !ilMethod.OriginalMethod.IsReachable)
                    continue;

                output.Write("\t{0} {1}(", method.ReturnType.Name, method.Name);
                
                List<string> parms = method.Parameters.Select(p => string.Format("{0}{1} {2}", 
                                                                     KindToStringAndSpace(p.Kind), 
                                                                     p.ParameterType.Name, 
                                                                     p.Name))
                                                      .ToList();

                if (method.NeedsGenericInstanceTypeParameter)
                    parms.Add("Type[] git");
                if (method.NeedsGenericInstanceMethodParameter)
                    parms.Add("Type[] gim");

                output.Write(string.Join(", ", parms));
                output.WriteLine(")");
                output.WriteLine("\t{");
                DecompileMethod(method, output, 2);
                output.WriteLine("\t}");
                output.WriteLine();
            }

            output.WriteLine("}");
            
        }
开发者ID:jakesays,项目名称:dot42,代码行数:46,代码来源:DexInputLanguage.cs

示例11: DecompileProperty

		public override void DecompileProperty(PropertyDefinition property, ITextOutput output, DecompilationOptions options)
		{
			ReflectionDisassembler rd = new ReflectionDisassembler(output, detectControlStructure, options.CancellationToken);
			rd.DisassembleProperty(property);
			if (property.GetMethod != null) {
				output.WriteLine();
				rd.DisassembleMethod(property.GetMethod);
			}
			if (property.SetMethod != null) {
				output.WriteLine();
				rd.DisassembleMethod(property.SetMethod);
			}
			foreach (var m in property.OtherMethods) {
				output.WriteLine();
				rd.DisassembleMethod(m);
			}
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:17,代码来源:ILLanguage.cs

示例12: PrintMethod

        private void PrintMethod(CompiledMethod cmethod, ITextOutput output, DecompilationOptions options)
        {
            if ((cmethod != null) && (cmethod.RLBody != null))
            {
                var body = cmethod.RLBody;
                var basicBlocks = BasicBlock.Find(body);

                foreach (var block in basicBlocks)
                {
                    output.Write(string.Format("D_{0:X4}:", block.Entry.Index));
                    output.WriteLine();
                    output.Indent();
                    foreach (var ins in block.Instructions)
                    {
                        if (ShowHasSeqPoint)
                        {
                            if (ins.SequencePoint != null)
                                output.Write(ins.SequencePoint.IsSpecial ? "!" : "~");
                        }

                        output.Write(ins.ToString());
                        output.WriteLine();
                    }
                    output.Unindent();
                }

                if (body.Exceptions.Any())
                {
                    output.WriteLine();
                    output.Write("Exception handlers:");
                    output.WriteLine();
                    output.Indent();
                    foreach (var handler in body.Exceptions)
                    {
                        output.Write(string.Format("{0:x4}-{1:x4}", handler.TryStart.Index, handler.TryEnd.Index));
                        output.WriteLine();
                        output.Indent();
                        foreach (var c in handler.Catches)
                        {
                            output.Write(string.Format("{0} => {1:x4}", c.Type, c.Instruction.Index));
                            output.WriteLine();
                        }
                        if (handler.CatchAll != null)
                        {
                            output.Write(string.Format("{0} => {1:x4}", "<any>", handler.CatchAll.Index));
                            output.WriteLine();
                        }
                        output.Unindent();
                    }
                    output.Unindent();
                }
            }
            else
            {
                output.Write("Method not found in dex");
                output.WriteLine();
            }
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:58,代码来源:RLLanguage.cs

示例13: DecompileAssembly

        public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
        {
            output.WriteLine("// " + assembly.FileName);
            output.WriteLine();

            ReflectionDisassembler rd = new ReflectionDisassembler(output, detectControlStructure, options.CancellationToken);
            //if (options.FullDecompilation)
            //	rd.WriteAssemblyReferences(assembly.ModuleDefinition);
            if (assembly.AssemblyDefinition != null)
                rd.WriteAssemblyHeader(assembly.AssemblyDefinition);
            output.WriteLine();
            rd.WriteModuleHeader(assembly.ModuleDefinition);
            if (options.FullDecompilation) {
                output.WriteLine();
                output.WriteLine();
                rd.WriteModuleContents(assembly.ModuleDefinition);
            }
        }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:18,代码来源:ILLanguage.cs

示例14: Decompile

		public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
		{
			language.WriteCommentLine(output, string.Format("{0} ({1}, {2})", r.Name, r.ResourceType, r.Attributes));
			
			ISmartTextOutput smartOutput = output as ISmartTextOutput;
			if (smartOutput != null && r is EmbeddedResource) {
				smartOutput.AddButton(Images.Save, "Save", delegate { Save(null); });
				output.WriteLine();
			}
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:10,代码来源:ResourceTreeNode.cs

示例15: Run

 private void Run(ConsoleOptions options, ITextOutput output)
 {
     var stopWatch = new Stopwatch();
     stopWatch.Start();
     var crapRunner = GetContainer().Resolve<CrapRunner>();
     crapRunner.Run(options.codeCoverage, options.codeMetrics, options.crapThreshold);
     crapRunner.WriteOutput(output);
     if (options.HasXmlOutput)
         crapRunner.WriteXmlOutput(options.xml, output);
     stopWatch.Stop();
     output.WriteLine(string.Format("Took {0:0.00}s to execute", stopWatch.Elapsed.TotalSeconds));
 }
开发者ID:MorganPersson,项目名称:crap4n,代码行数:12,代码来源:Program.cs


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