コード例 #1
0
        void RegenerateEmbeddedResource(ModuleDef module)
        {
            TreeNode.EnsureChildrenLoaded();
            var outStream = new MemoryStream();
            var resources = new ResourceElementSet();

            foreach (DocumentTreeNodeData child in TreeNode.DataChildren)
            {
                var resourceElement = ResourceElementNode.GetResourceElement(child);
                if (resourceElement is null)
                {
                    throw new InvalidOperationException();
                }
                resources.Add(resourceElement);
            }

            ResourceWriter.Write(module, outStream, resources);
            Resource = new EmbeddedResource(Resource.Name, outStream.ToArray(), Resource.Attributes);
        }
コード例 #2
0
 public NodeAndResourceElement(DocumentTreeNodeData node)
 {
     Debug2.Assert(ResourceElementNode.GetResourceElement(node) is not null);
     this.node = node;
 }