I have a WPF application that supports receiving drag and drop data from Chrome. When the data is received by IDataObject the data format is "Chromium Web Custom MIME Data Format". This is because I use custom MIME type for dataTransfer.setData from JavaScript. This is expected behavior.
My question is, what is the actual specification for this data?
The data is a MemoryStream of bytes that I can convert to a Unicode string. Given a MIME type of application/x-myapp.document+text and a value of {F5F5A3C3-3594-430B-988F-BA1C0154201E} the string will look like the following:
" \0\u0001\0#\0application/x-myapp.document+text\0&\0{F5F5A3C3-3594-430B-988F-BA1C0154201E}"
If I split the string by the null terminators it is six parts:
(_determined this to be the size of the data (length) and is not any real character of a string)\u0001(determined this to be the number of data items)#application/x-myapp.document+text(the custom MIME type)&{F5F5A3C3-3594-430B-988F-BA1C0154201E}(the custom value)
I have observed that #2 is just a number and seems to represent the number of key value pairs in the data (mime/value). Then I have my MIME type, and actual value. It appears that this data is the HTML 5 Drag Data Store, or possibly the drag store item list.
So again, my final questions:
- What is the actual format of this data? Is it data defined by the HTML 5 specification, or is it actually the Windows Clipboard format?
- Where can I find a data specification so I can write code to parse this correctly?
- Or does someone have a better answer to all of this?
I also will need to do this with Firefox and the data appears to be similar, but possibly with a different Encoding. So if this is known information also, it would be helpful.
I have also tried using a BinaryReader but without a specification I have been unable to read the data in a manner that produces correct results, and I have been using the HTML 5 spec (https://html.spec.whatwg.org/multipage/dnd.html#the-drag-data-store).