예제 #1
0
        private static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Console.CancelKeyPress += Console_CancelKeyPress;

            BsonMapper.Global = new BsonMapper(null, new AssemblyNameTypeNameBinder());

            var dirs = new[]
            {
                "plugins",
                "logs",
                "data",
                "config"
            }.Select(x => Path.Combine(Environment.CurrentDirectory, x));

            foreach (var dir in dirs)
            {
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
            }

            var app = new HyperaiApplicationBuilder();

            app.UseStartup <Bootstrapper>();
            LoadPackages().Wait();
            SearchConfigurePluginServices(app);
            Shared.Application = app.Build();
            _logger            = Shared.Application.Provider.GetRequiredService <ILoggerFactory>().CreateLogger("Program");
            ConfigurePlugins(Shared.Application);
            Shared.Application.Run();
        }
예제 #2
0
        private static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Console.CancelKeyPress += Console_CancelKeyPress;

            BsonMapper.Global = new BsonMapper(null, new AssemblyNameTypeNameBinder());

            System.Collections.Generic.IEnumerable <string> dirs = new string[]
            {
                "plugins",
                "logs",
                "data",
                "config"
            }.Select(x => Path.Combine(Environment.CurrentDirectory, x));
            foreach (string dir in dirs)
            {
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
            }

            HyperaiApplicationBuilder app = new HyperaiApplicationBuilder();

            app.UseStartup <Bootstrapper>();
            FuckUnitTestButMyGuidelineTellMeItIsRequiredInHugeProjectsSoHaveToKeepItBYWSomeTestsMayNotWorkAndMissing(app).Wait();
            NothingToSay(app);
            Shared.Application = app.Build();
            logger             = Shared.Application.Provider.GetRequiredService <ILoggerFactory>().CreateLogger("Program");
            MakeItWork(Shared.Application);
            Shared.Application.Run();
        }