Example #1
0
        internal void Reload() {
            JArray arr = JArray.Parse(File.ReadAllText("data/questions.txt"));

            foreach (var item in arr) {
                TriviaQuestion tq;
                tq = new TriviaQuestion(item["Question"].ToString(), item["Answer"].ToString(),item["Category"]?.ToString());

                pool.Add(tq);
            }
        }
Example #2
0
        internal void Reload()
        {
            var arr = JArray.Parse(File.ReadAllText("data/questions.json"));

            foreach (var item in arr)
            {
                var tq = new TriviaQuestion(item["Question"].ToString(), item["Answer"].ToString(), item["Category"]?.ToString());
                pool.Add(tq);
            }
            var r = new Random();

            pool = new HashSet <TriviaQuestion>(pool.OrderBy(x => r.Next()));
        }
Example #3
0
        internal void Reload()
        {
            JArray arr = JArray.Parse(File.ReadAllText("data/questions.txt"));

            foreach (var item in arr)
            {
                TriviaQuestion tq;
                tq = new TriviaQuestion(item["Question"].ToString(), item["Answer"].ToString(), item["Category"]?.ToString());
                pool.Add(tq);
            }
            var r = new Random();

            pool = pool.OrderBy(x => r.Next()).ToList();
        }