/src/LinFu.AOP/Loaders/PdbLoader.cs

http://github.com/philiplaureano/LinFu · C# · 45 lines · 21 code · 4 blank · 20 comment · 3 complexity · a7b9826f559db7e40b6f141938aa230d MD5 · raw file

  1. using System.Reflection;
  2. using LinFu.AOP.Cecil.Interfaces;
  3. using Mono.Cecil;
  4. namespace LinFu.AOP.Cecil.Loaders
  5. {
  6. /// <summary>
  7. /// Represents the default implementation of the <see cref="IPdbLoader" /> interface.
  8. /// </summary>
  9. public class PdbLoader : IPdbLoader
  10. {
  11. /// <summary>
  12. /// Loads an assembly into memory.
  13. /// </summary>
  14. /// <param name="assemblyArray">The bytes that represent the target assembly.</param>
  15. /// <param name="pdbBytes">The bytes that represent the PDB file.</param>
  16. /// <returns>A <see cref="System.Reflection.Assembly" /> that represents the loaded assembly.</returns>
  17. public Assembly LoadAssembly(byte[] assemblyArray, byte[] pdbBytes)
  18. {
  19. // Load the assembly into the current application domain
  20. if (pdbBytes != null && pdbBytes.Length > 0)
  21. return Assembly.Load(assemblyArray, pdbBytes);
  22. return Assembly.Load(assemblyArray);
  23. }
  24. /// <summary>
  25. /// Loads the debug symbols from the target <paramref name="assembly" />.
  26. /// </summary>
  27. /// <param name="assembly">The assembly that contains the symbols to be loaded.</param>
  28. public void LoadSymbols(AssemblyDefinition assembly)
  29. {
  30. // TODO: How does Cecil 0.9.x load symbols??
  31. }
  32. /// <summary>
  33. /// Saves the debug symbols for the target<paramref name="targetAssembly" />.
  34. /// </summary>
  35. /// <param name="targetAssembly">The assembly that contains the symbols to be saved.</param>
  36. public void SaveSymbols(AssemblyDefinition targetAssembly)
  37. {
  38. // TODO: How does Cecil 0.9.x save symbols??
  39. }
  40. }
  41. }