Example #1
0
        private bool excludeFriends = true; // TODO: add functionality to exclude the users on your friend list from gameplay

        public QuizDuellBot()
        {
            Console.WriteLine("Loading Config File.");
            //config = QuizDuellConfig.LoadFromFile("config.json");
            //config = QuizDuellConfig.LoadFromFile("ios-config.json");
            config = QuizDuellConfig.LoadFromFile("apk-config.json");
            client = new QuizDuellApi(config);
            result = new JObject();
        }
        // TODO: Add Exception Handling + using Statements
        public static void SaveToFile(QuizDuellConfig config, string configFile = "config.json")
        {
            // Update the AuthCookie before serilization since we will lose all data in the CookieContainer during Serialization
            Uri cookieDomain = new Uri("https://" + config.Host);
            var cookieCollection = config.Cookies.GetCookies(cookieDomain);
            if (cookieCollection.Count > 0) { config.AuthCookie = cookieCollection[0]; }

            string json = JsonConvert.SerializeObject(config, Formatting.Indented);
            File.WriteAllText(configFile, json);
        }
Example #3
0
 public QuizDuellApi(QuizDuellConfig config)
 {
     // TODO: Refactor the Properties so that they just wrap an instance of the config class.
     // NOTE: This way we can deserialize the config file at the end of program run and the user of the api does not have to deal with that.  --- Think about this first, does it make sense that the api deals with deserializisation of the config file?
     Host = config.Host;
     Salt = config.Salt;
     Key = config.Key;
     UserAgent = config.UserAgent;
     Plattform = config.Plattform;
     Cookies = config.Cookies;
     Client = new RestClient(UserAgent, Cookies);
     random = new Random();
 }
Example #4
0
 public QuizDuellApi(QuizDuellConfig config)
 {
     // TODO: Refactor the Properties so that they just wrap an instance of the config class.
     // NOTE: This way we can deserialize the config file at the end of program run and the user of the api does not have to deal with that.  --- Think about this first, does it make sense that the api deals with deserializisation of the config file?
     Host      = config.Host;
     Salt      = config.Salt;
     Key       = config.Key;
     UserAgent = config.UserAgent;
     Plattform = config.Plattform;
     Cookies   = config.Cookies;
     Client    = new RestClient(UserAgent, Cookies);
     random    = new Random();
 }
Example #5
0
        // TODO: Add Exception Handling + using Statements
        public static void SaveToFile(QuizDuellConfig config, string configFile = "config.json")
        {
            // Update the AuthCookie before serilization since we will lose all data in the CookieContainer during Serialization
            Uri cookieDomain     = new Uri("https://" + config.Host);
            var cookieCollection = config.Cookies.GetCookies(cookieDomain);

            if (cookieCollection.Count > 0)
            {
                config.AuthCookie = cookieCollection[0];
            }

            string json = JsonConvert.SerializeObject(config, Formatting.Indented);

            File.WriteAllText(configFile, json);
        }
        public void Initialize()
        {
            // Initalize the base config
            config = new QuizDuellConfig();
            config.Host = "qkgermany.feomedia.se";
            config.Plattform = QuizDuellPlattform.ANDROID;
            config.UserAgent = "Quizduell A 1.3.2";
            config.Cookies = new CookieContainer();

            // MD5-SALT - Different per Country/Plattform
            // qkgermany: SQ2zgOTmQc8KXmBP
            config.Salt = "SQ2zgOTmQc8KXmBP";

            // NOTE: Quizduell uses different HMAC Keys for different locales.
            // IOS: 7GprrSCirEToJjG5
            // APK: irETGpoJjG57rrSC
            if (config.Plattform == QuizDuellPlattform.ANDROID) { config.Key = "irETGpoJjG57rrSC"; }
            if (config.Plattform == QuizDuellPlattform.IOS) { config.Key = "7GprrSCirEToJjG5"; }

            target = new QuizDuellApi(config);
        }