/// <summary> /// What the instruction should do /// </summary> protected override void _Process() { // Checking parameters string fileName = _GetParameter(PatchInstructionParameter.ParameterName.mappedFileName, false); string cleanFileName = fileName.Replace(@"\", "_"); string lockCode = _GetParameter(PatchInstructionParameter.ParameterName.lockCode, false); // Checks if specified BNK file has already been remapped string modName = InstallHelper.GetAlreadyRemappedModNames(cleanFileName); if (string.Empty.Equals(modName) || modName.Contains(PatchHelper.CurrentPatch.Name) || InstallHelper.IsSameLockCode(cleanFileName, lockCode)) { // Not remapped yet or overwrite allowed, telling installer to create file during finalization InstallHelper.RemappedFiles.Add(cleanFileName, lockCode); } else { // Already remapped string realFileName = _GetParameter(PatchInstructionParameter.ParameterName.mappedFileName, true); string message = string.Format("'{0}' mod(s) already replacing following file:\r\n{1}", modName, realFileName); PatchHelper.AddMessage(string.Concat(message, Environment.NewLine, "Please uninstall this mod first.")); throw new Exception(message); } }
/// <summary> /// What the instruction should do /// </summary> protected override void _Process() { // Checking parameters string fileName = _GetParameter(PatchInstructionParameter.ParameterName.mappedFileName, false); string cleanFileName = fileName.Replace(@"\", "_"); // Checks if specified BNK file has already been remapped string modNames = InstallHelper.GetAlreadyRemappedModNames(cleanFileName); if (modNames != null && modNames.Contains(PatchHelper.CurrentPatch.Name)) { // Telling installer to remove file lock InstallHelper.RemappedFiles.Add(cleanFileName, null); } }