ironfede / openmcdf

Microsoft Compound File .net component - pure C# - netstandard 2.0
Mozilla Public License 2.0
308 stars 76 forks source link

When creating a OLEPropertiesContainer for the UserDefinedPropeties, … #111

Closed Numpsy closed 7 months ago

Numpsy commented 7 months ago

…use the code page from PropertySet1 instead of the one from the parent section

As it stands now, it uses this.Context.CodePage which is the code page from the parent DocumentSummaryInformation section, which might not be the same. (I don't know how often that would happen in the real world, but still) - so, use the codepage from PropertySet1 instead.

I also added a test file that has a user properties dictionary with the CP_WINUNICODE codepage, and LPWSTR strings, and a test for reading the names (there are several properties with different length names/values as an attempt to test the padding behavior with different lengths of strings)

Note: I couldn't find a suitable test file so I made one with my current set of OpenMCDF fixes. The file properties display correctly in both Windows Explorer:

image

and from inside Word:

image

Which I take as an indication that the file has been written correctly.

ironfede commented 7 months ago

Fixed solution for missing test file after merge

Numpsy commented 7 months ago

Oops, sorry, missed that :-(.

Actually on that note, I didn't notice before, but it looks like the CI build is only running the unit tests for the main library and not the extensions library - so perhaps it should run both?

ironfede commented 7 months ago

Mmm... yes it should. If you want to create a pull request for this change I will merge it immediately. Many thanks!