PERWAPI.CILWriter.WriteFile C# (CSharp) Method

WriteFile() public method

public WriteFile ( bool debug ) : void
debug bool
return void
        public void WriteFile(bool debug)
        {
            this.debug = debug;
            for (int i = 0; i < externRefs.Count; i++) {
                ((ReferenceScope)externRefs[i]).Write(this);
            }
            Assembly assem = pefile.GetThisAssembly();
            if (assem != null) {
                assem.Write(this);
            }
            WriteLine(".module " + pefile.GetFileName());
            if (fields != null) {
                for (int i = 0; i < fields.Length; i++) {
                    fields[i].Write(this);
                }
            }
            if (methods != null) {
                for (int i = 0; i < methods.Length; i++) {
                    methods[i].Write(this);
                }
            }
            if (classes != null) {
                for (int i = 0; i < classes.Length; i++) {
                    classes[i].Write(this);
                }
            }
            this.Flush();
            this.Close();
        }

Usage Example

Ejemplo n.º 1
0
 /// <summary>
 /// Write out a CIL text file for this PE file
 /// </summary>
 /// <param name="debug">include debug information</param>
 public void WriteCILFile(bool debug)
 {
     string cilFile = fileName.Substring(0,fileName.IndexOf('.')) + ".il";
     CILWriter writer = new CILWriter(cilFile, debug, this);
     writer.BuildCILInfo();
     writer.WriteFile(debug);
 }