GatewayHook determine module is being uninstall

During module setup I am creating some data in c:\ProgramData\[Some_folder_name]. During uninstall I want to remove all that data, however I can’t determine the function that I can use for it in GatewayHook.

Is there a function that can be overriden ?

Take a look at GatewayModuleHook, which is implemented by AbstractGatewayModuleHook. There is a shutdown method that is called when the module is being shut down, as occurs when the gateway shuts down, or the module shuts down prior to uninstall/restart.

Shutdown is great, but I want to be able to differentiate between uninstall and restart. I dont want to clean up if it is restart only when the module is uninstalled.

The module itself won’t have any way to know whether it’s being shutdown for restart or for uninstall.