コード例 #1
0
        private void CredentialsForm_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(steamAccount.SteamFolder))
            {
                if (Environment.Is64BitOperatingSystem && File.Exists(@"C:\Program Files (x86)\Steam\Steam.exe"))
                {
                    txtSteamFolder.Text = @"c:\Program Files (x86)\Steam\Steam.exe";
                }
                else if (!Environment.Is64BitOperatingSystem && File.Exists(@"C:\Program Files\Steam\Steam.exe"))
                {
                    txtSteamFolder.Text = @"c:\Program Files\Steam\Steam.exe";
                }
            }
            else
            {
                txtSteamFolder.Text = steamAccount.SteamFolder;
            }

            txtUsername.Text = steamAccount.Username;

            var decrypted = CryptoProvider.Decrypt(steamAccount.Password, steamAccount.Key);

            txtPassword1.Text = decrypted;
            txtPassword2.Text = decrypted;
        }
コード例 #2
0
ファイル: Launcher.cs プロジェクト: jrnijboer/SteamTools
        static void RunSteam(SteamAccount steamAccount)
        {
            try
            {
                HttpWebRequest w = WebRequest.Create("http://localhost:8088/steam/" + Environment.UserName.ToLower() + "/stop") as HttpWebRequest;

                var response = w.GetResponse();

                using (Stream s = response.GetResponseStream())
                    using (StreamReader readStream = new StreamReader(s, Encoding.UTF8))
                    {
                        string responsestring = readStream.ReadToEnd();
                        if (responsestring.StartsWith("steam stopped") || responsestring.ToLower() == "steam not running")
                        {
                            ProcessStartInfo info = new ProcessStartInfo();
                            info.FileName               = steamAccount.SteamFolder;
                            info.CreateNoWindow         = true;
                            info.UseShellExecute        = false;
                            info.RedirectStandardError  = true;
                            info.RedirectStandardInput  = true;
                            info.RedirectStandardOutput = true;
                            var decryptedPassword = CryptoProvider.Decrypt(steamAccount.Password, steamAccount.Key);
                            info.Arguments = "-login " + steamAccount.Username + " " + decryptedPassword;
                            Process.Start(info);
                        }
                        else
                        {
                            ProcessStartInfo info = new ProcessStartInfo();
                            info.FileName               = steamAccount.SteamFolder;
                            info.CreateNoWindow         = true;
                            info.UseShellExecute        = false;
                            info.RedirectStandardError  = true;
                            info.RedirectStandardInput  = true;
                            info.RedirectStandardOutput = true;
                            Process.Start(info);
                        }
                    }
            }

            catch (Exception e)
            {
                MessageBox.Show("Unable to launch steam, check if the SteamStopperService is running. The unfriendly error message is: " + e.Message);
            }
        }