Here is a simple patch that enables SwapActiveHeaderSource function to use ProjectManager to determine header types and source types.
I found the necessary code commented-out in FileTypeOf function.
In view of the discussion there about not changing the ABI, I put the code in a new function FileTypeOf_v2.
The new function is used only by SwapActiveHeaderSource.