|
1 | 1 | using System.Reflection; |
2 | 2 | using System.Globalization; |
3 | 3 | using System.Collections.Generic; |
4 | | -using Semmle.Util.Logging; |
5 | | -using System; |
6 | 4 | using Semmle.Extraction.Entities; |
7 | 5 | using System.IO; |
8 | | -using Semmle.Util; |
9 | 6 |
|
10 | 7 | namespace Semmle.Extraction.CIL.Entities |
11 | 8 | { |
12 | 9 | /// <summary> |
13 | 10 | /// An assembly to extract. |
14 | 11 | /// </summary> |
15 | | - public class Assembly : LabelledEntity, ILocation |
| 12 | + internal class Assembly : LabelledEntity, ILocation |
16 | 13 | { |
17 | 14 | private readonly File file; |
18 | 15 | private readonly AssemblyName assemblyName; |
@@ -101,48 +98,5 @@ public override IEnumerable<IExtractionProduct> Contents |
101 | 98 | } |
102 | 99 | } |
103 | 100 | } |
104 | | - |
105 | | - private static void ExtractCIL(Extractor extractor, TrapWriter trapWriter, bool extractPdbs) |
106 | | - { |
107 | | - using var cilContext = new Context(extractor, trapWriter, extractor.OutputPath, extractPdbs); |
108 | | - cilContext.Populate(new Assembly(cilContext)); |
109 | | - cilContext.PopulateAll(); |
110 | | - } |
111 | | - |
112 | | - /// <summary> |
113 | | - /// Main entry point to the CIL extractor. |
114 | | - /// Call this to extract a given assembly. |
115 | | - /// </summary> |
116 | | - /// <param name="layout">The trap layout.</param> |
117 | | - /// <param name="assemblyPath">The full path of the assembly to extract.</param> |
118 | | - /// <param name="logger">The logger.</param> |
119 | | - /// <param name="nocache">True to overwrite existing trap file.</param> |
120 | | - /// <param name="extractPdbs">Whether to extract PDBs.</param> |
121 | | - /// <param name="trapFile">The path of the trap file.</param> |
122 | | - /// <param name="extracted">Whether the file was extracted (false=cached).</param> |
123 | | - public static void ExtractCIL(Layout layout, string assemblyPath, ILogger logger, bool nocache, bool extractPdbs, TrapWriter.CompressionMode trapCompression, out string trapFile, out bool extracted) |
124 | | - { |
125 | | - trapFile = ""; |
126 | | - extracted = false; |
127 | | - try |
128 | | - { |
129 | | - var canonicalPathCache = CanonicalPathCache.Create(logger, 1000); |
130 | | - var pathTransformer = new PathTransformer(canonicalPathCache); |
131 | | - var extractor = new Extractor(false, assemblyPath, logger, pathTransformer); |
132 | | - var transformedAssemblyPath = pathTransformer.Transform(assemblyPath); |
133 | | - var project = layout.LookupProjectOrDefault(transformedAssemblyPath); |
134 | | - using var trapWriter = project.CreateTrapWriter(logger, transformedAssemblyPath.WithSuffix(".cil"), trapCompression, discardDuplicates: true); |
135 | | - trapFile = trapWriter.TrapFile; |
136 | | - if (nocache || !System.IO.File.Exists(trapFile)) |
137 | | - { |
138 | | - ExtractCIL(extractor, trapWriter, extractPdbs); |
139 | | - extracted = true; |
140 | | - } |
141 | | - } |
142 | | - catch (Exception ex) // lgtm[cs/catch-of-all-exceptions] |
143 | | - { |
144 | | - logger.Log(Severity.Error, string.Format("Exception extracting {0}: {1}", assemblyPath, ex)); |
145 | | - } |
146 | | - } |
147 | 101 | } |
148 | 102 | } |
0 commit comments