/// <summary>
        /// Enables AI.
        /// </summary>
        protected override void ApplyAI()
        {
            string strPluginsPath = GameMode.PluginDirectory;

            foreach (FileInfo fi in new DirectoryInfo(strPluginsPath).GetFiles("Oblivion - *.bsa"))
            {
                fi.LastWriteTime = new DateTime(2005, 10, 1);
            }
            foreach (FileInfo fi in new DirectoryInfo(strPluginsPath).GetFiles("DLC*.bsa"))
            {
                fi.LastWriteTime = new DateTime(2005, 10, 1);
            }
            foreach (FileInfo fi in new DirectoryInfo(strPluginsPath).GetFiles("Knights.bsa"))
            {
                fi.LastWriteTime = new DateTime(2005, 10, 1);
            }

            string strIniPath = GameMode.SettingsFiles.IniPath;

            IniMethods.WritePrivateProfileString("Archive", "SInvalidationFile", "", strIniPath);
            FileUtil.ForceDelete(Path.Combine(strPluginsPath, "archiveinvalidation.txt"));
            FileUtil.ForceDelete(Path.Combine(Path.Combine(GameMode.GameModeEnvironmentInfo.InstallationPath, "obmm"), AI_BSA));
            File.WriteAllBytes(Path.Combine(strPluginsPath, AI_BSA), new byte[] {
                0x42, 0x53, 0x41, 0x00, 0x67, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x02, 0x00, 0x00, 0x00
            });
            IniMethods.WritePrivateProfileString("Archive", "SArchiveList", GetBSAList(true), strIniPath);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Disables AI.
        /// </summary>
        protected override void RemoveAI()
        {
            string strIniPath = GameMode.SettingsFiles.IniPath;

            IniMethods.WritePrivateProfileString("Archive", "SInvalidationFile", "ArchiveInvalidation.txt", strIniPath);
            FileUtil.ForceDelete(Path.Combine(GameMode.PluginDirectory, AI_BSA));
            FileUtil.ForceDelete(Path.Combine(Path.Combine(GameMode.GameModeEnvironmentInfo.InstallationPath, "obmm"), AI_BSA));
            IniMethods.WritePrivateProfileString("Archive", "SArchiveList", GetBSAList(false), strIniPath);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Writes the given value to both the Fallout INI file and the default Fallout INI file.
        /// </summary>
        /// <param name="p_strSection">The section containing the key whose value is to be written.</param>
        /// <param name="p_strValueKey">The key whose value is to be written.</param>
        /// <param name="p_strValue">The value to write.</param>
        private void WriteIniString(string p_strSection, string p_strValueKey, string p_strValue)
        {
            IniMethods.WritePrivateProfileString(p_strSection, p_strValueKey, p_strValue, GameMode.SettingsFiles.IniPath);
            string strIniPath = ((FalloutNVSettingsFiles)GameMode.SettingsFiles).FODefaultIniPath;

            if (File.Exists(strIniPath))
            {
                IniMethods.WritePrivateProfileString(p_strSection, p_strValueKey, p_strValue, strIniPath);
            }
        }
        /// <summary>
        /// Disables AI.
        /// </summary>
        protected override void RemoveAI()
        {
            string strFalloutIniPath = GameMode.SettingsFiles.IniPath;

            IniMethods.WritePrivateProfileInt32("Archive", "bInvalidateOlderFiles", 0, strFalloutIniPath);
            IniMethods.WritePrivateProfileInt32("General", "bLoadFaceGenHeadEGTFiles", 0, strFalloutIniPath);
            IniMethods.WritePrivateProfileString("Archive", "SInvalidationFile", "ArchiveInvalidation.txt", strFalloutIniPath);
            File.Delete(Path.Combine(GameMode.PluginDirectory, AI_BSA));
            IniMethods.WritePrivateProfileString("Archive", "SArchiveList", GetBSAList(), strFalloutIniPath);
        }
        /// <summary>
        /// Registers the BSA in the game's BSA list.
        /// </summary>
        /// <param name="p_strBsaPath">The BSA to register.</param>
        public void RegisterBSA(string p_strBsaPath)
        {
            List <string> lstBsas      = GetBSAList();
            string        strFixedPath = GameMode.GetModFormatAdjustedPath(Mod.Format, p_strBsaPath);

            if (lstBsas.Contains(strFixedPath, StringComparer.OrdinalIgnoreCase))
            {
                return;
            }
            lstBsas.Add(strFixedPath);
            string strIniPath = ((OblivionGameMode)GameMode).SettingsFiles.IniPath;

            IniMethods.WritePrivateProfileString("Archive", "SArchiveList", String.Join(", ", lstBsas.ToArray()), strIniPath);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Unregisters the BSA in the game's BSA list.
        /// </summary>
        /// <param name="p_strBsaPath">The BSA to unregister.</param>
        public void UnregisterBSA(string p_strBsaPath)
        {
            List <string> lstBsas      = GetBSAList();
            string        strFixedPath = GameMode.GetModFormatAdjustedPath(Mod.Format, p_strBsaPath, true);
            Int32         intIndex     = lstBsas.IndexOf(strFixedPath, StringComparer.OrdinalIgnoreCase);

            if (intIndex < 0)
            {
                return;
            }
            lstBsas.RemoveAt(intIndex);
            string strIniPath = ((OblivionGameMode)GameMode).SettingsFiles.IniPath;

            IniMethods.WritePrivateProfileString("Archive", "SArchiveList", String.Join(", ", lstBsas.ToArray()), strIniPath);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Enables AI.
        /// </summary>
        protected override void ApplyAI()
        {
            var pluginsPath = GameMode.PluginDirectory;

            try
            {
                foreach (var fi in new DirectoryInfo(pluginsPath).GetFiles("Oblivion - *.bsa"))
                {
                    fi.LastWriteTime = new DateTime(2005, 10, 1);
                }

                foreach (var fi in new DirectoryInfo(pluginsPath).GetFiles("DLC*.bsa"))
                {
                    fi.LastWriteTime = new DateTime(2005, 10, 1);
                }

                foreach (var fi in new DirectoryInfo(pluginsPath).GetFiles("Knights.bsa"))
                {
                    fi.LastWriteTime = new DateTime(2005, 10, 1);
                }

                var iniPath = GameMode.SettingsFiles.IniPath;
                IniMethods.WritePrivateProfileString("Archive", "SInvalidationFile", "", iniPath);
                FileUtil.ForceDelete(Path.Combine(pluginsPath, "archiveinvalidation.txt"));
                FileUtil.ForceDelete(
                    Path.Combine(Path.Combine(GameMode.GameModeEnvironmentInfo.InstallationPath, "obmm"), AI_BSA));
                File.WriteAllBytes(Path.Combine(pluginsPath, AI_BSA), new byte[]
                {
                    0x42, 0x53, 0x41, 0x00, 0x67, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00,
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x02, 0x00, 0x00, 0x00
                });
                IniMethods.WritePrivateProfileString("Archive", "SArchiveList", GetBSAList(true), iniPath);
            }
            catch (Exception ex)
            {
                Trace.TraceError("ApplyAI - Could not apply ArchiveInvalidation.");
                TraceUtil.TraceException(ex);

                MessageBox.Show(
                    "Could not apply Archive Invalidation, at least one file could not be modified.\n" +
                    "Please try again, or check trace log for more info.\n\n" +
                    ex.Message,
                    "Archive Invalidation failed",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// Enables AI.
        /// </summary>
        protected override void ApplyAI()
        {
            string strPluginsPath = GameMode.PluginDirectory;

            foreach (FileInfo fi in new DirectoryInfo(strPluginsPath).GetFiles("Fallout - *.bsa"))
            {
                fi.LastWriteTime = new DateTime(2008, 10, 1);
            }
            foreach (FileInfo fi in new DirectoryInfo(strPluginsPath).GetFiles("Anchorage - *.bsa"))
            {
                fi.LastWriteTime = new DateTime(2008, 10, 2);
            }
            foreach (FileInfo fi in new DirectoryInfo(strPluginsPath).GetFiles("ThePitt - *.bsa"))
            {
                fi.LastWriteTime = new DateTime(2008, 10, 3);
            }
            foreach (FileInfo fi in new DirectoryInfo(strPluginsPath).GetFiles("BrokenSteel - *.bsa"))
            {
                fi.LastWriteTime = new DateTime(2008, 10, 4);
            }
            foreach (FileInfo fi in new DirectoryInfo(strPluginsPath).GetFiles("PointLookout - *.bsa"))
            {
                fi.LastWriteTime = new DateTime(2008, 10, 5);
            }
            foreach (FileInfo fi in new DirectoryInfo(strPluginsPath).GetFiles("Zeta - *.bsa"))
            {
                fi.LastWriteTime = new DateTime(2008, 10, 6);
            }

            string strFalloutIniPath = GameMode.SettingsFiles.IniPath;

            IniMethods.WritePrivateProfileInt32("Archive", "bInvalidateOlderFiles", 1, strFalloutIniPath);
            IniMethods.WritePrivateProfileInt32("General", "bLoadFaceGenHeadEGTFiles", 1, strFalloutIniPath);
            IniMethods.WritePrivateProfileString("Archive", "SInvalidationFile", "", strFalloutIniPath);
            File.Delete(Path.Combine(strPluginsPath, "archiveinvalidation.txt"));
            File.WriteAllBytes(Path.Combine(strPluginsPath, AI_BSA), new byte[] {
                0x42, 0x53, 0x41, 0x00, 0x67, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00,
                0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
                0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
                0x36, 0x00, 0x00, 0x00, 0x01, 0x00, 0x61, 0x00, 0x01, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x61, 0x00
            });
            IniMethods.WritePrivateProfileString("Archive", "SArchiveList", AI_BSA + ", " + GetBSAList(), strFalloutIniPath);
        }
        /// <summary>
        /// Enables AI.
        /// </summary>
        protected override void ApplyAI()
        {
            var pluginsPath = GameMode.PluginDirectory;

            try
            {
                foreach (var fi in new DirectoryInfo(pluginsPath).GetFiles("Fallout - *.bsa"))
                {
                    fi.LastWriteTime = new DateTime(2008, 10, 1);
                }

                foreach (var fi in new DirectoryInfo(pluginsPath).GetFiles("Anchorage - *.bsa"))
                {
                    fi.LastWriteTime = new DateTime(2008, 10, 2);
                }

                foreach (var fi in new DirectoryInfo(pluginsPath).GetFiles("ThePitt - *.bsa"))
                {
                    fi.LastWriteTime = new DateTime(2008, 10, 3);
                }

                foreach (var fi in new DirectoryInfo(pluginsPath).GetFiles("BrokenSteel - *.bsa"))
                {
                    fi.LastWriteTime = new DateTime(2008, 10, 4);
                }

                foreach (var fi in new DirectoryInfo(pluginsPath).GetFiles("PointLookout - *.bsa"))
                {
                    fi.LastWriteTime = new DateTime(2008, 10, 5);
                }

                foreach (var fi in new DirectoryInfo(pluginsPath).GetFiles("Zeta - *.bsa"))
                {
                    fi.LastWriteTime = new DateTime(2008, 10, 6);
                }

                var falloutIniPath = GameMode.SettingsFiles.IniPath;

                IniMethods.WritePrivateProfileInt32("Archive", "bInvalidateOlderFiles", 1, falloutIniPath);
                IniMethods.WritePrivateProfileInt32("General", "bLoadFaceGenHeadEGTFiles", 1, falloutIniPath);
                IniMethods.WritePrivateProfileString("Archive", "SInvalidationFile", "", falloutIniPath);
                File.Delete(Path.Combine(pluginsPath, "archiveinvalidation.txt"));
                File.WriteAllBytes(Path.Combine(pluginsPath, AI_BSA), new byte[]
                {
                    0x42, 0x53, 0x41, 0x00, 0x67, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00,
                    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
                    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
                    0x36, 0x00, 0x00, 0x00, 0x01, 0x00, 0x61, 0x00, 0x01, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x61, 0x00
                });
                IniMethods.WritePrivateProfileString("Archive", "SArchiveList", AI_BSA + ", " + GetBSAList(), falloutIniPath);
            }
            catch (Exception ex)
            {
                Trace.TraceError("ApplyAI - Could not apply ArchiveInvalidation.");
                TraceUtil.TraceException(ex);

                MessageBox.Show(
                    "Could not apply Archive Invalidation, at least one file could not be modified.\n" +
                    "Please try again, or check trace log for more info.\n\n" +
                    ex.Message,
                    "Archive Invalidation failed",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }