/// <summary> /// Edits the specified game specific value. /// </summary> /// <param name="p_strKey">The key of the edited Game Specific Value.</param> /// <param name="p_bteValue">The value to install.</param> /// <returns><c>true</c> if the value was set; <c>false</c> otherwise.</returns> public virtual bool EditGameSpecificValue(string p_strKey, byte[] p_bteValue) { if (m_booDontOverwriteAll) { return(false); } ShaderEdit sedShader = new ShaderEdit(p_strKey); SDPArchives sdpManager = new SDPArchives(GameModeInfo, FileUtility); if (!TouchedFiles.Contains(sdpManager.GetPath(sedShader.Package))) { TouchedFiles.Add(sdpManager.GetPath(sedShader.Package)); TransactionalFileManager.Snapshot(sdpManager.GetPath(sedShader.Package)); } IMod modOldMod = InstallLog.GetCurrentGameSpecificValueEditOwner(p_strKey); if (!m_booOverwriteAll && (modOldMod != null)) { string strMessage = String.Format("Shader '{0}' in package '{1}' has already been overwritten by '{2}'\n" + "Overwrite the changes?", sedShader.ShaderName, sedShader.Package, modOldMod.ModName); switch (m_dlgOverwriteConfirmationDelegate(strMessage, false, false)) { case OverwriteResult.YesToAll: m_booOverwriteAll = true; break; case OverwriteResult.NoToAll: m_booDontOverwriteAll = true; break; case OverwriteResult.Yes: break; default: return(false); } } byte[] oldData; if (!sdpManager.EditShader(sedShader.Package, sedShader.ShaderName, p_bteValue, out oldData)) { throw new Exception("Failed to edit the shader"); } //if we are overwriting an original shader, back it up if ((modOldMod == null) && (oldData != null)) { InstallLog.LogOriginalGameSpecificValue(p_strKey, oldData); } InstallLog.AddGameSpecificValueEdit(Mod, p_strKey, p_bteValue); return(true); }