This PR moves some new APIs used in the DocSvr code into the MsappArchive and IMsappArchive APIs in this repo.
DoesEntryExist - allows callers to determine whether an entry exists w/o needing to inspect internal canonical dictionary.
TryGenerateUniqueEntryPath - exposes logic for generating a unique entry, in case similar entries already exist. This function is similar to the private method GetSafeEntryPath, but this method only has a single responsibility, in order to make it more usable for different scenarios.
MsappArchive.TryMakeSafeForEntryPathSegment is a new static method that has a single responsibility, allowing it's usage to be composed with other functions depending on the scenario. It is similar to encoding a path segment of a URI. Namely, the char set it allows is anything that could be a valid file name or directory name.
GetSafeEntryPath is modified to use the new TryGenerateUniqueEntryPath and TryMakeSafeForEntryPathSegment methods.
The GetEntry, GetRequiredEntry methods were updated to utilize the TryGetEntry method.
Validation:
Added additional unit tests for the three new methods
Updated existing test output due to '.' chars now being a valid file/directory name.
This PR moves some new APIs used in the DocSvr code into the MsappArchive and IMsappArchive APIs in this repo.
DoesEntryExist
- allows callers to determine whether an entry exists w/o needing to inspect internal canonical dictionary.TryGenerateUniqueEntryPath
- exposes logic for generating a unique entry, in case similar entries already exist. This function is similar to the private methodGetSafeEntryPath
, but this method only has a single responsibility, in order to make it more usable for different scenarios.MsappArchive.TryMakeSafeForEntryPathSegment
is a new static method that has a single responsibility, allowing it's usage to be composed with other functions depending on the scenario. It is similar to encoding a path segment of a URI. Namely, the char set it allows is anything that could be a valid file name or directory name.GetSafeEntryPath
is modified to use the newTryGenerateUniqueEntryPath
andTryMakeSafeForEntryPathSegment
methods.GetEntry
,GetRequiredEntry
methods were updated to utilize theTryGetEntry
method.Validation: