示例#1
0
        private static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            var sw = new Stopwatch();

            sw.Start();
            Console.CursorVisible = false;
            Cli.WriteHeader(Localization.Get("Title"), Localization.Get("Header"), ConsoleColor.Red);
            Cli.LoadingTitle();
            Logger.Progress(0, ProgressStep);

            //Logger Settings Up
            Logger.Archive = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Logs");
            Logger.LogFile = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Logs",
                                          "Comidat.log");
            Logger.Progress(1, ProgressStep);

            //Console commands activating
            var console = new ConsoleCommands();

            //Logger.Hide ^= LogLevel.Debug;
            Logger.Progress(2, ProgressStep);

            //Settings up server
            IServer server = new TCP();

            server.Connected       += ServerOnConnected;
            server.Disconnected    += ServerOnDisconnected;
            server.MessageReceived += ServerOnMessageReceived;
            server.StartAsync(new IPEndPoint(IPAddress.Any, 5757));
            Logger.Progress(3, ProgressStep);

            //Settings up Database
            //Global.Database.Database.Migrate();
            Logger.Progress(4, ProgressStep);

            //Seed TBLReaders for testing
            //Global.SeedReaders();
            //Global.SeedTags();
            //Global.Database.SaveChanges();
            Logger.Progress(5, ProgressStep);

            Global.LoadReaders();
            Logger.Progress(6, ProgressStep);

            //Global.SeedForTestFromFile();

            Logger.Progress(ProgressStep, ProgressStep);
            Logger.Info(Localization.Get("Comidat.Program.MainB.LoadingTime"), sw.ElapsedMilliseconds);
            sw.Stop();

            Cli.RunningTitle();

            //Test().Wait(0);

            Global.SaveDataBaseAync().Wait(0);

            console.Wait();
        }