Help wife leaving Monday!

I've never posted here before and I've really not even read any posts. My wife has read a number of posts to me due to their similarity to our life. Most of the time I would glaze over and partially listen but sometimes I would catch details that would remind me of me, of course then I would completely shut down all listening. Well now I'm in dire straits, searching for a way to show her how I really feel, how much she really means to me. Her life with me  has been a roller coaster with each dip dropping lower then the last. We haven't lived in the same residence for more then 3 years in our 20 years together, I have had multiple careers, been successful at each only to quit or be removed for stupid reasons. I opened a business (against her better judgement) and lost everything. Each time I promise Never Again, and I mean it. Then something falls through the cracks and I go to jail or spend the rent money or or or...It has been a never ending cycle and she has finally given up. A number of years ago, we were going through a particular bad period, and I had an emotional affair  with a married woman who formerly worked for me. It was not physical, it was more of me just getting a friendship need filled that because of my ADHD I did not know how to respond to my wife's desperate pleas to reconnect. I hid the affair  until today., when She discovered yet another brainless ADD moment, where I permitted another guy to open a facebook account in my name to prank a friend. The aforementioned woman contacted it and the guy started conversation. He made me aware of it, and I didn't stop him until I felt to guilty to allow him to continue. Even though he did all of the actual contact, it was me essentially replying to this woman and we restarted the affair. after a month I found out my friend had continued the conversation and made arrangements for us to me. It was then I put a stop to it and did not go back to the account. She is devastated, not only did this facebook thing occur but when she confronted me, what did I do-Lie- of course. I'm at a total loss. Things got physical and we both suffered. She called a friend to make arrangements to leave. I hate the fact that she is hurting so bad,which she claims is not hurt but rage, and I want to rectify the entire situation, but I don't know how to convince her that I won't lie anymore.  Any comments or advice will be greatly appreciated. Your experience is greatly valued in this home. I want her to be happy, and I want to rebuild what has been damaged. I need to find a way to show her what exactly she is-a wonderful, intelligent woman, an awesome friend, full of love and generosity, she is everything good thing in my life and the mother of my son. I know she doesn't feel appreciated because I havn't shown her for a long time and even then it was all or nothing. All being huge romantic gestures and nothing being exactly that--nothing. I don't blame her for wanting no needing to leave, which she has plans to do on Monday, but I know I can put forth the required effort to get in check and rebuild, I just need to know how to start. PLease help, I don't want to lose her. She has been apply lessons she is learning from codendency books, and has been trying to help me but I ignored it. I spent most of my time working or playing games or watching tv. She did calm down enough to talk to me while we sart on the floor(safe) and poured out her heart to me that all she wanted was the truth so we could move forward. I suppose the calm way and sincere words helped me open up. She was obviously hurt and said there are only two options, she leaves forever or I get my act together and get the treatment I need and rebuild the trust account.