[System.Configuration] Refactor InitForConfiguration to be readable
authorMarek Safar <marek.safar@gmail.com>
Wed, 22 Mar 2017 22:59:07 +0000 (23:59 +0100)
committerMarek Safar <marek.safar@gmail.com>
Thu, 23 Mar 2017 06:54:01 +0000 (07:54 +0100)
mcs/class/System.Configuration/System.Configuration/InternalConfigurationHost.cs

index 0cf6136ae38ca111de4ffb463a475245dd7cf4b0..9812fdfb7a877f3871c9a9b7d33472d5461d0217 100644 (file)
@@ -330,7 +330,7 @@ namespace System.Configuration
 
                        CheckFileMap (level, map);
 
-                       if (locationSubPath == null)
+                       if (locationSubPath == null) {
                                switch (level) {
                                case ConfigurationUserLevel.PerUserRoaming:
                                        if (map.RoamingUserConfigFilename == null)
@@ -343,35 +343,37 @@ namespace System.Configuration
                                        locationSubPath = "local";
                                        break;
                                }
-
-                       configPath = null;
-                       string next = null;
-
-                       locationConfigPath = null;
+                       }
 
                        if (locationSubPath == "exe" || locationSubPath == null && map.ExeConfigFilename != null) {
                                configPath = "exe";
-                               next = "machine";
+                               locationSubPath = "machine";
                                locationConfigPath = map.ExeConfigFilename;
+                               return;
                        }
                        
                        if (locationSubPath == "local" && map.LocalUserConfigFilename != null) {
                                configPath = "local";
-                               next = "roaming";
+                               locationSubPath = "roaming";
                                locationConfigPath = map.LocalUserConfigFilename;
+                               return;
                        }
                        
                        if (locationSubPath == "roaming" && map.RoamingUserConfigFilename != null) {
                                configPath = "roaming";
-                               next = "exe";
+                               locationSubPath = "exe";
                                locationConfigPath = map.RoamingUserConfigFilename;
+                               return;
                        }
                        
-                       if ((locationSubPath == "machine" || configPath == null) && map.MachineConfigFilename != null) {
+                       if (locationSubPath == "machine" && map.MachineConfigFilename != null) {
                                configPath = "machine";
-                               next = null;
+                               locationSubPath = null;
+                               locationConfigPath = null;
+                               return;
                        }
-                       locationSubPath = next;
+
+                       throw new NotImplementedException ();
                }
        }