Пример #1
0
        private void CheckDump(EmptyStickeredDatabase db)
        {
            HashSet <Tuple <long, long> > temp = db.unstickeredCache;

            Assert.IsTrue(db.LoadFromArray(db.Dump()));
            Assert.AreEqual(temp, db.unstickeredCache);
            Assert.IsTrue(
                db.LoadFromArray(
                    BinarySerialization.NS.Deserialize <string[]>(
                        BinarySerialization.NS.Serialize(db.Dump()))));
            Assert.AreEqual(temp, db.unstickeredCache);
            Assert.IsTrue(
                db.LoadFromArray(
                    BinarySerialization.NS.Deserialize <string[]>(
                        BinarySerialization.NS.Serialize(db.Dump(), true), true)));
            Assert.AreEqual(temp, db.unstickeredCache);
        }
Пример #2
0
 private void Init()
 {
     try
     {
         unstickeredCache.LoadFromArray(File.ReadAllLines(Path.Combine("assets", "emptystickered.txt")));
     } catch {
     }
     ReloadConfig();
     Task.Run((Action)BackgroundCheck);
     Task.Run((Action)UnstickeredDumper);
 }
Пример #3
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}");
            }
        }