File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Tulpep.NetworkAutoSwitch.Service Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,12 @@ static int Main(string[] args)
2323 switch ( string . Concat ( args ) )
2424 {
2525 case "--install" :
26-
26+ string currentPath = Assembly . GetExecutingAssembly ( ) . Location ;
2727 string pathOfService = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . System ) , "NetworkAutoSwitch.exe" ) ;
28+ string logFile = Path . Combine ( Path . GetDirectoryName ( currentPath ) , "NetworkAutoSwitch.InstallLog" ) ;
2829 Logging . WriteMessage ( "Copying file to " + pathOfService ) ;
29- File . Copy ( Assembly . GetExecutingAssembly ( ) . Location , pathOfService , true ) ;
30- ManagedInstallerClass . InstallHelper ( new string [ ] { pathOfService } ) ;
30+ File . Copy ( currentPath , pathOfService , true ) ;
31+ ManagedInstallerClass . InstallHelper ( new string [ ] { "/LogFile=" + logFile , "/LogToConsole=true" , pathOfService } ) ;
3132 Logging . WriteMessage ( "Service Installed" ) ;
3233 const string serviceName = "NetworkAutoSwitch" ;
3334 int timeout = 5000 ;
@@ -36,7 +37,7 @@ static int Main(string[] args)
3637 StartService ( serviceName , timeout ) ;
3738 return 0 ;
3839 case "--uninstall" :
39- ManagedInstallerClass . InstallHelper ( new string [ ] { "/u " , Assembly . GetExecutingAssembly ( ) . Location } ) ;
40+ ManagedInstallerClass . InstallHelper ( new string [ ] { "/uninstall" , "/LogToConsole=true ", Assembly . GetExecutingAssembly ( ) . Location } ) ;
4041 Logging . WriteMessage ( "Service Uninstalled" ) ;
4142 return 0 ;
4243 default :
You can’t perform that action at this time.
0 commit comments