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 (!SerializedImageUtils.GetImageData(this.GetModule(), binData.TypeName, binData.Data, out imageData)) { return(dnSpy_Resources.NewDataIsNotAnImage); } try { ImageResourceUtils.CreateImageSource(imageData); } catch { return(dnSpy_Resources.NewDataIsNotAnImage); } return(string.Empty); }
public override void UpdateData(ResourceElement newResElem) { base.UpdateData(newResElem); var binData = (BinaryResourceData)newResElem.ResourceData; byte[] imageData; SerializedImageUtils.GetImageData(this.GetModule(), binData.TypeName, binData.Data, out imageData); InitializeImageData(imageData); }
public IResourceElementNode Create(ModuleDef module, ResourceElement resourceElement, ITreeNodeGroup treeNodeGroup) { var serializedData = resourceElement.ResourceData as BinaryResourceData; if (serializedData == null) { return(null); } byte[] imageData; if (SerializedImageUtils.GetImageData(module, serializedData.TypeName, serializedData.Data, out imageData)) { return(new SerializedImageResourceElementNode(treeNodeGroup, resourceElement, imageData)); } return(null); }