diff --git a/ModTek/ModTek.cs b/ModTek/ModTek.cs index 1a3702d0..c91f7520 100644 --- a/ModTek/ModTek.cs +++ b/ModTek/ModTek.cs @@ -238,13 +238,12 @@ private static List GetLoadOrder(Dictionary modDefs, out return loadOrder; } - // LOADING MODS private static void LoadMod(ModDef modDef) { var potentialAdditions = new List(); - Log($"Loading {modDef.Name}"); + Log($"Loading {modDef.Name} {modDef.Version}"); // load out of the manifest if (modDef.LoadImplicitManifest && modDef.Manifest.All(x => Path.GetFullPath(Path.Combine(modDef.Directory, x.Path)) != Path.GetFullPath(Path.Combine(modDef.Directory, "StreamingAssets")))) @@ -263,7 +262,7 @@ private static void LoadMod(ModDef modDef) } entry.Id = Path.GetFileNameWithoutExtension(entry.Path); - potentialAdditions.Add(entry); + if (!FileIsOnDenyList(entry.Path)) potentialAdditions.Add(entry); continue; } @@ -277,14 +276,14 @@ private static void LoadMod(ModDef modDef) if (Directory.Exists(entryPath)) { // path is a directory, add all the files there - var files = Directory.GetFiles(entryPath, "*", SearchOption.AllDirectories); + var files = Directory.GetFiles(entryPath, "*", SearchOption.AllDirectories).Where(filePath => !FileIsOnDenyList(filePath)); foreach (var filePath in files) { var childModDef = new ModDef.ManifestEntry(entry, filePath, InferIDFromFile(filePath)); potentialAdditions.Add(childModDef); } } - else if (File.Exists(entryPath)) + else if (File.Exists(entryPath) && !FileIsOnDenyList(entryPath)) { // path is a file, add the single entry entry.Id = entry.Id ?? InferIDFromFile(entryPath); @@ -414,8 +413,11 @@ internal static IEnumerator LoadMoadsLoop() foreach (var modName in modLoadOrder) { var modDef = modDefs[modName]; - yield return new ProgressReport((float)modLoaded++/(float)modLoadOrder.Count, sliderText, string.Format("Loading Mod: {0}", modDef.Name)); - + yield return new ProgressReport( + (float)modLoaded++/(float)modLoadOrder.Count, + sliderText, + string.Format("Loading Mod: {0} {1}", modDef.Name, modDef.Version) + ); try { LoadMod(modDef); @@ -503,6 +505,13 @@ private static void PrintHarmonySummary(string path) } } + // this is a very rudimentary version of an .ignore list for filetypes + // I have added it to remove my most common problems. PRs welcome. + private static readonly string[] ignoreList = { ".DS_STORE", "~", ".nomedia" }; + private static bool FileIsOnDenyList(string filePath) + { + return ignoreList.Any(x => filePath.EndsWith(x, StringComparison.InvariantCultureIgnoreCase)); + } // JSON HANDLING /// diff --git a/ModTek/ModTek.csproj b/ModTek/ModTek.csproj index b56549d0..58f228d6 100644 --- a/ModTek/ModTek.csproj +++ b/ModTek/ModTek.csproj @@ -87,6 +87,5 @@ - xcopy "$(TargetDir)$(TargetFileName)" "$(BattleTechGame)\Mods\" /y \ No newline at end of file diff --git a/ModTek/Patches.cs b/ModTek/Patches.cs index d1d78e41..49c916e3 100644 --- a/ModTek/Patches.cs +++ b/ModTek/Patches.cs @@ -51,7 +51,7 @@ public static void Postfix(string assetBundleName, ref string __result) } [HarmonyPatch(typeof(MetadataDatabase))] - [HarmonyPatch("MDD_DB_PATH", PropertyMethod.Getter)] + [HarmonyPatch("MDD_DB_PATH", MethodType.Getter)] public static class MetadataDatabase_MDD_DB_PATH_Patch { public static void Postfix(ref string __result) diff --git a/ModTek/Properties/AssemblyInfo.cs b/ModTek/Properties/AssemblyInfo.cs index 3969618d..17eda7b3 100644 --- a/ModTek/Properties/AssemblyInfo.cs +++ b/ModTek/Properties/AssemblyInfo.cs @@ -31,4 +31,4 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.3.0.*")] +[assembly: AssemblyVersion("0.3.1.*")]