@@ -11,115 +11,99 @@ public static class PathDialogs
1111 private static string _galacticAdventuresPath = null ;
1212 public static string ProcessGalacticAdventures ( )
1313 {
14- string path = null ;
15-
1614 if ( _galacticAdventuresPath != null )
1715 {
1816 return _galacticAdventuresPath ;
1917 }
2018
2119 try
2220 {
23- if ( ! LauncherSettings . ForceGamePath )
21+ // attempt to retrieve spore path from registry
22+ string path = SporePath . GetFromRegistry ( SporePath . Game . GalacticAdventures ) ;
23+ if ( ! String . IsNullOrEmpty ( path ) && Directory . Exists ( path ) )
2424 {
25- path = SporePath . GetFromRegistry ( SporePath . Game . GalacticAdventures ) ;
25+ path = SporePath . MoveToSporebinEP1 ( path ) ;
2626 }
2727
28- if ( path != null )
28+ // fallback to specified game path
29+ if ( String . IsNullOrEmpty ( path ) || ! Directory . Exists ( path ) )
2930 {
30- // move the path to SporebinEP1
31- path = SporePath . MoveToSporebinEP1 ( path ) ;
31+ path = LauncherSettings . GamePath ;
32+ if ( ! String . IsNullOrEmpty ( path ) && Directory . Exists ( path ) )
33+ {
34+ path = SporePath . MoveToSporebinEP1 ( path ) ;
35+ }
3236 }
3337
34- // If we didn't find the path in the registry or was not valid, ask the user
35- if ( path == null || ! Directory . Exists ( path ) )
38+ // ask the user when fallback wasn't found
39+ if ( String . IsNullOrEmpty ( path ) || ! Directory . Exists ( path ) )
3640 {
41+ var result = MessageBox . Show ( CommonStrings . GalacticAdventuresNotFoundSpecifyManual , CommonStrings . GalacticAdventuresNotFound ,
42+ MessageBoxButtons . OKCancel , MessageBoxIcon . Exclamation ) ;
3743
38- if ( path == null )
39- {
40- path = LauncherSettings . GamePath ;
41- if ( path == null || path . Length == 0 )
42- {
43- var result = MessageBox . Show ( CommonStrings . GalacticAdventuresNotFoundSpecifyManual , CommonStrings . GalacticAdventuresNotFound ,
44- MessageBoxButtons . OKCancel , MessageBoxIcon . Exclamation ) ;
45-
46- if ( result == DialogResult . OK )
47- {
48- path = ShowGalacticAdventuresChooserDialog ( ) ;
49- }
50- }
51- }
52- else
44+ if ( result == DialogResult . OK )
5345 {
54- // move the path to SporebinEP1
55- path = SporePath . MoveToSporebinEP1 ( path ) ;
46+ path = ShowGalacticAdventuresChooserDialog ( ) ;
5647 }
5748 }
49+
50+ _galacticAdventuresPath = path ;
5851 }
5952 catch ( Exception )
6053 {
6154 return null ;
6255 }
6356
64- _galacticAdventuresPath = path ;
6557 return _galacticAdventuresPath ;
6658 }
6759
6860 // Returns path to Sporebin or null
6961 private static string _coreSporePath = null ;
7062 public static string ProcessSpore ( )
7163 {
72- string path = null ;
73-
7464 if ( _coreSporePath != null )
7565 {
7666 return _coreSporePath ;
7767 }
7868
7969 try
8070 {
81- if ( ! LauncherSettings . ForceGamePath )
71+ // attempt to retrieve spore path from registry
72+ string path = SporePath . GetFromRegistry ( SporePath . Game . Spore ) ;
73+ if ( ! String . IsNullOrEmpty ( path ) && Directory . Exists ( path ) )
8274 {
83- path = SporePath . GetFromRegistry ( SporePath . Game . Spore ) ;
75+ path = SporePath . MoveToSporebin ( path ) ;
8476 }
8577
86- if ( path != null )
78+ // fallback to specified game path
79+ if ( String . IsNullOrEmpty ( path ) || ! Directory . Exists ( path ) )
8780 {
88- // move the path to Sporebin
89- path = SporePath . MoveToSporebin ( path ) ;
81+ path = LauncherSettings . SporeGamePath ;
82+ if ( ! String . IsNullOrEmpty ( path ) && Directory . Exists ( path ) )
83+ {
84+ path = SporePath . MoveToSporebin ( path ) ;
85+ }
9086 }
9187
92- // If we didn't find the path in the registry or was not valid, ask the user
93- if ( path == null || ! Directory . Exists ( path ) )
88+ // ask the user when fallback wasn't found
89+ if ( String . IsNullOrEmpty ( path ) || ! Directory . Exists ( path ) )
9490 {
91+ var result = MessageBox . Show ( CommonStrings . SporeNotFoundSpecifyManual , CommonStrings . SporeNotFound ,
92+ MessageBoxButtons . OKCancel , MessageBoxIcon . Exclamation ) ;
9593
96- if ( path == null )
94+ if ( result == DialogResult . OK )
9795 {
98- path = LauncherSettings . GamePath ;
99- if ( path == null || path . Length == 0 )
100- {
101- var result = MessageBox . Show ( CommonStrings . SporeNotFoundSpecifyManual , CommonStrings . SporeNotFound ,
102- MessageBoxButtons . OKCancel , MessageBoxIcon . Exclamation ) ;
103-
104- if ( result == DialogResult . OK )
105- {
106- path = ShowSporeChooserDialog ( ) ;
107- }
108- }
109- }
110- else
111- {
112- // move the path to Sporebin
113- path = SporePath . MoveToSporebin ( path ) ;
96+ path = ShowSporeChooserDialog ( ) ;
11497 }
11598 }
99+
100+ _coreSporePath = path ;
116101 }
117102 catch ( Exception )
118103 {
119104 return null ;
120105 }
121106
122- _coreSporePath = path ;
123107 return _coreSporePath ;
124108 }
125109
0 commit comments