Beispiel #1
0
        public override string CheckCanUpdateData(ResourceElement newResElem)
        {
            var res = base.CheckCanUpdateData(newResElem);

            if (!string.IsNullOrEmpty(res))
            {
                return(res);
            }

            var binData = (BinaryResourceData)newResElem.ResourceData;

            byte[] imageData;
            if (!SerializedImageUtilities.GetImageData(this.GetModule(), binData.TypeName, binData.Data, out imageData))
            {
                return(dnSpy_Resources.NewDataIsNotAnImage);
            }

            try {
                ImageResourceUtilities.CreateImageSource(imageData);
            }
            catch {
                return(dnSpy_Resources.NewDataIsNotAnImage);
            }

            return(string.Empty);
        }
Beispiel #2
0
        public override void UpdateData(ResourceElement newResElem)
        {
            base.UpdateData(newResElem);

            var binData = (BinaryResourceData)newResElem.ResourceData;

            SerializedImageUtilities.GetImageData(this.GetModule(), binData.TypeName, binData.Data, out var imageData);
            InitializeImageData(imageData);
        }
Beispiel #3
0
        public ResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup)
        {
            var serializedData = resourceElement.ResourceData as BinaryResourceData;

            if (serializedData == null)
            {
                return(null);
            }

            if (SerializedImageUtilities.GetImageData(module, serializedData.TypeName, serializedData.Data, out var imageData))
            {
                return(new SerializedImageResourceElementNodeImpl(treeNodeGroup, resourceElement, imageData));
            }

            return(null);
        }