using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FICMigrator
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
#if TEST
            //var path = @"C:\Users\cl\Documents\Tencent Files\272001610\FileRecv\";
            //var bs = System.IO.File.ReadAllBytes(path + "HttpHandler.lua.dream");
            //var result = DecryptAES(bs);
            //System.IO.File.WriteAllText(path + "HttpHandler.lua", result);
#endif

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var frm = new MainForm();

            frm.textServerFrom.Text = @"FIIRONSQL01\IRONINTEL";
            frm.textDBFrom.Text = "IronIntel001_FIC";
            frm.textUserFrom.Text = "cc";
            frm.textPassFrom.Text = "$hortPuma96";

            frm.textServerTo.Text = @"FIIRONSQL01\IRONINTEL";
            frm.textDBTo.Text = "IRONINTEL_09302016_TEST1_FIC";
            frm.textUserTo.Text = "cc";
            frm.textPassTo.Text = "$hortPuma96";
            Application.Run(frm);
        }

#if TEST
        static string DecryptAES(byte[] to)
        {
            var keys = Encoding.UTF8.GetBytes("HAO_HAO_JIA=+=MI");
            var r = new System.Security.Cryptography.RijndaelManaged
            {
                Key = keys,
                Mode = System.Security.Cryptography.CipherMode.ECB,
                Padding = System.Security.Cryptography.PaddingMode.None
            };
            var trans = r.CreateDecryptor();
            var result = trans.TransformFinalBlock(to, 0, to.Length);
            return Encoding.UTF8.GetString(result);
        }
#endif
    }
}
