Skip to content

Commit

Permalink
Allow GameData subdirs in NEEDS / BEFORE / AFTER
Browse files Browse the repository at this point in the history
  • Loading branch information
Swamp Ig committed May 18, 2014
1 parent a19da63 commit eab151a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("2.1.3")]
[assembly: AssemblyVersion("2.1.4")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down
43 changes: 28 additions & 15 deletions moduleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,27 +162,40 @@ orderby ass.GetName().Version descending, a.path ascending
{
modlist += " " + mod.Name + " v" + mod.Version.ToString() + "\n";
}
modlist += "Non-DLL mods added:";
modlist += "Non-DLL mods added:\n";
foreach (UrlDir.UrlConfig cfgmod in GameDatabase.Instance.root.AllConfigs)
{
if (cfgmod.type[0] == '@' || (cfgmod.type[0] == '$'))
string name;
if (ParseCommand(cfgmod.type, out name) != Command.Insert && name.Contains(":FOR["))
{
string name = RemoveWS(cfgmod.name);
if (name.Contains(":FOR["))
{ // check for FOR[] blocks that don't match loaded DLLs and add them to the pass list

string dependency = name.Substring(name.IndexOf(":FOR[") + 5);
dependency = dependency.Substring(0, dependency.IndexOf(']'));
if (mods.Find(a => RemoveWS(a.Name.ToUpper()).Equals(RemoveWS(dependency.ToUpper()))) == null)
{ // found one, now add it to the list.
AssemblyName newMod = new AssemblyName(dependency);
newMod.Name = dependency;
mods.Add(newMod);
modlist += "\n " + dependency;
}
name = RemoveWS(name);
// check for FOR[] blocks that don't match loaded DLLs and add them to the pass list

string dependency = name.Substring(name.IndexOf(":FOR[") + 5);
dependency = dependency.Substring(0, dependency.IndexOf(']'));
if (mods.Find(a => RemoveWS(a.Name.ToUpper()).Equals(RemoveWS(dependency.ToUpper()))) == null)
{ // found one, now add it to the list.
AssemblyName newMod = new AssemblyName(dependency);
newMod.Name = dependency;
mods.Add(newMod);
modlist += " " + dependency + "\n";
}
}
}
modlist += "Mods by directory (subdirs of GameData):\n";
string gameData = Path.Combine(Path.GetFullPath(KSPUtil.ApplicationRootPath), "GameData");
foreach (string subdir in Directory.GetDirectories(gameData))
{
string name = Path.GetFileName(subdir);
string upperName = RemoveWS(name.ToUpper());
if (mods.Find(a => RemoveWS(a.Name.ToUpper()) == upperName) == null)
{
AssemblyName newMod = new AssemblyName(name);
newMod.Name = name;
mods.Add(newMod);
modlist += " " + name + "\n";
}
}
log(modlist);
#endregion

Expand Down

0 comments on commit eab151a

Please # to comment.