Beispiel #1
0
        private async Task Run(string[] args)
        {
            /*  using (var db = new Context())
             * {
             *    db.Database.CreateIfNotExists();
             *    var user = new User() { UserID = 00001010101010, Characters = "oof", IsMuted = false, MutedRoles = "test" };
             *    db.Users.Add(user);
             *    db.SaveChanges();
             * }*/

            if (args.Any())
            {
                RPClass.Restarted = true;
            }
            RPClass.LoadData();
            var cfg  = new Config();
            var json = string.Empty;

            if (File.Exists("config.json"))
            {
                json = File.ReadAllText("config.json", new UTF8Encoding(false));
            }
            else if (File.Exists("../../config.json"))
            {
                json = File.ReadAllText("../../config.json", new UTF8Encoding(false));
            }
            else
            {
                json = JsonConvert.SerializeObject(cfg);
                File.WriteAllText("config.json", json, new UTF8Encoding(false));
                Console.WriteLine("Config file was not found, a new one was generated. Fill it with proper values and rerun this program");
                Console.ReadKey();

                return;
            }

            cfg = JsonConvert.DeserializeObject <Config>(json);

            var tskl = new List <Task>();

            for (var i = 0; i < cfg.ShardCount; i++)
            {
                var bot = new RPBot(cfg, i);
                tskl.Add(bot.RunAsync());
                await Task.Delay(7500);
            }

            await Task.WhenAll(tskl);

            await Task.Delay(-1);
        }
Beispiel #2
0
        private async Task Run(string[] args)
        {
            //File.WriteAllText("test.txt", WikiTests.CreateInfoBox(new InfoBoxObject("jeff", "the slayer", "no<br>maybe<br>perhaps", "gay", "Single", 25, "23/02/2000", "North Pier", "South Pier", "Human", "Male", "182cm", "70kg", "Bright Blue", "Hot pink", new string[] { "Image 1", "Image 2", "Image 3" }, new string[] { "https://cdn.discordapp.com/attachments/447483115250909184/473256482616508436/image.jpg", "https://cdn.discordapp.com/attachments/447483115250909184/473257220813881344/image.jpg", "https://cdn.discordapp.com/attachments/455019174385942530/472809787780759562/a7a1c3d8cffc5dff31021d5cfd3a135f.png" })));
            if (args.Any())
            {
                RPClass.Restarted = true;
            }
            RPClass.LoadData();
            var cfg  = new Config();
            var json = string.Empty;

            if (File.Exists("config.json"))
            {
                json = File.ReadAllText("config.json", new UTF8Encoding(false));
            }
            else if (File.Exists("../../config.json"))
            {
                json = File.ReadAllText("../../config.json", new UTF8Encoding(false));
            }
            else
            {
                json = JsonConvert.SerializeObject(cfg);
                File.WriteAllText("config.json", json, new UTF8Encoding(false));
                Console.WriteLine("Config file was not found, a new one was generated. Fill it with proper values and rerun this program");
                Console.ReadKey();

                return;
            }

            cfg = JsonConvert.DeserializeObject <Config>(json);

            var tskl = new List <Task>();

            for (var i = 0; i < cfg.ShardCount; i++)
            {
                var bot = new RPBot(cfg, i);
                tskl.Add(bot.RunAsync());
                await Task.Delay(7500);
            }

            await Task.WhenAll(tskl);

            await Task.Delay(-1);
        }