/// <summary> /// Searches for mod format assemblies in the specified path, and loads /// any mod formats that are found into a registry. /// </summary> /// <remarks> /// A mod format is loaded if the class implements <see cref="IModFormat"/> and is /// not abstract. Once loaded, the format is added to the registry. /// </remarks> /// <param name="p_mcmModCacheManager">The manager being used to manage mod caches.</param> /// <param name="p_stgScriptTypeRegistry">The registry listing the supported script types.</param> /// <param name="p_strSearchPath">The path in which to search for mod format assemblies.</param> /// <returns>A registry containing all of the discovered mod formats.</returns> public static IModFormatRegistry DiscoverFormats(IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry, string p_strSearchPath) { Trace.TraceInformation("Discovering Mod Formats..."); Trace.Indent(); Trace.TraceInformation("Looking in: {0}", p_strSearchPath); IModFormatRegistry mfrRegistry = new ModFormatRegistry(); if (!Directory.Exists(p_strSearchPath)) { Trace.TraceError("Format search path does not exist."); Trace.Unindent(); return(mfrRegistry); } string[] strAssemblies = Directory.GetFiles(p_strSearchPath, "*.dll"); foreach (string strAssembly in strAssemblies) { Trace.TraceInformation("Checking: {0}", Path.GetFileName(strAssembly)); Trace.Indent(); Assembly asmGameMode = Assembly.LoadFile(strAssembly); Type[] tpeTypes = asmGameMode.GetExportedTypes(); foreach (Type tpeType in tpeTypes) { if (typeof(IModFormat).IsAssignableFrom(tpeType) && !tpeType.IsAbstract) { Trace.TraceInformation("Initializing: {0}", tpeType.FullName); Trace.Indent(); ConstructorInfo cifConstructor = tpeType.GetConstructor(new Type[] { typeof(IModCacheManager), typeof(IScriptTypeRegistry) }); IModFormat mftModFormat = null; if (cifConstructor != null) { mftModFormat = (IModFormat)cifConstructor.Invoke(new object[] { p_mcmModCacheManager, p_stgScriptTypeRegistry }); } else { cifConstructor = tpeType.GetConstructor(new Type[] { }); if (cifConstructor != null) { mftModFormat = (IModFormat)cifConstructor.Invoke(null); } } if (mftModFormat != null) { mfrRegistry.RegisterFormat(mftModFormat); } Trace.Unindent(); } } Trace.Unindent(); } Trace.Unindent(); return(mfrRegistry); }
/// <summary> /// Searches for mod format assemblies in the specified path, and loads /// any mod formats that are found into a registry. /// </summary> /// <remarks> /// A mod format is loaded if the class implements <see cref="IModFormat"/> and is /// not abstract. Once loaded, the format is added to the registry. /// </remarks> /// <param name="p_mcmModCacheManager">The manager being used to manage mod caches.</param> /// <param name="p_stgScriptTypeRegistry">The registry listing the supported script types.</param> /// <param name="p_strSearchPath">The path in which to search for mod format assemblies.</param> /// <returns>A registry containing all of the discovered mod formats.</returns> public static IModFormatRegistry DiscoverFormats(IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry, string p_strSearchPath) { Trace.TraceInformation("Discovering Mod Formats..."); Trace.Indent(); Trace.TraceInformation("Looking in: {0}", p_strSearchPath); IModFormatRegistry mfrRegistry = new ModFormatRegistry(); if (!Directory.Exists(p_strSearchPath)) { Trace.TraceError("Format search path does not exist."); Trace.Unindent(); return mfrRegistry; } string[] strAssemblies = Directory.GetFiles(p_strSearchPath, "*.dll"); foreach (string strAssembly in strAssemblies) { Trace.TraceInformation("Checking: {0}", Path.GetFileName(strAssembly)); Trace.Indent(); Assembly asmGameMode = Assembly.LoadFile(strAssembly); Type[] tpeTypes = asmGameMode.GetExportedTypes(); foreach (Type tpeType in tpeTypes) { if (typeof(IModFormat).IsAssignableFrom(tpeType) && !tpeType.IsAbstract) { Trace.TraceInformation("Initializing: {0}", tpeType.FullName); Trace.Indent(); ConstructorInfo cifConstructor = tpeType.GetConstructor(new Type[] { typeof(IModCacheManager), typeof(IScriptTypeRegistry) }); IModFormat mftModFormat = null; if (cifConstructor != null) mftModFormat = (IModFormat)cifConstructor.Invoke(new object[] { p_mcmModCacheManager, p_stgScriptTypeRegistry }); else { cifConstructor = tpeType.GetConstructor(new Type[] { }); if (cifConstructor != null) mftModFormat = (IModFormat)cifConstructor.Invoke(null); } if (mftModFormat != null) mfrRegistry.RegisterFormat(mftModFormat); Trace.Unindent(); } } Trace.Unindent(); } Trace.Unindent(); return mfrRegistry; }
/// <summary> /// Searches for mods in the specified path, and loads /// any mods that are found into a registry. /// </summary> /// <param name="p_frgFormatRegistry">The <see cref="IModFormatRegistry"/> that contains the list /// of supported <see cref="IModFormat"/>s.</param> /// <param name="p_strSearchPath">The path in which to search for mod format assemblies.</param> /// <param name="p_booRecurse">Whether to check sub folders of <paramref name="p_strSearchPath"/> for mods.</param> /// <param name="p_gmdGameMode">The game mode for which to discover mods.</param> /// <param name="p_strExcludedSubDirectories">The list of subdirectories not to examine for mods.</param> /// <returns>A registry containing all of the discovered mods.</returns> public static ModRegistry DiscoverManagedMods(IModFormatRegistry p_frgFormatRegistry, IModCacheManager p_frgCacheManager, string p_strSearchPath, bool p_booRecurse, IEnvironmentInfo p_eiEnvironmentInfo, IGameMode p_gmdGameMode, params string[] p_strExcludedSubDirectories) { Trace.TraceInformation("Discovering Managed Mods..."); Trace.Indent(); Trace.TraceInformation("Looking in: {0}", p_strSearchPath); List <string> lstExludedPaths = new List <string>(); for (Int32 i = 0; i < p_strExcludedSubDirectories.Length; i++) { lstExludedPaths.Add((p_strExcludedSubDirectories[i].Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar).TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar).ToLower()); } ModRegistry mdrRegistry = new ModRegistry(p_frgFormatRegistry, p_gmdGameMode); string[] strMods = Directory.GetFiles(p_strSearchPath, "*", p_booRecurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); IMod modMod = null; List <string> modList = new List <String>(); bool booExcluded = false; foreach (string strMod in strMods) { string strModPath = strMod.ToLower(); booExcluded = false; if (strModPath.EndsWith(".meta")) { continue; } foreach (string strExclusion in lstExludedPaths) { if (strModPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar).StartsWith(strExclusion)) { booExcluded = true; break; } } if (booExcluded) { continue; } Trace.TraceInformation("Found: {0}", strMod); try { string strCachePath = p_frgCacheManager.GetCacheFilePath(strMod); modMod = mdrRegistry.CreateMod(strMod, strCachePath, p_gmdGameMode, p_eiEnvironmentInfo); } catch { modList.Add(strMod); modMod = null; } if (modMod == null) { continue; } mdrRegistry.m_oclRegisteredMods.Add(modMod); Trace.Indent(); Trace.TraceInformation("Registered."); Trace.Unindent(); } p_eiEnvironmentInfo.Settings.CacheOverhaulSetup = true; p_eiEnvironmentInfo.Settings.Save(); if (modList.Count > 0) { string strErrorMessage = "Error loading the following mods: " + Environment.NewLine; foreach (string modstr in modList) { strErrorMessage += modstr + Environment.NewLine; } MessageBox.Show(strErrorMessage, "Mod loading error", MessageBoxButtons.OK, MessageBoxIcon.Information); } Trace.Unindent(); return(mdrRegistry); }
/// <summary> /// Initializes an OMod in OMod-ready archive format. /// </summary> /// <param name="p_booUseCache">Whether to use the mod cache.</param> /// <param name="p_mcmModCacheManager">The manager for the current game mode's mod cache.</param> /// <param name="p_stgScriptTypeRegistry">The registry of supported script types.</param> private void InitializeUnpackedOmod(bool p_booUseCache, IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry) { if (p_booUseCache) { m_arcCacheFile = p_mcmModCacheManager.GetCacheFile(this); //check to make sure the cache isn't bad if ((m_arcCacheFile != null) && (!m_arcCacheFile.ContainsFile(GetRealPath(Path.Combine(CONVERSION_FOLDER, "config"))) || !ValidateConfig(GetSpecialFile("config")))) { //bad cache - clear it m_arcCacheFile.Dispose(); m_arcCacheFile = null; } } //check for script m_booHasInstallScript = false; foreach (IScriptType stpScript in p_stgScriptTypeRegistry.Types) { foreach (string strScriptName in stpScript.FileNames) { if (ContainsFile(Path.Combine(CONVERSION_FOLDER, strScriptName))) { StreamReader sreScript = null; string strCode = String.Empty; if (File.Exists(Path.Combine(CONVERSION_FOLDER, strScriptName))) { sreScript = new StreamReader(Path.Combine(CONVERSION_FOLDER, strScriptName)); strCode = sreScript.ReadToEnd(); sreScript.Close(); } else strCode = TextUtil.ByteToString(GetFile(Path.Combine(CONVERSION_FOLDER, strScriptName))).Trim('\0'); if (!String.IsNullOrEmpty(strCode)) { if (stpScript.ValidateScript(stpScript.LoadScript(strCode))) { m_booHasInstallScript = true; m_stpInstallScriptType = stpScript; break; } } } } if (m_booHasInstallScript) break; } //check for readme m_booHasReadme = ContainsFile(Path.Combine(CONVERSION_FOLDER, "readme")); //check for screenshot m_booHasScreenshot = ContainsFile(Path.Combine(CONVERSION_FOLDER, "screenshot")); if (p_booUseCache && (m_arcCacheFile == null)) { string strTmpInfo = p_mcmModCacheManager.FileUtility.CreateTempDirectory(); try { FileUtil.WriteAllBytes(Path.Combine(strTmpInfo, GetRealPath(Path.Combine(CONVERSION_FOLDER, "config"))), GetSpecialFile("config")); if (m_booHasReadme) FileUtil.WriteAllBytes(Path.Combine(strTmpInfo, GetRealPath(Path.Combine(CONVERSION_FOLDER, "readme"))), GetSpecialFile("readme")); if (m_booHasScreenshot) FileUtil.WriteAllBytes(Path.Combine(strTmpInfo, GetRealPath(Path.Combine(CONVERSION_FOLDER, ScreenshotPath))), GetSpecialFile(ScreenshotPath)); m_arcCacheFile = p_mcmModCacheManager.CreateCacheFile(this, strTmpInfo); } finally { FileUtil.ForceDelete(strTmpInfo); } } LoadInfo(GetSpecialFile("config")); }
/// <summary> /// A simple constructor that initializes the OMod from the specified file. /// </summary> /// <param name="p_strFilePath">The mod file from which to create the OMod.</param> /// <param name="p_mftModFormat">The format of the mod.</param> /// <param name="p_mcmModCacheManager">The manager for the current game mode's mod cache.</param> /// <param name="p_stgScriptTypeRegistry">The registry of supported script types.</param> public OMod(string p_strFilePath, OModFormat p_mftModFormat, IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry) { Format = p_mftModFormat; m_strFilePath = p_strFilePath; m_arcFile = new Archive(p_strFilePath); ModName = Path.GetFileNameWithoutExtension(Filename); bool p_booUseCache = true; PluginList = new List<FileInfo>(); DataFileList = new List<FileInfo>(); FindPathPrefix(); IsPacked = !m_arcFile.ContainsFile(GetRealPath(Path.Combine(CONVERSION_FOLDER, "config"))); if (!IsPacked) InitializeUnpackedOmod(p_booUseCache, p_mcmModCacheManager, p_stgScriptTypeRegistry); else InitializePackedOmod(p_stgScriptTypeRegistry); m_arcFile.FilesChanged += new EventHandler(Archive_FilesChanged); }
/// <summary> /// Searches for mods in the specified path, and loads /// any mods that are found into a registry. /// </summary> /// <param name="p_frgFormatRegistry">The <see cref="IModFormatRegistry"/> that contains the list /// of supported <see cref="IModFormat"/>s.</param> /// <param name="p_strSearchPath">The path in which to search for mod format assemblies.</param> /// <param name="p_booRecurse">Whether to check sub folders of <paramref name="p_strSearchPath"/> for mods.</param> /// <param name="p_gmdGameMode">The game mode for which to discover mods.</param> /// <param name="p_strExcludedSubDirectories">The list of subdirectories not to examine for mods.</param> /// <returns>A registry containing all of the discovered mods.</returns> public static ModRegistry DiscoverManagedMods(IModFormatRegistry p_frgFormatRegistry, IModCacheManager p_frgCacheManager, string p_strSearchPath, bool p_booRecurse, IGameMode p_gmdGameMode, params string[] p_strExcludedSubDirectories) { Trace.TraceInformation("Discovering Managed Mods..."); Trace.Indent(); Trace.TraceInformation("Looking in: {0}", p_strSearchPath); List<string> lstExludedPaths = new List<string>(); for (Int32 i = 0; i < p_strExcludedSubDirectories.Length; i++) lstExludedPaths.Add((p_strExcludedSubDirectories[i].Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar).Trim(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar).ToLower()); ModRegistry mdrRegistry = new ModRegistry(p_frgFormatRegistry, p_gmdGameMode); string[] strMods = Directory.GetFiles(p_strSearchPath, "*", p_booRecurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); IMod modMod = null; List<string> modList = new List<String>(); bool booExcluded = false; foreach (string strMod in strMods) { string strModPath = strMod.ToLower(); booExcluded = false; foreach (string strExclusion in lstExludedPaths) if (strModPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar).StartsWith(strExclusion)) { booExcluded = true; break; } if (booExcluded) continue; Trace.TraceInformation("Found: {0}", strMod); try { string strCachePath = p_frgCacheManager.GetCacheFilePath(strMod); modMod = mdrRegistry.CreateMod(strMod, strCachePath, p_gmdGameMode); } catch { modList.Add(strMod); modMod = null; } if (modMod == null) continue; mdrRegistry.m_oclRegisteredMods.Add(modMod); Trace.Indent(); Trace.TraceInformation("Registered."); Trace.Unindent(); } if (modList.Count > 0) { string strErrorMessage = "Error loading the following mods: " + Environment.NewLine; foreach (string modstr in modList) { strErrorMessage += modstr + Environment.NewLine; } MessageBox.Show(strErrorMessage, "Mod loading error", MessageBoxButtons.OK, MessageBoxIcon.Information); } Trace.Unindent(); return mdrRegistry; }
/// <summary> /// A simple constructor that initializes the object with the required dependencies. /// </summary> /// <param name="p_mcmModCacheManager">The manager for the current game mode's mod cache.</param> /// <param name="p_stgScriptTypeRegistry">The registry of supported script types.</param> public FOModFormat(IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry) { ModCacheManager = p_mcmModCacheManager; IScriptTypeRegistry = p_stgScriptTypeRegistry; }
/// <summary> /// A simple constructor that initializes the FOMod from the specified file. /// </summary> /// <param name="p_strFilePath">The mod file from which to create the FOMod.</param> /// <param name="p_mftModFormat">The format of the mod.</param> /// <param name="p_strStopFolders">A list of folders names that indicate the root of the mod file structure.</param> /// <param name="p_strPluginsDirectoryName">The name of the folder that contains plugins.</param> /// <param name="p_mcmModCacheManager">The manager for the current game mode's mod cache.</param> /// <param name="p_stgScriptTypeRegistry">The registry of supported script types.</param> public FOMod(string p_strFilePath, FOModFormat p_mftModFormat, IEnumerable<string> p_enmStopFolders, string p_strPluginsDirectoryName, IEnumerable<string> p_enmPluginExtensions, IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry, bool p_booUsePlugins) { StopFolders = new List<string>(p_enmStopFolders); if (!StopFolders.Contains("fomod", StringComparer.OrdinalIgnoreCase)) StopFolders.Add("fomod"); PluginsDirectoryName = p_strPluginsDirectoryName; PluginExtensions = new List<string>(p_enmPluginExtensions); Format = p_mftModFormat; ScriptTypeRegistry = p_stgScriptTypeRegistry; bool p_booUseCache = true; m_booUsesPlugins = p_booUsePlugins; bool booCheckNested = true; bool booCheckPrefix = true; bool booCheckScript = true; bool booUpdateCacheInfo = false; bool booDirtyCache = false; string strCheckPrefix = null; string strCheckScriptPath = null; string strCheckScriptType = null; m_strFilePath = p_strFilePath; m_arcFile = new Archive(p_strFilePath); #region Check for cacheInfo.txt file m_arcCacheFile = p_mcmModCacheManager.GetCacheFile(m_strFilePath); if (m_arcCacheFile != null) { if (m_arcCacheFile.ContainsFile("cacheInfo.txt")) { byte[] bCacheInfo = m_arcCacheFile.GetFileContents("cacheInfo.txt"); string sCacheInfo = Encoding.UTF8.GetString(bCacheInfo, 0, bCacheInfo.Length); string[] strPref = sCacheInfo.Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries); if (strPref.Length > 0) { booCheckNested = Convert.ToBoolean(strPref[0]); if (strPref.Length > 1) { strCheckPrefix = strPref[1]; foreach (string Folder in IgnoreFolders) { if (strCheckPrefix.IndexOf(Folder, StringComparison.InvariantCultureIgnoreCase) >= 0) { booCheckNested = true; strCheckPrefix = String.Empty; booDirtyCache = true; break; } } if (!booDirtyCache) { if (strCheckPrefix.Equals("-")) strCheckPrefix = String.Empty; booCheckPrefix = false; if (strPref.Length > 2) { strCheckScriptPath = strPref[2]; if (strCheckScriptPath.Equals("-")) strCheckScriptPath = String.Empty; strCheckScriptType = strPref[3]; if (strCheckScriptType.Equals("-")) strCheckScriptType = String.Empty; booCheckScript = false; } } } } } } #endregion if (booCheckNested) { #region Temporary fix for nested .dazip files string[] strNested = m_arcFile.GetFiles("", "*.dazip", true); if (strNested.Length == 1) { string strFilePath = Path.Combine(Path.Combine(Path.GetTempPath(), "NMM"), strNested[0]); FileUtil.WriteAllBytes(strFilePath, GetFile(strNested[0])); if (File.Exists(strFilePath)) { m_arcFile = new Archive(strFilePath); m_strNestedFilePath = strFilePath; } } #endregion } m_arcFile.ReadOnlyInitProgressUpdated += new CancelProgressEventHandler(ArchiveFile_ReadOnlyInitProgressUpdated); if (booCheckPrefix) { FindPathPrefix(); booUpdateCacheInfo = true; } else { m_strPrefixPath = String.IsNullOrEmpty(strCheckPrefix) ? String.Empty : strCheckPrefix; } //check for script if (booCheckScript) { foreach (IScriptType stpScript in p_stgScriptTypeRegistry.Types) { foreach (string strScriptName in stpScript.FileNames) { string strScriptPath = Path.Combine("fomod", strScriptName); if (ContainsFile(strScriptPath)) { m_strInstallScriptPath = strScriptPath; m_stpInstallScriptType = stpScript; break; } } if (!String.IsNullOrEmpty(m_strInstallScriptPath)) break; } booUpdateCacheInfo = true; } else { m_strInstallScriptPath = strCheckScriptPath; m_stpInstallScriptType = String.IsNullOrEmpty(strCheckScriptType) ? null : p_stgScriptTypeRegistry.Types.FirstOrDefault(x => x.TypeName.Equals(strCheckScriptType)); } if (p_booUseCache) { m_arcCacheFile = p_mcmModCacheManager.GetCacheFile(m_strFilePath); //check to make sure the cache isn't bad if ((m_arcCacheFile != null) && !m_arcCacheFile.ContainsFile(GetRealPath("fomod/info.xml"))) { //bad cache - clear it m_arcCacheFile.Dispose(); m_arcCacheFile = null; } } m_arcFile.FilesChanged += new EventHandler(Archive_FilesChanged); //check for readme string strBaseName = Path.GetFileNameWithoutExtension(p_strFilePath); for (int i = 0; i < Readme.ValidExtensions.Length; i++) if (ContainsFile("readme - " + strBaseName + Readme.ValidExtensions[i])) { m_strReadmePath = "Readme - " + strBaseName + Readme.ValidExtensions[i]; break; } if (String.IsNullOrEmpty(m_strReadmePath)) for (int i = 0; i < Readme.ValidExtensions.Length; i++) if (ContainsFile("docs/readme - " + strBaseName + Readme.ValidExtensions[i])) { m_strReadmePath = "docs/Readme - " + strBaseName + Readme.ValidExtensions[i]; break; } //check for screenshot string[] strScreenshots; if (p_booUseCache && (m_arcCacheFile != null)) strScreenshots = m_arcCacheFile.GetFiles(GetRealPath("fomod"), "screenshot*", false); else strScreenshots = m_arcFile.GetFiles(GetRealPath("fomod"), "screenshot*", false); //TODO make sure the file is a valid image if (strScreenshots.Length > 0) m_strScreenshotPath = strScreenshots[0]; if (p_booUseCache && (m_arcCacheFile == null)) { string strTmpInfo = p_mcmModCacheManager.FileUtility.CreateTempDirectory(); try { Directory.CreateDirectory(Path.Combine(strTmpInfo, GetRealPath("fomod"))); if (ContainsFile("fomod/info.xml")) FileUtil.WriteAllBytes(Path.Combine(strTmpInfo, GetRealPath("fomod/info.xml")), GetFile("fomod/info.xml")); else FileUtil.WriteAllText(Path.Combine(strTmpInfo, GetRealPath("fomod/info.xml")), "<fomod/>"); if (!String.IsNullOrEmpty(m_strReadmePath)) FileUtil.WriteAllBytes(Path.Combine(strTmpInfo, GetRealPath(m_strReadmePath)), GetFile(m_strReadmePath)); if (!String.IsNullOrEmpty(m_strScreenshotPath)) FileUtil.WriteAllBytes(Path.Combine(strTmpInfo, GetRealPath(m_strScreenshotPath)), GetFile(m_strScreenshotPath)); m_arcCacheFile = p_mcmModCacheManager.CreateCacheFile(this, strTmpInfo); } finally { FileUtil.ForceDelete(strTmpInfo); } } if (booUpdateCacheInfo || (!m_arcCacheFile.ContainsFile("cacheInfo.txt"))) { Byte[] bteText = new UTF8Encoding(true).GetBytes(String.Format("{0}@@{1}@@{2}@@{3}", (!String.IsNullOrEmpty(m_strNestedFilePath)).ToString(), String.IsNullOrEmpty(m_strPrefixPath) ? "-" : m_strPrefixPath, String.IsNullOrEmpty(m_strInstallScriptPath) ? "-" : m_strInstallScriptPath, (m_stpInstallScriptType == null) ? "-" : m_stpInstallScriptType.TypeName)); if (bteText != null) m_arcCacheFile.ReplaceFile("cacheInfo.txt", bteText); } ModName = Path.GetFileNameWithoutExtension(m_strFilePath); LoadInfo(); }
/// <summary> /// A simple constructor that initializes the object with the required dependencies. /// </summary> /// <param name="p_mcmModCacheManager">The manager for the current game mode's mod cache.</param> /// <param name="p_stgScriptTypeRegistry">The registry of supported script types.</param> public OModFormat(IModCacheManager p_mcmModCacheManager, IScriptTypeRegistry p_stgScriptTypeRegistry) { ModCacheManager = p_mcmModCacheManager; IScriptTypeRegistry = p_stgScriptTypeRegistry; }