The good news is every incident report I have seen where there was an in flight fire, the fire went out as soon as the fuel and ignition were turned off. The ones that ended badly all involved no or incomplete engine shutdown procedures.
This is not rocket science. If you have an engine fire, shutdown the engine in accordance with the POH procedures and execute a forced approach to the best field within easy reach.