using System;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;

namespace MicronSync.Components
{
    public partial class Worker : Form
    {
        public int exitCode = 0;
        public int customInt
        {
            get; set;
        }

        public Worker()
        {
            InitializeComponent();

            BackgroundWorker lmzaPackage = new BackgroundWorker();
            lmzaPackage.DoWork += LmzaPackage_DoWork;
            //lmzaPackage.RunWorkerAsync();
        }

        private void LmzaPackage_DoWork(object sender, DoWorkEventArgs e)
        {
            using (LMZAParser parser = new LMZAParser())
            {
                try
                {
                    exitCode = parser.MakePackage(
                        Path.GetFileName(StoreCfg.backupDst),
                        Path.GetDirectoryName(StoreCfg.backupSrc),
                        Path.GetDirectoryName(StoreCfg.backupDst),
                        StoreCfg.compressionLvl,
                        "",
                        false);
                }
                catch (Exception)
                {

                    throw;
                }
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {

        }
    }
}
