Exemplo n.º 1
0
 public void Initialize()
 {
     logger.Info("Initializing core");
     InitializeEndpoints();
     httpListener.Start();
     VK.Init();
     logger.Success("Started serving");
     tokenSource = new CancellationTokenSource();
     ct          = tokenSource.Token;
     listener    = Task.Factory.StartNew(Listen, ct);
 }
Exemplo n.º 2
0
        public Core(int port = 4345)
        {
            try {
                server = new HttpListener();
                logger = new NewMarketLogger("Core");
                server.Prefixes.Add($"http://+:{port}/");
                Init();
                VK.Init();

                unstickeredCache = new EmptyStickeredDatabase();
                unstickeredCache.LoadFromArray(File.ReadAllLines(Path.Combine("assets", "emptystickered.txt")));

                logger.Nothing("Starting!");
                ReloadConfig();
                server.Start();
                logger.Nothing("Started!");
                Task.Run((Action)Listen);
                Task.Run((Action)BackgroundCheck);
                Task.Run((Action)UnstickeredDumper);
                //Task.Run((Action)DBHitProvider);
            } catch (Exception ex) {
                logger.Crash($"Message: {ex.Message}. Trace: {ex.StackTrace}");
            }
        }