From 14b2896523a6b26d70e6afc1ef3f2e932e1d909a Mon Sep 17 00:00:00 2001 From: WoobieGames Date: Tue, 5 Jan 2021 14:40:11 -0300 Subject: [PATCH] Used switch/case intead of else if(thanks d4sein) --- SteamCMD Hub/Program.cs | 76 +++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/SteamCMD Hub/Program.cs b/SteamCMD Hub/Program.cs index 1e038f4..8834882 100644 --- a/SteamCMD Hub/Program.cs +++ b/SteamCMD Hub/Program.cs @@ -63,51 +63,47 @@ static void Main(string[] args) Console.WriteLine("Choice:"); string choice = Console.ReadLine(); - if (choice=="1") { - Process steamcmd = new Process(); - steamcmd.StartInfo.FileName = Environment.CurrentDirectory + @"\SteamCMD\steamcmd.exe"; - steamcmd.StartInfo.Arguments = "+runscript steamcmd.script"; - steamcmd.Start(); - return; - } - else if (choice=="2") { - Process steamcmd = new Process(); - steamcmd.StartInfo.FileName = Environment.CurrentDirectory + @"\SteamCMD\steamcmd.exe"; - //steamcmd.StartInfo.Arguments = "+runscript steamcmd.script"; - steamcmd.Start(); - return; - } - else if (choice == "3") + switch (choice) { - Console.WriteLine("What's your username?"); - string name = Console.ReadLine(); - Console.WriteLine("What's your password"); - string pass = Console.ReadLine(); - Console.WriteLine("What's your steam guard pin?"); - string pin = Console.ReadLine(); - Process steamcmd = new Process(); - steamcmd.StartInfo.FileName = Environment.CurrentDirectory + @"\SteamCMD\steamcmd.exe"; - steamcmd.StartInfo.Arguments = "+login " + name + " " + pass + " " + pin; - steamcmd.Start(); + case "1": + Process steamcmd = new Process(); + steamcmd.StartInfo.FileName = Environment.CurrentDirectory + @"\SteamCMD\steamcmd.exe"; + steamcmd.StartInfo.Arguments = "+runscript steamcmd.script"; + steamcmd.Start(); return; - } - else if (choice=="4") - { - Process steamcmd = new Process(); - steamcmd.StartInfo.FileName = "notepad.exe"; - steamcmd.StartInfo.Arguments = Environment.CurrentDirectory + @"\SteamCMD\steamcmd.script"; - steamcmd.Start(); + case "2": + Process steamcmd2 = new Process(); + steamcmd2.StartInfo.FileName = Environment.CurrentDirectory + @"\SteamCMD\steamcmd.exe"; + //steamcmd.StartInfo.Arguments = "+runscript steamcmd.script"; + steamcmd2.Start(); return; - } - else if(choice=="5") - { + case "3": + Console.WriteLine("What's your username?"); + string name = Console.ReadLine(); + Console.WriteLine("What's your password"); + string pass = Console.ReadLine(); + Console.WriteLine("What's your steam guard pin?"); + string pin = Console.ReadLine(); + Process steamcmd3 = new Process(); + steamcmd3.StartInfo.FileName = Environment.CurrentDirectory + @"\SteamCMD\steamcmd.exe"; + steamcmd3.StartInfo.Arguments = "+login " + name + " " + pass + " " + pin; + steamcmd3.Start(); return; - } - else - { - Console.WriteLine("That's not an option! >//<"); - Console.ReadKey(); + case "4": + Process steamcmd4 = new Process(); + steamcmd4.StartInfo.FileName = "notepad.exe"; + steamcmd4.StartInfo.Arguments = Environment.CurrentDirectory + @"\SteamCMD\steamcmd.script"; + steamcmd4.Start(); + return; + case "5": + + return; + + default: + Console.WriteLine("That's not an option! >//<"); + Console.ReadKey(); return; + } } }