Skip to content

Commit 6db26b9

Browse files
committed
Spore ModAPI Launcher: remove unrequired CheckOutdatedCoreDlls()
1 parent f50b943 commit 6db26b9

1 file changed

Lines changed: 3 additions & 70 deletions

File tree

Spore ModAPI Launcher/Program.cs

Lines changed: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public void ShowError(Exception ex)
189189
}
190190
}
191191

192-
List<string> GetDLLsToInject(string dllEnding, List<string> dllExceptions)
192+
List<string> GetDLLsToInject(string dllEnding)
193193
{
194194
List<string> dlls = new List<string>();
195195

@@ -214,14 +214,13 @@ List<string> GetDLLsToInject(string dllEnding, List<string> dllExceptions)
214214
foreach (string s in Directory.EnumerateFiles(mFolder)
215215
.Where(x => !Path.GetFileName(x).Equals(coreDllName, StringComparison.OrdinalIgnoreCase) &&
216216
x.ToLowerInvariant().EndsWith(".dll") &&
217-
!dllExceptions.Contains(Path.GetFileName(x)) &&
218217
!dlls.Contains(x)))
219218
{
220219
dlls.Add(s);
221220
}
222221

223222
foreach (var file in baseFolder.EnumerateFiles("*" + dllEnding + ".dll")
224-
.Where(x => x.Name != MODAPI_DLL && !dllExceptions.Contains(x.Name)))
223+
.Where(x => x.Name != MODAPI_DLL))
225224
{
226225
// the ModAPI dll should already be loaded
227226
if (file.Name != MODAPI_DLL)
@@ -236,16 +235,14 @@ List<string> GetDLLsToInject(string dllEnding, List<string> dllExceptions)
236235

237236
void InjectSporeProcess(string dllEnding)
238237
{
239-
var dllExceptions = CheckOutdatedCoreDlls();
240-
241238
CreateSporeProcess();
242239

243240
try
244241
{
245242
const string MOD_API_DLL_INJECTOR = "ModAPI.DLLInjector.dll";
246243
IntPtr hDLLInjectorHandle = Injector.InjectDLL(this.ProcessInfo, Path.GetFullPath(MOD_API_DLL_INJECTOR));
247244

248-
List<string> dlls = GetDLLsToInject(dllEnding, dllExceptions);
245+
List<string> dlls = GetDLLsToInject(dllEnding);
249246

250247
Injector.SetInjectionData(this.ProcessInfo, hDLLInjectorHandle, dllEnding == "disk", dlls);
251248

@@ -465,70 +462,6 @@ public static void ThrowWin32Exception(string info, int error)
465462
}
466463
}
467464

468-
/// <summary>
469-
/// Checks that the current core DLLs version is high enough for all installed mods.
470-
/// It will show an error dialog for those mods that won't be loaded becaues they
471-
/// require a higher version.
472-
/// Returns a list of all .dll files that MUST NOT be loaded.
473-
/// </summary>
474-
/// <returns></returns>
475-
static List<string> CheckOutdatedCoreDlls()
476-
{
477-
var disabledDlls = new List<string>();
478-
479-
string modConfigsPath = Path.Combine(
480-
Directory.GetParent(Assembly.GetEntryAssembly().Location).ToString(),
481-
"ModConfigs");
482-
483-
var disabledMods = new List<string>();
484-
485-
if (Directory.Exists(modConfigsPath))
486-
{
487-
foreach (var modFolder in Directory.GetDirectories(modConfigsPath))
488-
{
489-
var xmlPath = Path.Combine(modFolder, "ModInfo.xml");
490-
if (File.Exists(xmlPath))
491-
{
492-
try
493-
{
494-
var document = new XmlDocument();
495-
document.Load(xmlPath);
496-
var modNode = document.SelectSingleNode("/mod");
497-
498-
if (!UpdateManager.HasValidDllsVersion(document))
499-
{
500-
disabledMods.Add(GetModDisplayName(modNode));
501-
502-
foreach (var file in GetModFiles(modNode))
503-
{
504-
if (file.EndsWith(".dll"))
505-
{
506-
disabledDlls.Add(Path.GetFileName(file));
507-
}
508-
}
509-
}
510-
}
511-
catch { }
512-
}
513-
}
514-
}
515-
516-
if (disabledMods.Any())
517-
{
518-
var sb = new StringBuilder();
519-
foreach (var mod in disabledMods)
520-
{
521-
sb.Append(" - ");
522-
sb.Append(mod);
523-
sb.Append("\n");
524-
}
525-
526-
MessageBox.Show(Strings.UnsupportedDllVersion + sb, Strings.UnsupportedDllVersionTitle);
527-
}
528-
529-
return disabledDlls;
530-
}
531-
532465
private static string GetModDisplayName(XmlNode modNode)
533466
{
534467
return modNode.Attributes["displayName"]?.Value ?? modNode.Attributes["unique"]?.Value;

0 commit comments

Comments
 (0)