Skip to content

Commit

Permalink
v2.5.8 - Feed the feline
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed Jan 8, 2015
1 parent 77204a1 commit 5614b78
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
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.5.7")]
[assembly: AssemblyVersion("2.5.8")]
[assembly: KSPAssembly("ModuleManager", 2, 5)]

// The following attributes are used to specify the signing key for the assembly,
Expand Down
40 changes: 28 additions & 12 deletions moduleManager.cs
Expand Up @@ -392,6 +392,8 @@ public class MMPatchLoader : LoadingSystem

public int needsUnsatisfiedCount = 0;

public int catEatenCount = 0;

private Dictionary<String, int> errorFiles;

private List<AssemblyName> mods;
Expand Down Expand Up @@ -511,18 +513,21 @@ private List<String> PrePatchInit()
// Build a list of subdirectory that won't be processed
List<String> excludePaths = new List<string>();

foreach (UrlDir.UrlConfig mod in GameDatabase.Instance.root.AllConfigs)
if (ModuleManager.IsWin64())
{
if (mod.name == "MODULEMANAGER[LOCAL]")
foreach (UrlDir.UrlConfig mod in GameDatabase.Instance.root.AllConfigs)
{
string fullpath = mod.url.Substring(0, mod.url.LastIndexOf('/'));
string excludepath = fullpath.Substring(0, fullpath.LastIndexOf('/'));
excludePaths.Add(excludepath);
log("excludepath: " + excludepath);
if (mod.name == "MODULEMANAGER[NOWIN64]")
{
string fullpath = mod.url.Substring(0, mod.url.LastIndexOf('/'));
string excludepath = fullpath.Substring(0, fullpath.LastIndexOf('/'));
excludePaths.Add(excludepath);
log("excludepath: " + excludepath);
}
}
if (excludePaths.Any())
log("will not process patch in these subdirectories since they were disbaled on KSP Win64:\n" + String.Join("\n", excludePaths.ToArray()));
}
if (excludePaths.Any())
log("will not process patch in these subdirectories:\n" + String.Join("\n", excludePaths.ToArray()));

#endregion Excluding directories

Expand Down Expand Up @@ -751,6 +756,8 @@ private void CreateCache()

cache.AddValue("patchedNodeCount", patchedNodeCount.ToString());

cache.AddValue("catEatenCount", catEatenCount.ToString());

foreach (UrlDir.UrlConfig config in GameDatabase.Instance.root.AllConfigs)
{
ConfigNode node = cache.AddNode("UrlConfig");
Expand Down Expand Up @@ -778,6 +785,9 @@ private void LoadCache()
if (cache.HasValue("patchedNodeCount"))
int.TryParse(cache.GetValue("patchedNodeCount"), out patchedNodeCount);

if (cache.HasValue("catEatenCount"))
int.TryParse(cache.GetValue("catEatenCount"), out catEatenCount);

foreach (ConfigNode node in cache.nodes)
{
string name = node.GetValue("name");
Expand All @@ -804,6 +814,8 @@ private void StatusUpdate()

if (errorCount > 0)
status += ", found " + errorCount + " error" + (errorCount != 1 ? "s" : "");
if (catEatenCount > 0)
status += ", " + catEatenCount + " patch" + (patchedNodeCount != 1 ? "es were" : " was") + " eaten by the Win64 cat";
}

#region Needs checking
Expand All @@ -817,8 +829,15 @@ private void CheckNeeds(List<String> excludePaths)
{
try
{
if (IsPathInList(mod.url, excludePaths))
string name;
if (IsPathInList(mod.url, excludePaths) && (ParseCommand(mod.type, out name) != Command.Insert))
{
mod.parent.configs.Remove(mod);
catEatenCount++;
log("Deleting Node in file " + mod.parent.url + " subnode: " + mod.type +
" as it is set to be disabled on KSP Win64");
continue;
}

if (mod.type.Contains(":NEEDS["))
{
Expand Down Expand Up @@ -945,9 +964,6 @@ private void PurgeUnused(List<string> excludePaths)
{
foreach (UrlDir.UrlConfig mod in GameDatabase.Instance.root.AllConfigs.ToArray())
{
if (IsPathInList(mod.url, excludePaths))
continue;

string name = RemoveWS(mod.type);

if (ParseCommand(name, out name) != Command.Insert)
Expand Down

0 comments on commit 5614b78

Please sign in to comment.