1- using System ;
1+ using ModApi . UI ;
2+ using ModApi . UI . Windows ;
3+ using ModAPI_Installers ;
4+ using System ;
25using System . Collections . Generic ;
36using System . Diagnostics ;
47using System . IO ;
58using System . Linq ;
9+ using System . Threading . Tasks ;
610using System . Windows ;
711using System . Windows . Controls ;
812using System . Windows . Input ;
913using System . Windows . Media ;
10- using System . Windows . Media . Imaging ;
11- using System . Xml ;
12- using ModAPI_Installers ;
13- using ModApi . UI ;
1414using System . Windows . Media . Animation ;
15- using System . Threading ;
15+ using System . Windows . Media . Imaging ;
1616using System . Windows . Threading ;
17- using System . Threading . Tasks ;
18- using ModApi . UI . Windows ;
17+ using System . Xml ;
1918
2019namespace Spore_ModAPI_Easy_Installer
2120{
@@ -699,8 +698,12 @@ await Dispatcher.BeginInvoke(new Action(() =>
699698 List < string > enabledComponents = new List < string > ( ) ;
700699 InstallProgressBar . Maximum = GetComponentCount ( ) ; //enabledComponents.Count + Prerequisites.Count;
701700
702- foreach ( RemovalInfo p in Removals )
703- p . Remove ( ) ;
701+ // only respect <remove> during installation
702+ if ( ! _isConfigurator )
703+ {
704+ foreach ( RemovalInfo p in Removals )
705+ p . Remove ( ) ;
706+ }
704707
705708 foreach ( ComponentInfo p in Prerequisites )
706709 {
@@ -725,8 +728,10 @@ await Dispatcher.BeginInvoke(new Action(() =>
725728 if ( InstallProgressBar . Value < InstallProgressBar . Maximum )
726729 InstallProgressBar . Value += 1 ;
727730 }
728- /*else
729- await Task.Run(() => HandleModComponent(info, false));*/
731+ else if ( _isConfigurator )
732+ {
733+ await Task . Run ( ( ) => HandleModComponent ( info , false ) ) ;
734+ }
730735 }
731736 else if ( c is GroupBox )
732737 {
@@ -743,10 +748,10 @@ await Dispatcher.BeginInvoke(new Action(() =>
743748 if ( InstallProgressBar . Value < InstallProgressBar . Maximum )
744749 InstallProgressBar . Value += 1 ;
745750 }
746- /* else
747- await Task.Run(() => HandleModComponent(info, false));*/
748-
749-
751+ else if ( _isConfigurator )
752+ {
753+ await Task . Run ( ( ) => HandleModComponent ( info , false ) ) ;
754+ }
750755 }
751756 storedSettings . Add ( CreateSettingStorageString ( ( c as GroupBox ) . Tag . ToString ( ) , selected ) ) ;
752757 }
@@ -1138,12 +1143,7 @@ private void HandleCompatFile(ComponentInfo p)
11381143 }
11391144 }
11401145
1141- private void HandleModComponent ( ComponentInfo p )
1142- {
1143- HandleModComponent ( p , true ) ;
1144- }
1145-
1146- private void HandleModComponent ( ComponentInfo p , bool copy )
1146+ private void HandleModComponent ( ComponentInfo p , bool copy = true )
11471147 {
11481148 for ( int i = 0 ; i < p . ComponentFileNames . Count ; i ++ )
11491149 {
@@ -1198,7 +1198,11 @@ private void HandleModFile(ComponentInfo p, int index, bool copy)
11981198 }
11991199
12001200 if ( copy )
1201- File . Copy ( Path . Combine ( ModConfigPath , p . ComponentFileNames [ index ] ) , outputPath ) ;
1201+ {
1202+ string inPath = Path . Combine ( ModConfigPath , p . ComponentFileNames [ index ] ) ;
1203+ if ( File . Exists ( inPath ) )
1204+ File . Copy ( inPath , outputPath ) ;
1205+ }
12021206 }
12031207 else
12041208 {
@@ -1278,70 +1282,6 @@ private void DeleteFolder(string path)
12781282 Directory . Delete ( path ) ;
12791283 }
12801284
1281- /*private void DeleteModFile(ComponentInfo p)
1282- {
1283- if (p.ComponentGame == gameGaString)
1284- {
1285- string outputPath = Path.Combine(
1286- GaDataPath
1287- , p.ComponentFileName);
1288- if (File.Exists(outputPath))
1289- {
1290- File.Delete(outputPath);
1291- }
1292- }
1293- else if (p.ComponentGame == gameSporeString)
1294- {
1295- string outputPath = Path.Combine(
1296- SporeDataPath
1297- , p.ComponentFileName);
1298- if (File.Exists(outputPath))
1299- {
1300- File.Delete(outputPath);
1301- }
1302- }
1303- else
1304- {
1305- if ((p.ComponentFileName.EndsWith("-disk.dll")) | (p.ComponentFileName.EndsWith("-steam.dll")) | (p.ComponentFileName.EndsWith("-steam_patched.dll")))
1306- {
1307- string outputPath = Path.Combine(
1308- Directory.GetParent(System.Reflection.Assembly.GetEntryAssembly().Location).ToString()
1309- , p.ComponentFileName);
1310-
1311- if (File.Exists(outputPath))
1312- {
1313- File.Delete(outputPath);
1314- }
1315- }
1316- else
1317- {
1318- string outputPath = Path.Combine(
1319- Directory.GetParent(System.Reflection.Assembly.GetEntryAssembly().Location).ToString()
1320- , p.ComponentFileName.Replace(".dll", "-disk.dll"));
1321- if (File.Exists(outputPath))
1322- {
1323- File.Delete(outputPath);
1324- }
1325-
1326- outputPath = Path.Combine(
1327- Directory.GetParent(System.Reflection.Assembly.GetEntryAssembly().Location).ToString()
1328- , p.ComponentFileName.Replace(".dll", "-steam.dll"));
1329- if (File.Exists(outputPath))
1330- {
1331- File.Delete(outputPath);
1332- }
1333-
1334- outputPath = Path.Combine(
1335- Directory.GetParent(System.Reflection.Assembly.GetEntryAssembly().Location).ToString()
1336- , p.ComponentFileName.Replace(".dll", "-steam_patched.dll"));
1337- if (File.Exists(outputPath))
1338- {
1339- File.Delete(outputPath);
1340- }
1341- }
1342- }
1343- }*/
1344-
13451285 public void CyclePage ( int currentPage , int targetPage )
13461286 {
13471287 WindowBodyRootGrid . Children [ targetPage ] . Visibility = Visibility . Visible ;
0 commit comments