public SourceFileEntry(MonoSymbolFile file, string file_name) { this.file = file; this.file_name = file_name; this.Index = file.AddSource(this); this.creating = true; }
public void RewriteMdbFile (string inputFile) { if (!settings.Quiet) Console.WriteLine ("Processing {0}", inputFile); var input = MonoSymbolFile.ReadSymbolFile (inputFile); var output = new MonoSymbolFile (); foreach (var s in input.Sources) { var newFileName = settings.FileNamesOnly ? Path.Combine (Path.GetDirectoryName (s.FileName), settings.Replace (Path.GetFileName (s.FileName))) : settings.Replace (s.FileName); if (settings.Verbose) Console.WriteLine ("{0} -> {1}", s.FileName, newFileName); s.FileName = newFileName; output.AddSource (s); } foreach (var cu in input.CompileUnits) { cu.ReadAll (); output.AddCompileUnit (cu); } foreach (var m in input.Methods) { m.ReadAll (); output.AddMethod (m); } var mdbName = new FileInfo (inputFile).Name; var tmpMdb = Path.GetTempFileName (); var finalMdb = inputFile; if (settings.OutputDirectory != null) finalMdb = Path.Combine (settings.OutputDirectory, mdbName); using (var stream = new FileStream (tmpMdb, FileMode.Create)) { output.CreateSymbolFile (input.Guid, stream); } input.Dispose (); File.Delete (finalMdb); File.Move (tmpMdb, finalMdb); }
static void MdbRebase(string mdbFile, string toRemove) { #if WINDOWS_BUILD Console.Error.WriteLine ("Warning: skipping MDB rebasing of {0} (not supported on Windows)", mdbFile); #else using (var input = MonoSymbolFile.ReadSymbolFile (mdbFile)) { var output = new MonoSymbolFile (); foreach (var source in input.Sources) { source.FileName = Path.Combine ( Path.GetDirectoryName (source.FileName), Path.GetFileName (source.FileName).Replace (toRemove, String.Empty) ); output.AddSource (source); } foreach (var compileUnit in input.CompileUnits) { compileUnit.ReadAll (); output.AddCompileUnit (compileUnit); } foreach (var method in input.Methods) { method.ReadAll (); output.AddMethod (method); } var tmpMdb = Path.GetTempFileName (); using (var stream = new FileStream (tmpMdb, FileMode.Create)) output.CreateSymbolFile (input.Guid, stream); File.Delete (mdbFile); File.Move (tmpMdb, mdbFile); } #endif }