Пример #1
0
        static Db()
        {
            var path = "C:\\Users\\admin\\Documents\\pfwdb.txt";

            //TODO save default path for dev purposes

            while (!File.Exists(path))
            {
                Console.WriteLine("Db connection string file not found, add path to file (will crash if no file): ");
                path = Console.ReadLine();
            }
            Console.WriteLine("Found db file in => " + path);
            string conStr = File.ReadAllText(path);

            Task.Run(delegate {
                while (true)
                {
                    Task.Delay(10000).Wait();
                    OnlinePlayers.DeleteManyAsync(x => x.LastOnline < DateTime.UtcNow - TimeSpan.FromSeconds(15));
                }
            });
        }