Ejemplo n.º 1
0
        public ModuleReaderTestClass()
        {
            this.HostEnv   = new HostEnvironment();
            this.NameTable = this.HostEnv.NameTable;
            string location          = Directory.GetCurrentDirectory();
            string cppAssemblyPath   = Path.Combine(location, "MRW_CppAssembly.dll");
            string ilAsmAssemblyPath = Path.Combine(location, "MRW_ILAsmAssembly.dll");
            string module1Path       = Path.Combine(location, "MRW_Module1.netmodule");
            string module2Path       = Path.Combine(location, "MRW_Module2.netmodule");
            string phxArchMsilPath   = Path.Combine(location, "arch-msil.dll");
            string testAssemblyPath  = Path.Combine(location, "MRW_TestAssembly.dll");
            string assemblyPath      = Path.Combine(location, "MRW_Assembly.dll");
            string vjslibPath        = Path.Combine(location, "vjslib.dll");

            ExtractResource("PEReaderTests.TestModules.MRW_CppAssembly.dll", cppAssemblyPath);
            ExtractResource("PEReaderTests.TestModules.MRW_ILAsmAssembly.dll", ilAsmAssemblyPath);
            ExtractResource("PEReaderTests.TestModules.MRW_Module1.netmodule", module1Path);
            ExtractResource("PEReaderTests.TestModules.MRW_Module2.netmodule", module2Path);
            ExtractResource("PEReaderTests.TestModules.arch-msil.dll", phxArchMsilPath);
            ExtractResource("PEReaderTests.TestModules.MRW_TestAssembly.dll", testAssemblyPath);
            ExtractResource("PEReaderTests.TestModules.MRW_Assembly.dll", assemblyPath);
            ExtractResource("PEReaderTests.TestModules.vjslib.dll", vjslibPath);

            DirectoryInfo dirInfo     = new DirectoryInfo(Path.GetDirectoryName(typeof(object).Assembly.Location));
            string        clrLocation = dirInfo.Parent.FullName + "\\" + "v2.0.50727\\";

            this.MscorlibAssembly = (IAssembly)this.HostEnv.LoadUnitFrom(clrLocation + "mscorlib.dll");
            this.SystemAssembly   = (IAssembly)this.HostEnv.LoadUnitFrom(clrLocation + "System.dll");
            this.VjslibAssembly   = (IAssembly)this.HostEnv.LoadUnitFrom(vjslibPath);
            this.AssemblyAssembly = (IAssembly)this.HostEnv.LoadUnitFrom(assemblyPath);
            this.CppAssembly      = (IAssembly)this.HostEnv.LoadUnitFrom(cppAssemblyPath);
            this.TestAssembly     = (IAssembly)this.HostEnv.LoadUnitFrom(testAssemblyPath);
            this.Module1          = (IModule)this.HostEnv.LoadUnitFrom(module1Path);
            this.Module2          = (IModule)this.HostEnv.LoadUnitFrom(module2Path);
            this.ILAsmAssembly    = (IAssembly)this.HostEnv.LoadUnitFrom(ilAsmAssemblyPath);
            this.PhxArchMsil      = (IAssembly)this.HostEnv.LoadUnitFrom(phxArchMsilPath);
        }
Ejemplo n.º 2
0
    public ModuleReaderTestClass() {
      this.HostEnv = new HostEnvironment();
      this.NameTable = this.HostEnv.NameTable;
      string location = Directory.GetCurrentDirectory();
      string cppAssemblyPath = Path.Combine(location, "MRW_CppAssembly.dll");
      string ilAsmAssemblyPath = Path.Combine(location, "MRW_ILAsmAssembly.dll");
      string module1Path = Path.Combine(location, "MRW_Module1.netmodule");
      string module2Path = Path.Combine(location, "MRW_Module2.netmodule");
      string phxArchMsilPath = Path.Combine(location, "arch-msil.dll");
      string testAssemblyPath = Path.Combine(location, "MRW_TestAssembly.dll");
      string assemblyPath = Path.Combine(location, "MRW_Assembly.dll");
      string vjslibPath = Path.Combine(location, "vjslib.dll");

      ExtractResource("PEReaderTests.TestModules.MRW_CppAssembly.dll", cppAssemblyPath);
      ExtractResource("PEReaderTests.TestModules.MRW_ILAsmAssembly.dll", ilAsmAssemblyPath);
      ExtractResource("PEReaderTests.TestModules.MRW_Module1.netmodule", module1Path);
      ExtractResource("PEReaderTests.TestModules.MRW_Module2.netmodule", module2Path);
      ExtractResource("PEReaderTests.TestModules.arch-msil.dll", phxArchMsilPath);
      ExtractResource("PEReaderTests.TestModules.MRW_TestAssembly.dll", testAssemblyPath);
      ExtractResource("PEReaderTests.TestModules.MRW_Assembly.dll", assemblyPath);
      ExtractResource("PEReaderTests.TestModules.vjslib.dll", vjslibPath);

      DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(typeof(object).Assembly.Location));
      string clrLocation = dirInfo.Parent.FullName + "\\" + "v2.0.50727\\";

      this.MscorlibAssembly = (IAssembly)this.HostEnv.LoadUnitFrom(clrLocation + "mscorlib.dll");
      this.SystemAssembly = (IAssembly)this.HostEnv.LoadUnitFrom(clrLocation + "System.dll");
      this.VjslibAssembly = (IAssembly)this.HostEnv.LoadUnitFrom(vjslibPath);
      this.AssemblyAssembly = (IAssembly)this.HostEnv.LoadUnitFrom(assemblyPath);
      this.CppAssembly = (IAssembly)this.HostEnv.LoadUnitFrom(cppAssemblyPath);
      this.TestAssembly = (IAssembly)this.HostEnv.LoadUnitFrom(testAssemblyPath);
      this.Module1 = (IModule)this.HostEnv.LoadUnitFrom(module1Path);
      this.Module2 = (IModule)this.HostEnv.LoadUnitFrom(module2Path);
      this.ILAsmAssembly = (IAssembly)this.HostEnv.LoadUnitFrom(ilAsmAssemblyPath);
      this.PhxArchMsil = (IAssembly)this.HostEnv.LoadUnitFrom(phxArchMsilPath);
    }