using CommonLang.Property;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Helpers;
using System.Windows.Forms;
using XmdsCommonServer.Message;
using XmdsServerTest;
using XmdsServerTest.Server;

namespace XmdsServerTestLauncher
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        //[STAThread]
        static void Main()
        {
//             try
//             {
//                 var _zoneConfig = new Pomelo.ZoneConfig()
//                 {
//                     startPath = Application.StartupPath,
//                     assetPath = @"H:\projects\morefuntek\Xmds\GameEditors\GameEditor\data",
//                 };
//                 var _fastStreamConfig = new Pomelo.FastStreamConfig()
//                 {
//                     port = 13360,
//                 };
//                 var _logConfig = new Pomelo.LogConfig()
//                 {
//                     configFile = Application.StartupPath + @"\log4net.config",
//                     outputPath = Application.StartupPath,
//                 };
//                 var _iceConfig = new Pomelo.IceConfig()
//                 {
//                     host = "0.0.0.0",
//                     port = 13301,
//                 };
//                 var edge = new Pomelo.EdgeJS();
//                 edge.open(_zoneConfig, _logConfig, _iceConfig, _fastStreamConfig);
//                 while (Console.ReadLine() != "exit") { }
//                 edge.close();
//             }
//             catch (Exception err)
//             {
//                 Console.WriteLine(err.Message);
//             }
//             {
//                 ConsumeItemEventB2R e = new ConsumeItemEventB2R();
//                 e.playerId = "123";
//                 e.Reason = "abc";
//                 string json = Json.Encode(e);
//                 Console.WriteLine(json);
//             }
            Console.WriteLine("*************************************************");
            //ReflectionUtil.LoadDlls(new System.IO.DirectoryInfo(Application.StartupPath));
            NodeTestServer server = new NodeTestServer(new System.IO.DirectoryInfo("."));
            server.Start("127.0.0.1", 19999);
            Console.WriteLine("*************************************************");
            Console.WriteLine("* 启动完毕 ");
            Console.WriteLine("*************************************************");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormTest(server));

        }
    }
}