Exemplo n.º 1
0
        public StatusMessage StartGame(int id, bool install = false)
        {
            StatusMessage returnMessage = new StatusMessage();

            string baseURL     = ConfigurationManager.AppSettings["BaseURL"];
            string computerKey = ConfigurationManager.AppSettings["ComputerKey"];
            string secretKey   = ConfigurationManager.AppSettings["Secret"];

            encryption = new Encryption(secretKey);

            string    URL  = $"{baseURL}/game/checkout/{id}";
            SteamGame game = gc.GetSteamLogin(id, URL, computerKey, "");

            returnMessage.message = game.message;
            returnMessage.status  = game.status;

            if (game.status == "ok")
            {
                game.password          = encryption.Decrypt(game.password);
                LauncherInfo.isInstall = install;
                LauncherInfo.StartGame(game);

                gc.StartSteam(LauncherInfo.game);
            }
            return(returnMessage);
        }
Exemplo n.º 2
0
        public string StartGame(int id)
        {
            string baseURL     = ConfigurationManager.AppSettings["BaseURL"];
            string computerKey = ConfigurationManager.AppSettings["ComputerKey"];

            string    URL  = $"{baseURL}/game/checkout/{id}";
            SteamGame game = gc.GetSteamLogin(id, URL, computerKey, "");

            if (game.status == "ok")
            {
                LauncherInfo.StartGame(game);

                gc.StartSteam(LauncherInfo.game);
            }
            return(game.status);
        }
Exemplo n.º 3
0
        public StatusMessage StartGame(int id, bool install = false)
        {
            StatusMessage returnMessage = new StatusMessage();

            string baseURL     = ConfigurationManager.AppSettings["BaseURL"];
            string computerKey = ConfigurationManager.AppSettings["ComputerKey"];
            string secretKey   = ConfigurationManager.AppSettings["Secret"];

            // We must decrypt the secret key using the machine key
            //machineKeyEncryption = new Encryption("the machine key");
            try
            {
                secretKey = MachineKeyEncryption.UnProtect(secretKey, $"Secret for computer {computerKey}");
            }
            catch (Exception e)
            {
                MessageBox.Show($"Error: Unable to load settings. Contact an administrator.\n\n{e.Message}");
                throw;
            }

            // Then, we can Encrypt/Decrypt using that decrypted secret key
            encryption = new Encryption(secretKey);

            string    URL  = $"{baseURL}/game/checkout/{id}";
            SteamGame game = gc.GetSteamLogin(id, URL, computerKey, "");

            returnMessage.message = game.message;
            returnMessage.status  = game.status;

            if (game.status == "ok")
            {
                game.password          = encryption.Decrypt(game.password);
                LauncherInfo.isInstall = install;
                LauncherInfo.StartGame(game);

                gc.StartSteam(LauncherInfo.game);
            }
            return(returnMessage);
        }