Skip to content

Commit

Permalink
Improve assembly list
Browse files Browse the repository at this point in the history
* Get rid of unused code
* Include KSPAssembly version
  • Loading branch information
blowfishpro committed Sep 30, 2017
1 parent 901b5a5 commit a5b1547
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions ModuleManager/MMPatchLoader.cs
Expand Up @@ -144,14 +144,19 @@ private IEnumerable<string> GenerateModList(IPatchProgress progress)

modListInfo.Append("compiling list of loaded mods...\nMod DLLs found:\n");

string format = " {0,-40}{1,-25}{2,-25}{3,-25}{4}\n";

modListInfo.AppendFormat(
" {0,-40}{1,-30}{2,-30}{3}\n\n",
format,
"Name",
"Assembly Version",
"Assembly File Version",
"KSPAssembly Version",
"SHA256"
);

modListInfo.Append('\n');

foreach (AssemblyLoader.LoadedAssembly mod in AssemblyLoader.loadedAssemblies)
{

Expand All @@ -162,25 +167,21 @@ private IEnumerable<string> GenerateModList(IPatchProgress progress)

AssemblyName assemblyName = mod.assembly.GetName();

string kspAssemblyVersion;
if (mod.versionMajor == 0 && mod.versionMinor == 0)
kspAssemblyVersion = "";
else
kspAssemblyVersion = mod.versionMajor + "." + mod.versionMinor;

modListInfo.AppendFormat(
" {0,-40}{1,-30}{2,-30}{3}\n",
format,
assemblyName.Name,
assemblyName.Version,
fileVersionInfo.FileVersion,
kspAssemblyVersion,
FileSHA(mod.assembly.Location)
);

string modInfo = " " + assemblyName.Name
+ " v" + assemblyName.Version
+
(fileVersionInfo.ProductVersion != " " && fileVersionInfo.ProductVersion != assemblyName.Version.ToString()
? " / v" + fileVersionInfo.ProductVersion
: "")
+
(fileVersionInfo.FileVersion != " " &&fileVersionInfo.FileVersion != assemblyName.Version.ToString() && fileVersionInfo.FileVersion != fileVersionInfo.ProductVersion
? " / v" + fileVersionInfo.FileVersion
: "");

// modlist += String.Format(" {0,-50} SHA256 {1}\n", modInfo, FileSHA(mod.assembly.Location));

if (!mods.Contains(assemblyName.Name, StringComparer.OrdinalIgnoreCase))
Expand Down

0 comments on commit a5b1547

Please sign in to comment.