11using System ;
22using System . Diagnostics ;
3+ using System . IO ;
34using System . Security . Principal ;
45using System . Threading ;
56using Microsoft . Win32 ;
@@ -8,8 +9,9 @@ namespace DisableSearchBoxSuggestions
89{
910 internal class Program
1011 {
11- public static string version = "1.0 " ;
12+ public static string version = "1.1 " ;
1213 public static string githubLink = "https://github.com/KilLo445/DisableSearchBoxSuggestions" ;
14+ public static string changeLink = "https://github.com/KilLo445/DisableSearchBoxSuggestions/blob/main/Changelog.md" ;
1315
1416 public static string asciiArt = $@ "
1517 ,---, .--.--. ,---,. .--.--.
@@ -49,12 +51,23 @@ static void Main(string[] args)
4951 Console . WriteLine ( ) ;
5052 Console . WriteLine ( "--------------------------------------------------" ) ;
5153 Console . WriteLine ( ) ;
54+ foreach ( string arg in Environment . GetCommandLineArgs ( ) )
55+ {
56+ if ( arg == "-h" || arg == "-help" ) { Help ( ) ; PressAnyKeyToExit ( ) ; }
57+ if ( arg == "-1" || arg == "-d" || arg == "-dsbs" ) { DSBS ( ) ; PressAnyKeyToExit ( ) ; }
58+ if ( arg == "-2" || arg == "-e" || arg == "-esbs" ) { ESBS ( ) ; PressAnyKeyToExit ( ) ; }
59+ if ( arg == "-3" || arg == "-a" || arg == "-about" ) { AboutDSBS ( ) ; PressAnyKeyToExit ( ) ; }
60+ if ( arg == "-4" || arg == "-g" || arg == "-github" ) { Console . WriteLine ( "Opening GitHub..." ) ; Process . Start ( githubLink ) ; PressAnyKeyToExit ( ) ; }
61+ if ( arg == "-5" || arg == "-c" || arg == "-changes" || arg == "-changelog" ) { Console . WriteLine ( "Opening Changelog..." ) ; Process . Start ( changeLink ) ; PressAnyKeyToExit ( ) ; }
62+ if ( arg == "-v" || arg == "-ver" || arg == "-version" ) { Console . WriteLine ( $ "You have v{ version } installed") ; PressAnyKeyToExit ( ) ; }
63+ }
5264 Console . WriteLine ( "What would you like to do?" ) ;
5365 Console . WriteLine ( ) ;
5466 Console . WriteLine ( "[1] Disable Search Box Suggestions" ) ;
5567 Console . WriteLine ( "[2] Enable Search Box Suggestions" ) ;
5668 Console . WriteLine ( "[3] About DSBS" ) ;
5769 Console . WriteLine ( "[4] Open DSBS GitHub" ) ;
70+ Console . WriteLine ( "[5] Open DSBS Changelog" ) ;
5871 Console . WriteLine ( ) ;
5972 Console . Write ( "Enter choice: " ) ;
6073 string userInput = Console . ReadLine ( ) ;
@@ -64,11 +77,25 @@ static void Main(string[] args)
6477 if ( userInput == "1" ) { DSBS ( ) ; PressAnyKeyToExit ( ) ; }
6578 if ( userInput == "2" ) { ESBS ( ) ; PressAnyKeyToExit ( ) ; }
6679 if ( userInput == "3" ) { AboutDSBS ( ) ; PressAnyKeyToExit ( ) ; }
67- if ( userInput == "4" ) { Console . WriteLine ( "Opening GitHub link..." ) ; Process . Start ( githubLink ) ; }
68- if ( userInput != "1" || userInput != "2" || userInput != "3" || userInput != "4" ) { Console . WriteLine ( "Unknown command..." ) ; PressAnyKeyToExit ( ) ; }
80+ if ( userInput == "4" ) { Console . WriteLine ( "Opening GitHub..." ) ; Process . Start ( githubLink ) ; PressAnyKeyToExit ( ) ; }
81+ if ( userInput == "5" ) { Console . WriteLine ( "Opening Changelog..." ) ; Process . Start ( changeLink ) ; PressAnyKeyToExit ( ) ; }
82+ if ( userInput != "1" || userInput != "2" || userInput != "3" || userInput != "4" || userInput != "5" ) { Console . WriteLine ( "Unknown command..." ) ; PressAnyKeyToExit ( ) ; }
6983 PressAnyKeyToExit ( ) ;
7084 }
7185
86+ public static void Help ( )
87+ {
88+ Console . WriteLine ( "-help - Opens this" ) ;
89+ Console . WriteLine ( "-github - Opens GitHub page" ) ;
90+ Console . WriteLine ( "-dsbs - Disable Search Box Suggestions" ) ;
91+ Console . WriteLine ( "-esbs - Enable Search Box Suggestions" ) ;
92+ Console . WriteLine ( "-about - About DSBS" ) ;
93+ Console . WriteLine ( "-changelog - Open Changelog" ) ;
94+ Console . WriteLine ( "-version - Shows installed version" ) ;
95+ Console . WriteLine ( ) ;
96+ Console . WriteLine ( "These also work with the first letter of each arg, -d, -e, etc, or with the numeric option." ) ;
97+ }
98+
7299 public static void DSBS ( )
73100 {
74101 Console . WriteLine ( "Checking for permission..." ) ;
@@ -89,6 +116,14 @@ public static void DSBS()
89116 RegistryKey keyWin = Registry . LocalMachine . CreateSubKey ( @"SOFTWARE\Policies\Microsoft\Windows\Explorer" ) ;
90117 Console . WriteLine ( "Key created! Closing registry..." ) ;
91118 keyWin . Close ( ) ;
119+ Thread . Sleep ( 100 ) ;
120+ Console . WriteLine ( "Restarting..." ) ;
121+ Thread . Sleep ( 200 ) ;
122+ Process dsbs = new Process ( ) ;
123+ dsbs . StartInfo . FileName = Path . Combine ( Directory . GetCurrentDirectory ( ) ) + "\\ " + "DisableSearchBoxSuggestions.exe" ;
124+ dsbs . StartInfo . Arguments = " -dsbs" ;
125+ dsbs . Start ( ) ;
126+ Environment . Exit ( 0 ) ;
92127 }
93128 catch ( Exception e ) { ExceptionMSG ( e ) ; }
94129 }
0 commit comments