Ejemplo n.º 1
0
        public void ReadEmbeddedResource1Data()
        {
            var module   = ModuleDefinition.FromFile(typeof(TestCaseResources).Assembly.Location);
            var resource = module.Resources.First(r =>
                                                  r.Name == "AsmResolver.DotNet.TestCases.Resources.Resources.EmbeddedResource1");

            Assert.Equal(TestCaseResources.GetEmbeddedResource1Data(), Encoding.ASCII.GetString(resource.GetData()));
        }
        public void ReadEmbeddedResource1Data()
        {
            var image    = PEImage.FromFile(typeof(TestCaseResources).Assembly.Location);
            var metadata = image.DotNetDirectory.Metadata;
            var resource = FindResourceRow(metadata, "AsmResolver.DotNet.TestCases.Resources.Resources.EmbeddedResource1");

            var data = image.DotNetDirectory.DotNetResources.GetManifestResourceData(resource.Offset);

            Assert.Equal(TestCaseResources.GetEmbeddedResource1Data(), Encoding.ASCII.GetString(data));
        }