Is there a method to write objects like an image to localization? There is only one for string that I see. I can read the image file fine using DbRes.TObject(Id, Images) as byte[];
Thanks!
The IResourceWriter
implementations have an object
overload for the data parameter that you should be able to use to pass in binary data. Also the data manager has explicit methods for saving data of various types.
+++ Rick ---
IResourceWriter? didn't see that anywhere. I used DbResourceDataManager.UpdateOrAddResource. But the method GetResourceItem returns null all the time, so how can I get all the metadata for the file like filename, etc?
Hi Chris,
I'm confused what you are asking. DbResourceDataManager.UpdateOrAddResource
lets you write the value, so that's working? Wasn't that the original question?
You should be able to use DbResourceManager.GetResourceItem()
to retrieve the value assuming it's been added to the database (check the Db to make sure). If that's not working making sure the resourceId and resourceSet match exactly.
+++ Rick ---
Ok. Here is the db records in the localization table:
Id's 3 and 4 are from your localization UI site. I was using GetResourceObject, which always returns null, so now I just tried the GetResourceItem, and it works, Thanks! And, realized I wasn't setting the valuetype field to 1, and didn't set the value field. Should I set the value field, or does that matter? Thanks Rick!
The value field is auto-set with the type info of the binary data. You shouldn't set the value because if that data is not there the data probably can't be reserialized properly. This behavior matches what is stored in Resx files so there's a good reason for the exact format that is used.
The ValueType comes from an enum and is required to indicate this field is a non-text/binary resource.
+++ Rick ---