public void TestMethod1() { Stopwatch watch = new Stopwatch(); try { string path = "Assemblies/mscorlib.dll"; if (!File.Exists(path)) { Assert.Fail("File not found"); return; } var assembly = CilAssembly.Create(path); watch.Start(); using (StreamWriter file = new StreamWriter("../../Output/foo.il")) { assembly.WriteTo(file); watch.Stop(); file.WriteLine("//Time elapsed: " + watch.Elapsed); assembly.Dispose(); } } catch (Exception e) { Assert.Fail(e.Message); return; } Assert.IsTrue(true); }
public async void TryOpenAssembly(string path) { try { CilAssembly newAssm = await Task.Run(() => CilAssembly.Create(path)); AddAssembly(newAssm); } catch { Console.WriteLine("Failed to open " + path); } }
public void TestMethod1() { var watch = new Stopwatch(); var path = "demo1.exe"; if (!File.Exists(path)) { var thisAssembly = typeof(CilTests).GetTypeInfo().Assembly; var resourceName = thisAssembly.GetManifestResourceNames().First(r => r.EndsWith("Demo1.exe")); var fileName = GetFileNameFromResourceName(resourceName); using (var fileStream = File.Create(fileName)) { using (var resource = thisAssembly.GetManifestResourceStream(resourceName)) { resource.CopyTo(fileStream); } } } const string outputDirectory = "Output"; if (!File.Exists(outputDirectory)) { Directory.CreateDirectory(outputDirectory); } var assembly = CilAssembly.Create(path); watch.Start(); using (var file = new StreamWriter(new FileStream($"{outputDirectory}/foo.il", FileMode.Create))) { assembly.WriteTo(file); watch.Stop(); file.WriteLine("//Time elapsed: " + watch.Elapsed); assembly.Dispose(); } Assert.True(true); }