If you're gay you're gay. Contrarary to what the fanatics will tell you, it's not a choice. It's just the way people are born. You got married, had a family, did the whole straqight life thing, and I'm sure you love your wife and kids dearly. But now the shit's hit the fan. She's foumd out your orfientation, or at least your inclination for it. Now she feels betrayed, feels perhaps her marriage has been a lie, doesn't know how to cope. And neither do you.
I have to tell you, honestly, this is not likely to end happily. You can lie to yourself and lie to your wife ansd seek coumnseling and work to save your marriage, or you can be honesat to yourself and split up. Neither choice is a good one, Someone is going to end up miserable. How do I know this? My uncle Guy, in his fifties, finally realized he was gay. He left his wife and three kids to be true to himself. Most of the family, both his and hers hated him for it. Some of us understood. Didn't like it because of the divorce and the kids, but we understood.
It's time for you to seek professional help. A therapist or a counselor. This is not the kind of problem that can be dealt with on the internet. I'm good, but I'm not THAT good.