Code:
using System;
using System****;
using System.Diagnostics;
using System.Windows.Forms;
using System.Drawing;
using Microsoft.Win32;
using System.Text;
using System.Net;
using System****.Compression;
using IWshRuntimeLibrary;
using MetroFramework;
using System.Data;
using System.Runtime.InteropServices;
using System.Reflection;
namespace Steam_Account_Manager
{
public partial class form_main : MetroFramework.Forms.MetroForm
{
// Main Form
public form_main()
{
this.ShowInTaskbar = true;
InitializeComponent();
ListAccounts.Items.Clear();
read_settings();
}
// Encrypting and Decrypting
// Kill Steam.exe Process
void kill_steam()
{
try
{
Process[] proc = Process.GetProcessesByName("Steam");
proc[0].Kill();
listBox1.Items.Add(" - Killed Steam.exe Process");
}
catch { }
}
//Log Into Steam
void login_steam(string steam_location, string username, string password)
{
Process.Start(steam_location, " -login " + username + " " + base64_decode(password));
listBox1.Items.Add(" - Attempted Steam Login Under Account Name '" + username + "'");
}
//Write Settings
public void write_settings()
{
string output = "";
foreach (ListViewItem item in ListAccounts.Items)
{
for (int i = 0; i < item.SubItems.Count; i++)
output += item.SubItems[i].Text.Replace("|", "/") + "|";
output += Environment.NewLine;
}
System****.File.WriteAllText(Properties.Settings.D efault.AccountLocation + "/SasData.dat", output);
listBox1.Items.Add(" - Wrote Settings");
}
// Read Settings File
public void read_settings()
{
ListAccounts.Items.Clear();
if (!System****.File.Exists(Properties.Settings.Defau lt.AccountLocation + "/SasData.dat"))
return;
var file = new StreamReader(Properties.Settings.Default.AccountLo cation + "/SasData.dat");
string line;
while ((line = file.ReadLine()) != null)
{
string[] data = line.Split('|');
var item = new ListViewItem(data);
ListAccounts.Items.Add(item);
}
file.Close();
listBox1.Items.Add(" - Read Settings");
}
// Clear Files
public void ClearFiles()
{
if (System****.File.Exists(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/SasData.dat"))
{
System****.File.Delete(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/SasData.dat");
}
if (System****.File.Exists(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/ExportedLog.txt"))
{
System****.File.Delete(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/ExportedLog.txt");
}
if (System****.File.Exists(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/MetroCustomize.exe"))
{
System****.File.Delete(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/MetroCustomize.exe");
}
if (System****.File.Exists(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/MetroCustomize.zip"))
{
System****.File.Delete(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/MetroCustomize.zip");
}
if (System****.File.Exists(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/SteamAccountQuickLaunch.exe"))
{
System****.File.Delete(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/SteamAccountQuickLaunch.exe");
}
if (System****.File.Exists(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/SteamAccountQuickLaunch.zip"))
{
System****.File.Delete(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/SteamAccountQuickLaunch.zip");
}
if (System****.File.Exists(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/MetroFramework.dll"))
{
System****.File.Delete(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/MetroFramework.dll");
}
if (System****.File.Exists(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/MetroFramework.zip"))
{
System****.File.Delete(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/MetroFramework.zip");
}
if (System****.Directory.Exists(Environment.GetFolder Path(Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/"))
{
System****.Directory.Delete(Environment.GetFolderP ath(Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/");
}
listBox1.Items.Add(" - Cleared Files");
}
// Create Files
public void CreateFiles()
{
System****.Directory.CreateDirectory(Environment.G etFolderPath(Environment.SpecialFolder.MyDocuments ) + "/SteamAccountManager/");
System****.File.Create(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/SasData.dat");
System****.File.Create(Environment.GetFolderPath(E nvironment.SpecialFolder.MyDocuments) + "/SteamAccountManager/ExportedLog.txt");
listBox1.Items.Add(" - Created Files");
}
// Dark Theme
public void Darktheme()
{
metroLabel2.Theme = MetroThemeStyle.Dark;
metroLabel3.Theme = MetroThemeStyle.Dark;
metroLabel4.Theme = MetroThemeStyle.Dark;
metroLabel12.Theme = MetroThemeStyle.Dark;
metroLabel10.Theme = MetroThemeStyle.Dark;
metroLabel12.Theme = MetroThemeStyle.Dark;
metroLabel10.Theme = MetroThemeStyle.Dark;
metroLabel11.Theme = MetroThemeStyle.Dark;
metroLabel16.Theme = MetroThemeStyle.Dark;
metroToolTip1.Theme = MetroThemeStyle.Dark;
this.Theme = MetroThemeStyle.Dark;
metroTabControl1.Theme = MetroThemeStyle.Dark;
metroTabPage1.Theme = MetroThemeStyle.Dark;
metroTabPage4.Theme = MetroThemeStyle.Dark;
metroTabPage3.Theme = MetroThemeStyle.Dark;
ListAccounts.BackColor = Color.FromArgb(17, 17, 17);
ListAccounts.ForeColor = Color.White;
listBox1.BackColor = Color.FromArgb(17, 17, 17);
listBox1.ForeColor = Color.White;
Refresh();
}
// Light Theme
public void LightTheme()
{
metroLabel2.Theme = MetroThemeStyle.Light;
metroLabel3.Theme = MetroThemeStyle.Light;
metroLabel4.Theme = MetroThemeStyle.Light;
metroLabel12.Theme = MetroThemeStyle.Light;
metroLabel10.Theme = MetroThemeStyle.Light;
metroLabel12.Theme = MetroThemeStyle.Light;
metroLabel11.Theme = MetroThemeStyle.Light;
metroLabel16.Theme = MetroThemeStyle.Light;
metroLabel10.Theme = MetroThemeStyle.Light;
metroToolTip1.Theme = MetroThemeStyle.Light;
this.Theme = MetroThemeStyle.Light;
metroTabControl1.Theme = MetroThemeStyle.Light;
metroTabPage1.Theme = MetroThemeStyle.Light;
metroTabPage3.Theme = MetroThemeStyle.Light;
metroTabPage4.Theme = MetroThemeStyle.Light;
ListAccounts.BackColor = Color.White;
ListAccounts.ForeColor = Color.Black;
listBox1.BackColor = Color.White;
listBox1.ForeColor = Color.Black;
Refresh();
}
// Apply Theme
public void ApplyTheme()
{
if (Properties.Settings.Default.Theme == "Dark")
{
Darktheme();
}
if (Properties.Settings.Default.Theme == "Light")
{
LightTheme();
}
}
// Load Form
void MainFormLoad(object sender, System.EventArgs e)
{
ApplyTheme();
ApplyStyle();
metroTabControl1.SelectedTab = metroTabPage1;
string version = Assembly.GetExecutingAssembly().GetName().Version. ToString();
metroLabel4.Text = "Build " + version;
this.ShowInTaskbar = true;
listBox1.Items.Clear();
listBox1.Items.Add("| Steam Account Manager Activity Log |");
listBox1.Items.Add(" Build " + version);
listBox1.Items.Add(" Date " + DateTime.Now);
listBox1.Items.Add(" ");
read_settings();
pictureBox1.Image = Properties.Resources.SelectAccount;
if (Properties.Settings.Default.FirstUse1 == true)
{
Properties.Settings.Default.FirstUse1 = false;
this.TopMost = false;
var FirstUse = new FirstUse();
if (FirstUse.ShowDialog(this) == DialogResult.OK)
{
Properties.Settings.Default.AccountLocation = Environment.GetFolderPath(Environment.SpecialFolde r.MyDocuments) + "/SteamAccountManager";
Properties.Settings.Default.SteamLocation = @"C:\Program Files (x86)\Steam\Steam.exe";
Properties.Settings.Default.Save();
ApplyTheme();
ApplyStyle();
read_settings();
listBox1.Items.Add(" - Successfully Executed First Launch");
this.TopLevel = true;
}
}
}
// Steam Login
void LoginToolStripMenuItemClick(object sender, System.EventArgs e)
{
if (ListAccounts.SelectedItems.Count == 1)
{
foreach (var process in Process.GetProcessesByName("Steam.exe"))
{
process.Kill();
}
ListAccounts.SelectedItems[0].SubItems[2].Text = DateTime.Now.ToString("dd/MM/yyyy");
kill_steam();
login_steam(Properties.Settings.Default.SteamLocat ion, ListAccounts.SelectedItems[0].SubItems[0].Text, ListAccounts.SelectedItems[0].SubItems[1].Text);
}
write_settings();
if(Properties.Settings.Default.CloseCheck == true)
{
this.Close();
}
}
// Add Account
void AddAccountToolStripMenuItemClick(object sender, System.EventArgs e)
{
var form_account = new form_account();
if (form_account.ShowDialog(this) == DialogResult.OK)
{
string[] row = { form_account.username, base64_encode(form_account.password), "", form_account.account };
var item = new ListViewItem(row);
ListAccounts.Items.Add(item);
write_settings();
listBox1.Items.Add(" - Added Account " + form_account.username);
this.TopMost = true;
this.TopMost = false;
}
this.TopMost = true;
this.TopMost = false;
}
// Delete Accout
void DeleteToolStripMenuItemClick(object sender, System.EventArgs e)
{
foreach (ListViewItem item in ListAccounts.SelectedItems)
{
item.Remove();
listBox1.Items.Add(" - Removed " + ListAccounts.SelectedItems);
metroLabel10.Text = "Username: Waiting...";
metroLabel11.Text = "Last Login: Waiting...";
metroLabel12.Text = "Password: Waiting...";
metroTile2.Enabled = false;
pictureBox1.Image = Properties.Resources.SelectAccount;
}
write_settings();
}
// shut down steam.exe
void ShutdownSteamToolStripMenuItemClick(object sender, System.EventArgs e)
{
kill_steam();
listBox1.Items.Add(" - Stopped Steam.exe process");
}
// Close
public void ApplyStyle()
{
this.Style = Properties.Settings.Default.Style;
metroTabControl1.Style = Properties.Settings.Default.Style;
metroLabel2.Style = Properties.Settings.Default.Style;
metroLabel3.Style = Properties.Settings.Default.Style;
metroLabel4.Style = Properties.Settings.Default.Style;
metroLabel12.Style = Properties.Settings.Default.Style;
metroLabel10.Style = Properties.Settings.Default.Style;
metroLabel11.Style = Properties.Settings.Default.Style;
metroLabel16.Style = Properties.Settings.Default.Style;
metroTile2.Style = Properties.Settings.Default.Style;
metroTile5.Style = Properties.Settings.Default.Style;
metroTile6.Style = Properties.Settings.Default.Style;
metroTile7.Style = Properties.Settings.Default.Style;
metroTile8.Style = Properties.Settings.Default.Style;
}
// MetroStyleApply
public void MetroStyleApply()
{
this.Style = msmMain.Style;
metroTabControl1.Style = msmMain.Style;
metroLabel2.Style = msmMain.Style;
metroLabel3.Style = msmMain.Style;
metroLabel4.Style = msmMain.Style;
metroLabel12.Style = msmMain.Style;
metroLabel16.Style = msmMain.Style;
metroLabel11.Style = msmMain.Style;
metroLabel10.Style = msmMain.Style;
metroTile2.Style = msmMain.Style;
metroTile5.Style = msmMain.Style;
metroTile6.Style = msmMain.Style;
metroTile7.Style = msmMain.Style;
metroTile8.Style = msmMain.Style;
Refresh();
Properties.Settings.Default.Style = msmMain.Style;
Properties.Settings.Default.Save();
}
// Save Log
private void metroTile5_Click(object sender, EventArgs e)
{
try
{
System****.StreamWriter SaveFile = new System****.StreamWriter(Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments) + "/SteamAccountManager/ExportedLog.txt");
foreach (var item in listBox1.Items)
{
SaveFile.WriteLine(item);
}
SaveFile.Close();
MetroMessageBox.Show(this, "Log Successfully Exported!", "Steam Account Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch
{
MetroMessageBox.Show(this, "There was an error exporting the log!", "Steam Account Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
// Message Spam Launch
private void metroTile6_Click(object sender, EventArgs e)
{
Skype frm = new Skype();
frm.Show();
}
// Disco Timer
private void timer1_Tick(object sender, EventArgs e)
{
var m = new Random();
int next = m.Next(0, 14);
msmMain.Style = (MetroColorStyle)next;
MetroStyleApply();
Refresh();
}
// Change Selected Account
private void ListAccounts_SelectedIndexChanged(object sender, EventArgs e)
{
GetInfo();
}
// Get ListAccounts Info
void GetInfo()
{
if (ListAccounts.SelectedItems.Count > 0)
{
if (ListAccounts.SelectedItems[0].SubItems[3].Text == "Main")
{
pictureBox1.Image = Properties.Resources.MainBig;
}
if (ListAccounts.SelectedItems[0].SubItems[3].Text == "Smurf")
{
pictureBox1.Image = Properties.Resources.SmurfBig;
}
if (ListAccounts.SelectedItems[0].SubItems[3].Text == "Other")
{
pictureBox1.Image = Properties.Resources.OtherBig;
}
metroLabel10.Text = "Username: " + ListAccounts.SelectedItems[0].SubItems[0].Text;
metroLabel12.Text = "Password: " + ListAccounts.SelectedItems[0].SubItems[1].Text;
metroLabel11.Text = "Last Login: " + ListAccounts.SelectedItems[0].SubItems[2].Text;
metroTile2.Enabled = true;
}
else
{
metroTile2.Enabled = false;
}
}
// Login Button
private void metroTile2_Click(object sender, EventArgs e)
{
if (ListAccounts.SelectedItems.Count == 1)
{
foreach (var process in Process.GetProcessesByName("Steam.exe"))
{
process.Kill();
}
ListAccounts.SelectedItems[0].SubItems[2].Text = DateTime.Now.ToString("dd/MM/yyyy");
kill_steam();
login_steam(Properties.Settings.Default.SteamLocat ion, ListAccounts.SelectedItems[0].SubItems[0].Text, ListAccounts.SelectedItems[0].SubItems[1].Text);
}
write_settings();
if (Properties.Settings.Default.CloseCheck == true)
{
this.Close();
}
}
// Launch Game Commands
private void metroTile7_Click(object sender, EventArgs e)
{
GameCommands frm = new GameCommands();
frm.Show();
}
// Launch Injector
private void metroTile8_Click(object sender, EventArgs e)
{
if (Properties.Settings.Default.InjectorFirst == true)
{
Properties.Settings.Default.InjectorFirst = false;
MetroMessageBox.Show(this, "I am not responsible for what you do with this injector.", "Steam Account Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
Injector frm = new Injector();
frm.Show();
}
private void pictureBox2_Click(object sender, EventArgs e)
{
Settings frm2 = new Settings();
frm2.ShowDialog();
}
}
}