public static void RegisterHooks() {
Hook<SoftwareIcon>.BeforeDelete += (sender, entity) => {
try {
if (entity.KeepFile) return;
if (System.IO.File.Exists(entity.File)) {
System.IO.File.Delete(entity.File);
}
}
catch (Exception e) {
Program.WarehouseLogSource.LogError(string.Format("Failed to delete file {0} when the SoftwareIcon object was deleted", entity.File));
Program.WarehouseLogSource.LogException(e);
}
};
}
}