How to avoid the custom code were lost?

Hi,
I wrote some custom code in 2 file marketpress.php and template-functions.php, and add new theme style and language file. But when I upgraded Marketpress plugin, all my custom code and my files were lost. How can I solve this problem?
Thanks!