@@ -17,7 +17,7 @@ namespace Microsoft.P4VFS.Setup
1717 public class Program
1818 {
1919 public static SetupWindow _SetupWindow ;
20- public static List < string > _IncludeFiles ;
20+ public static SetupConfiguration _Configuration ;
2121 public static bool _Admin ;
2222 public static bool _Console ;
2323 public static bool _P4vfsDebug ;
@@ -58,11 +58,9 @@ public static int Main(string[] args)
5858 _Admin = false ;
5959 _Console = false ;
6060 _P4vfsDebug = false ;
61- _IncludeFiles = new List < string > ( ) ;
61+ _Configuration = new SetupConfiguration ( ) ;
6262
63- Configuration config = LoadConfiguration ( ) ;
64- if ( config != null && config . IncludeFiles != null )
65- _IncludeFiles . AddRange ( config . IncludeFiles ) ;
63+ _Configuration . Import ( LoadConfiguration ( ) ) ;
6664
6765 int argIndex = 0 ;
6866 for ( ; argIndex < args . Length ; ++ argIndex )
@@ -74,7 +72,7 @@ public static int Main(string[] args)
7472 else if ( String . Compare ( args [ argIndex ] , "-c" ) == 0 )
7573 _Console = true ;
7674 else if ( String . Compare ( args [ argIndex ] , "-i" ) == 0 && argIndex + 1 < args . Length )
77- _IncludeFiles . Add ( args [ ++ argIndex ] ) ;
75+ _Configuration . IncludeFiles . Add ( args [ ++ argIndex ] ) ;
7876 else if ( String . Compare ( args [ argIndex ] , "-d" ) == 0 )
7977 _P4vfsDebug = true ;
8078 else
@@ -250,7 +248,7 @@ private static bool CommandInstall(string[] args)
250248 }
251249
252250 progress . WriteLine ( 6 , String . Format ( "Installing application setup ..." ) ) ;
253- if ( InstallAplicationSetup ( ) == false )
251+ if ( InstallApplicationSetup ( ) == false )
254252 {
255253 WriteLine ( String . Format ( "Failed installing requirements for application setup" ) ) ;
256254 return false ;
@@ -368,7 +366,9 @@ private static bool InstallEnvironment()
368366
369367 List < string > paths = new List < string > ( srcPath . Split ( new char [ ] { ';' } , StringSplitOptions . RemoveEmptyEntries ) ) ;
370368 if ( paths . Any ( s => String . Compare ( InstallFolder , Regex . Replace ( s , @"[\\/]+" , "\\ " ) . TrimEnd ( '\\ ' ) , StringComparison . InvariantCultureIgnoreCase ) == 0 ) == false )
369+ {
371370 paths . Add ( InstallFolder ) ;
371+ }
372372
373373 string dstPath = String . Join ( ";" , paths ) ;
374374 envKey . SetValue ( "PATH" , dstPath , RegistryValueKind . ExpandString ) ;
@@ -398,7 +398,7 @@ private static void RefreshEnvironmentVariables()
398398 Environment . SetEnvironmentVariable ( "P4VFS_INSTALL" , null , EnvironmentVariableTarget . Machine ) ;
399399 }
400400
401- private static bool InstallAplicationSetup ( )
401+ private static bool InstallApplicationSetup ( )
402402 {
403403 try
404404 {
@@ -419,6 +419,12 @@ private static bool InstallAplicationSetup()
419419 appKey . SetValue ( "UninstallString" , String . Format ( "\" {0}\" uninstall" , installedSetupExe ) , RegistryValueKind . String ) ;
420420 appKey . SetValue ( "Publisher" , "Microsoft Corporation" , RegistryValueKind . String ) ;
421421 appKey . SetValue ( "InstallLocation" , InstallFolder , RegistryValueKind . String ) ;
422+
423+ foreach ( SetupRegistryKey setupKey in _Configuration . RegistryKeys )
424+ {
425+ WriteLine ( String . Format ( "Setting additional registry key: {0}={1}" , setupKey . Name , setupKey . Value ) ) ;
426+ appKey . SetValue ( setupKey . Name , setupKey . Value , RegistryValueKind . String ) ;
427+ }
422428 }
423429 }
424430 catch ( Exception e )
@@ -637,13 +643,13 @@ private static string CreateStagingFolder()
637643 }
638644
639645 string [ ] resourceNames = Assembly . GetExecutingAssembly ( ) . GetManifestResourceNames ( ) ;
640- using ( LogProgress progress = new LogProgress ( resourceNames . Length + _IncludeFiles . Count + 2 ) )
646+ using ( LogProgress progress = new LogProgress ( resourceNames . Length + _Configuration . IncludeFiles . Count + 2 ) )
641647 {
642648 WriteLine ( String . Format ( "Staging: {0}" , stagingFolder ) ) ;
643649 if ( ExtractResourcesToFolder ( resourceNames , stagingFolder , progress ) == false )
644650 return null ;
645651
646- foreach ( string includeFile in _IncludeFiles )
652+ foreach ( string includeFile in _Configuration . IncludeFiles )
647653 {
648654 progress . Increment ( ) ;
649655 string includeFilePath = ResolveIncludeFilePath ( includeFile ) ;
@@ -728,7 +734,7 @@ private static string ResolveIncludeFilePath(string filePath)
728734 return filePath ;
729735 }
730736
731- private static Configuration LoadConfiguration ( )
737+ private static SetupConfiguration LoadConfiguration ( )
732738 {
733739 string [ ] configFiles = new [ ] {
734740 "P4VFS.Setup.xml" ,
@@ -740,7 +746,7 @@ private static Configuration LoadConfiguration()
740746 string configFilePath = Path . GetFullPath ( Path . Combine ( Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) , configFile ) ) ;
741747 if ( File . Exists ( configFilePath ) )
742748 {
743- Configuration config = Configuration . LoadFromFile ( configFilePath ) ;
749+ SetupConfiguration config = SetupConfiguration . LoadFromFile ( configFilePath ) ;
744750 if ( config != null )
745751 {
746752 WriteLine ( String . Format ( "Loaded Configuration: {0}" , configFilePath ) ) ;
0 commit comments