/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// If the dependency is fulfilled the message is "Passed." If the dependency is not fulfilled the /// message informs the user of the installed version. /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public override string GetMessage(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = p_csmStateManager.GameMode.GameVersion; if (verInstalledVersion < MinimumVersion) return String.Format("This mod requires v{0} or higher of the game. You have {1}. Please update your game.", MinimumVersion, verInstalledVersion); return "Passed"; }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// If the dependency is fulfilled the message is "Passed." If the dependency is not fulfilled the /// message informs the user of the installed version. /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public override string GetMessage(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = p_csmStateManager.EnvironmentInfo.ApplicationVersion; if (verInstalledVersion < MinimumVersion) return String.Format("This mod requires v{0} or higher of {1}. You have {2}. Please update from {3}", MinimumVersion, p_csmStateManager.EnvironmentInfo.Settings.ModManagerName, verInstalledVersion, p_csmStateManager.EnvironmentInfo.Settings.ModManagerUrl); return "Passed"; }
/// <summary> /// Gets whether this step is visible. /// </summary> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if this step is visible, given the current state; /// <c>false</c> otherwise.</returns> public bool GetIsVisible(ConditionStateManager p_csmStateManager) { if (VisibilityCondition == null) { return(true); } return(VisibilityCondition.GetIsFulfilled(p_csmStateManager)); }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// <remarks> /// If the condition is fulfilled the message is "Passed." If the condition is not fulfilled the /// message uses the pattern: /// File '<file>' is not <state>. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public string GetMessage(ConditionStateManager p_csmStateManager) { if (GetIsFulfilled(p_csmStateManager)) { return("Passed"); } return(String.Format("File '{0}' is not {1}.", PluginPath, State.ToString())); }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// <remarks> /// If the condition is fulfilled the message is "Passed." If the condition is not fulfilled the /// message uses the pattern: /// Flag '<flag>' is not <value>. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public string GetMessage(ConditionStateManager p_csmStateManager) { if (GetIsFulfilled(p_csmStateManager)) { return("Passed"); } return(String.Format("Flag '{0}' is not {1}.", FlagName, Value)); }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <remarks> /// The condition is fulfilled if the specified flag has the specified value. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { string strValue = null; p_csmStateManager.FlagValues.TryGetValue(FlagName, out strValue); if (String.IsNullOrEmpty(Value)) return String.IsNullOrEmpty(strValue); return Value.Equals(strValue); }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// If the dependency is fulfilled the message is "Passed." If the dependency is not fulfilled the /// message informs the user of the installed version. /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public override string GetMessage(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = p_csmStateManager.EnvironmentInfo.ApplicationVersion; if (verInstalledVersion < MinimumVersion) { return(String.Format("This mod requires v{0} or higher of {1}. You have {2}. Please update from {3}", MinimumVersion, CommonData.ModManagerName, verInstalledVersion, p_csmStateManager.EnvironmentInfo.Settings.ModManagerUrl)); } return("Passed"); }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// If the dependency is fulfilled the message is "Passed." If the dependency is not fulfilled the /// message informs the user of the installed version. /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public override string GetMessage(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = ((FalloutNVGameMode)p_csmStateManager.GameMode).ScriptExtenderVersion; if (verInstalledVersion == null) return String.Format("This mod requires NVSE v{0} or higher. Please download from http://nvse.silverlock.org", MinimumVersion); else if (verInstalledVersion < MinimumVersion) return String.Format("This mod requires NVSE v{0} or higher. You have {1}. Please update from http://nvse.silverlock.org", MinimumVersion, verInstalledVersion); else return "Passed"; }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// If the dependency is fulfilled the message is "Passed." If the dependency is not fulfilled the /// message informs the user of the installed version. /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public override string GetMessage(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = p_csmStateManager.GameMode.GameVersion; if (verInstalledVersion < MinimumVersion) { return(String.Format("This mod requires v{0} or higher of the game. You have {1}. Please update your game.", MinimumVersion, verInstalledVersion)); } return("Passed"); }
/// <summary> /// Gets the plugin type. /// </summary> /// <remarks> /// The returned type is dependent upon external state. A list of patterns are matched /// against external state (e.g., installed files); the first pattern that is fulfilled /// determines the returned type. /// /// If no pattern is fulfilled, a default type if returned. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>The option type.</returns> /// <seealso cref="IOptionTypeResolver.ResolveOptionType(ConditionStateManager)"/> public OptionType ResolveOptionType(ConditionStateManager p_csmStateManager) { foreach (ConditionalTypePattern ctpPattern in m_lstPatterns) { if (ctpPattern.Condition.GetIsFulfilled(p_csmStateManager)) { return(ctpPattern.Type); } } return(m_ptpDefaultType); }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <remarks> /// The condition is fulfilled if the specified flag has the specified value. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { string strValue = null; p_csmStateManager.FlagValues.TryGetValue(FlagName, out strValue); if (String.IsNullOrEmpty(Value)) { return(String.IsNullOrEmpty(strValue)); } return(Value.Equals(strValue)); }
/// <summary> /// Installs and activates files are required. This method is used by the background worker. /// </summary> /// <param name="p_scpScript">The XMl Script to execute.</param> protected bool InstallFiles(XmlScript p_xscScript, ConditionStateManager p_csmStateManager, ICollection <InstallableFile> p_colFilesToInstall, ICollection <InstallableFile> p_colPluginsToActivate) { IList <InstallableFile> lstRequiredFiles = p_xscScript.RequiredInstallFiles; IList <ConditionallyInstalledFileSet> lstConditionallyInstalledFileSets = p_xscScript.ConditionallyInstalledFileSets; OverallProgressMaximum = lstRequiredFiles.Count + p_colFilesToInstall.Count + lstConditionallyInstalledFileSets.Count; foreach (InstallableFile iflRequiredFile in lstRequiredFiles) { if (Status == TaskStatus.Cancelling) { return(false); } if (!InstallFile(iflRequiredFile, true)) { return(false); } StepOverallProgress(); } foreach (InstallableFile ilfFile in p_colFilesToInstall) { if (Status == TaskStatus.Cancelling) { return(false); } if (!InstallFile(ilfFile, p_colPluginsToActivate.Contains(ilfFile))) { return(false); } StepOverallProgress(); } foreach (ConditionallyInstalledFileSet cisFileSet in lstConditionallyInstalledFileSets) { if (cisFileSet.Condition.GetIsFulfilled(p_csmStateManager)) { foreach (InstallableFile ilfFile in cisFileSet.Files) { if (Status == TaskStatus.Cancelling) { return(false); } if (!InstallFile(ilfFile, true)) { return(false); } } } StepOverallProgress(); } return(true); }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// <remarks> /// If the condition is fulfilled the message is "Passed." If the condition is not fulfilled the /// message is a list of the sub-dependecies' messages. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public string GetMessage(ConditionStateManager p_csmStateManager) { StringBuilder stbMessage = new StringBuilder(); if (m_dopOperator == ConditionOperator.Or) { stbMessage.Append("("); } bool booAllFulfilled = (m_dopOperator == ConditionOperator.And) ? true : false; bool booThisFulfilled = true; ICondition conCondition = null; for (Int32 i = 0; i < m_lstConditions.Count; i++) { conCondition = m_lstConditions[i]; booThisFulfilled = conCondition.GetIsFulfilled(p_csmStateManager); if (!booThisFulfilled) { stbMessage.Append(conCondition.GetMessage(p_csmStateManager)); } switch (m_dopOperator) { case ConditionOperator.And: if (i < m_lstConditions.Count - 1) { stbMessage.AppendLine(); } booAllFulfilled &= booThisFulfilled; break; case ConditionOperator.Or: if (i < m_lstConditions.Count - 1) { stbMessage.AppendLine(" OR"); } booAllFulfilled |= booThisFulfilled; break; } } if (m_dopOperator == ConditionOperator.Or) { stbMessage.Append(")"); } return(booAllFulfilled ? "Passed" : stbMessage.ToString()); }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <remarks> /// The condition is fulfilled if the specified <see cref="File"/> is in the /// specified <see cref="State"/>. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { string strPluginPath = p_csmStateManager.GameMode.GetModFormatAdjustedPath(p_csmStateManager.Mod.Format, m_strPluginPath); if (p_csmStateManager.PluginManager != null) { switch (m_pnsState) { case PluginState.Active: return(p_csmStateManager.PluginManager.IsPluginActive(strPluginPath)); case PluginState.Inactive: return(p_csmStateManager.PluginManager.IsPluginRegistered(strPluginPath) && !p_csmStateManager.PluginManager.IsPluginActive(strPluginPath)); case PluginState.Missing: return(!p_csmStateManager.PluginManager.IsPluginRegistered(strPluginPath)); } } return(false); }
/// <summary> /// Performs the mod installation based on the XML script. /// </summary> /// <param name="p_strModName">The name of the mod whose script in executing.</param> /// <param name="p_xscScript">The script that is executing.</param> /// <param name="p_csmStateManager">The state manager managing the install state.</param> /// <param name="p_colFilesToInstall">The list of files to install.</param> /// <param name="p_colPluginsToActivate">The list of plugins to activate.</param> /// <returns><c>true</c> if the installation succeeded; /// <c>false</c> otherwise.</returns> public bool Install(string p_strModName, XmlScript p_xscScript, ConditionStateManager p_csmStateManager, ICollection <InstallableFile> p_colFilesToInstall, ICollection <InstallableFile> p_colPluginsToActivate) { OverallMessage = String.Format("Installing {0}", p_strModName); OverallProgressStepSize = 1; ItemProgressStepSize = 1; ShowItemProgress = true; bool booSuccess = false; try { booSuccess = InstallFiles(p_xscScript, p_csmStateManager, p_colFilesToInstall, p_colPluginsToActivate); Status = Status == TaskStatus.Cancelling ? TaskStatus.Cancelled : TaskStatus.Complete; } catch { booSuccess = false; Status = TaskStatus.Error; } OnTaskEnded(booSuccess); return(booSuccess); }
/// <summary> /// Determines if the given composite condition if fulfilled. /// </summary> /// <remarks> /// A composite condition is fulfilled if and only if its contained conditions /// are fulfilled in the combination specified by the <see cref="Operator"/>. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { bool booAllFulfilled = (m_dopOperator == ConditionOperator.And) ? true : false; bool booThisFulfilled = true; foreach (ICondition conCondition in m_lstConditions) { booThisFulfilled = conCondition.GetIsFulfilled(p_csmStateManager); switch (m_dopOperator) { case ConditionOperator.And: booAllFulfilled &= booThisFulfilled; break; case ConditionOperator.Or: booAllFulfilled |= booThisFulfilled; break; } } return(booAllFulfilled); }
/// <summary> /// Performs the mod installation based on the XML script. /// </summary> /// <param name="p_strModName">The name of the mod whose script in executing.</param> /// <param name="p_xscScript">The script that is executing.</param> /// <param name="p_csmStateManager">The state manager managing the install state.</param> /// <param name="p_colFilesToInstall">The list of files to install.</param> /// <param name="p_colPluginsToActivate">The list of plugins to activate.</param> /// <returns><c>true</c> if the installation succeeded; /// <c>false</c> otherwise.</returns> public bool Install(string p_strModName, XmlScript p_xscScript, ConditionStateManager p_csmStateManager, ICollection<InstallableFile> p_colFilesToInstall, ICollection<InstallableFile> p_colPluginsToActivate) { OverallMessage = String.Format("Installing {0}", p_strModName); OverallProgressStepSize = 1; ItemProgressStepSize = 1; ShowItemProgress = true; bool booSuccess = false; try { booSuccess = InstallFiles(p_xscScript, p_csmStateManager, p_colFilesToInstall, p_colPluginsToActivate); Status = Status == TaskStatus.Cancelling ? TaskStatus.Cancelled : TaskStatus.Complete; } catch (Exception ex) { booSuccess = false; Status = TaskStatus.Error; throw new Exception(ex.Message); } OnTaskEnded(booSuccess); return booSuccess; }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <remarks> /// The dependency is fulfilled if the specified minimum version of /// the game is installed. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public override bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = p_csmStateManager.GameMode.GameVersion; return((verInstalledVersion != null) && (verInstalledVersion >= MinimumVersion)); }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <remarks> /// The dependency is fulfilled if the specified minimum version of /// NVSE is installed. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public override bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = ((FalloutNVGameMode)p_csmStateManager.GameMode).ScriptExtenderVersion; return ((verInstalledVersion != null) && (verInstalledVersion >= MinimumVersion)); }
/// <summary> /// Executes the script. /// </summary> /// <param name="p_scpScript">The XMl Script to execute.</param> /// <returns><c>true</c> if the script completes successfully; /// <c>false</c> otherwise.</returns> /// <exception cref="ArgumentException">Thrown if <paramref name="p_scpScript"/> is not an /// <see cref="XmlScript"/>.</exception> public override bool DoExecute(IScript p_scpScript) { if (!(p_scpScript is XmlScript)) { throw new ArgumentException("The given script must be of type XmlScript.", "p_scpScript"); } XmlScript xscScript = (XmlScript)p_scpScript; ConditionStateManager csmStateManager = ((XmlScriptType)xscScript.Type).CreateConditionStateManager(Mod, GameMode, Installers.PluginManager, EnvironmentInfo); if ((xscScript.ModPrerequisites != null) && !xscScript.ModPrerequisites.GetIsFulfilled(csmStateManager)) { throw new DependencyException(xscScript.ModPrerequisites.GetMessage(csmStateManager)); } IList <InstallStep> lstSteps = xscScript.InstallSteps; HeaderInfo hifHeaderInfo = xscScript.HeaderInfo; if (String.IsNullOrEmpty(hifHeaderInfo.ImagePath)) { hifHeaderInfo.ImagePath = Mod.ScreenshotPath; } if ((hifHeaderInfo.Height < 0) && hifHeaderInfo.ShowImage) { hifHeaderInfo.Height = 75; } OptionsForm ofmOptions = null; if (m_scxSyncContext == null) { ofmOptions = new OptionsForm(xscScript, hifHeaderInfo, csmStateManager, lstSteps); } else { m_scxSyncContext.Send(x => ofmOptions = new OptionsForm(xscScript, hifHeaderInfo, csmStateManager, lstSteps), null); } ofmOptions.Name = "OptionForm"; bool booPerformInstall = false; if (lstSteps.Count == 0) { booPerformInstall = true; } else { if (m_scxSyncContext == null) { booPerformInstall = (ofmOptions.ShowDialog() == DialogResult.OK); } else { m_scxSyncContext.Send(x => booPerformInstall = (ofmOptions.ShowDialog() == DialogResult.OK), null); } } if (booPerformInstall) { XmlScriptInstaller xsiInstaller = new XmlScriptInstaller(Mod, GameMode, Installers); OnTaskStarted(xsiInstaller); return(xsiInstaller.Install(hifHeaderInfo.Title, xscScript, csmStateManager, ofmOptions.FilesToInstall, ofmOptions.PluginsToActivate)); } return(false); }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// <remarks> /// If the condition is fulfilled the message is "Passed." If the condition is not fulfilled the /// message is a list of the sub-dependecies' messages. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public string GetMessage(ConditionStateManager p_csmStateManager) { StringBuilder stbMessage = new StringBuilder(); if (m_dopOperator == ConditionOperator.Or) stbMessage.Append("("); bool booAllFulfilled = (m_dopOperator == ConditionOperator.And) ? true : false; bool booThisFulfilled = true; ICondition conCondition = null; for (Int32 i = 0; i < m_lstConditions.Count; i++) { conCondition = m_lstConditions[i]; booThisFulfilled = conCondition.GetIsFulfilled(p_csmStateManager); if (!booThisFulfilled) stbMessage.Append(conCondition.GetMessage(p_csmStateManager)); switch (m_dopOperator) { case ConditionOperator.And: if (i < m_lstConditions.Count - 1) stbMessage.AppendLine(); booAllFulfilled &= booThisFulfilled; break; case ConditionOperator.Or: if (i < m_lstConditions.Count - 1) stbMessage.AppendLine(" OR"); booAllFulfilled |= booThisFulfilled; break; } } if (m_dopOperator == ConditionOperator.Or) stbMessage.Append(")"); return booAllFulfilled ? "Passed" : stbMessage.ToString(); }
/// <summary> /// Gets the plugin type. /// </summary> /// <remarks> /// The returned type is dependent upon external state. A list of patterns are matched /// against external state (e.g., installed files); the first pattern that is fulfilled /// determines the returned type. /// /// If no pattern is fulfilled, a default type if returned. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>The option type.</returns> /// <seealso cref="IOptionTypeResolver.ResolveOptionType(ConditionStateManager)"/> public OptionType ResolveOptionType(ConditionStateManager p_csmStateManager) { foreach (ConditionalTypePattern ctpPattern in m_lstPatterns) if (ctpPattern.Condition.GetIsFulfilled(p_csmStateManager)) return ctpPattern.Type; return m_ptpDefaultType; }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public abstract string GetMessage(ConditionStateManager p_csmStateManager);
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// <remarks> /// If the condition is fulfilled the message is "Passed." If the condition is not fulfilled the /// message uses the pattern: /// File '<file>' is not <state>. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public string GetMessage(ConditionStateManager p_csmStateManager) { if (GetIsFulfilled(p_csmStateManager)) return "Passed"; return String.Format("File '{0}' is not {1}.", PluginPath, State.ToString()); }
/// <summary> /// Gets the <see cref="OptionType"/> of the option. /// </summary> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>The <see cref="OptionType"/> of the option.</returns> public OptionType GetOptionType(ConditionStateManager p_csmStateManager) { return m_otrTypeResolver.ResolveOptionType(p_csmStateManager); }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <remarks> /// The condition is fulfilled if the specified <see cref="File"/> is in the /// specified <see cref="State"/>. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { string strPluginPath = p_csmStateManager.GameMode.GetModFormatAdjustedPath(p_csmStateManager.Mod.Format, m_strPluginPath); if (p_csmStateManager.PluginManager != null) { switch (m_pnsState) { case PluginState.Active: return p_csmStateManager.PluginManager.IsPluginActive(strPluginPath); case PluginState.Inactive: return (p_csmStateManager.PluginManager.IsPluginRegistered(strPluginPath) && !p_csmStateManager.PluginManager.IsPluginActive(strPluginPath)); case PluginState.Missing: return !p_csmStateManager.PluginManager.IsPluginRegistered(strPluginPath); } } return false; }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <remarks> /// The dependency is fulfilled if the specified minimum version of /// the game is installed. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public override bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = p_csmStateManager.EnvironmentInfo.ApplicationVersion; return ((verInstalledVersion != null) && (verInstalledVersion >= MinimumVersion)); }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <remarks> /// The dependency is fulfilled if the specified minimum version of /// the game is installed. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public override bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = p_csmStateManager.GameMode.GameVersion; return ((verInstalledVersion != null) && (verInstalledVersion >= MinimumVersion)); }
/// <summary> /// Gets the <see cref="OptionType"/> of the option. /// </summary> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>The <see cref="OptionType"/> of the option.</returns> public OptionType GetOptionType(ConditionStateManager p_csmStateManager) { return(m_otrTypeResolver.ResolveOptionType(p_csmStateManager)); }
/// <summary> /// Gets the option type. /// </summary> /// <returns>The option type.</returns> /// <seealso cref="IOptionType.GetOptionType(ConditionStateManager)"/> public OptionType ResolveOptionType(ConditionStateManager p_csmStateManager) { return m_ptpType; }
/// <summary> /// Gets the option type. /// </summary> /// <returns>The option type.</returns> /// <seealso cref="IOptionType.GetOptionType(ConditionStateManager)"/> public OptionType ResolveOptionType(ConditionStateManager p_csmStateManager) { return(m_ptpType); }
/// <summary> /// Determines if the given composite condition if fulfilled. /// </summary> /// <remarks> /// A composite condition is fulfilled if and only if its contained conditions /// are fulfilled in the combination specified by the <see cref="Operator"/>. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { bool booAllFulfilled = (m_dopOperator == ConditionOperator.And) ? true : false; bool booThisFulfilled = true; foreach (ICondition conCondition in m_lstConditions) { booThisFulfilled = conCondition.GetIsFulfilled(p_csmStateManager); switch (m_dopOperator) { case ConditionOperator.And: booAllFulfilled &= booThisFulfilled; break; case ConditionOperator.Or: booAllFulfilled |= booThisFulfilled; break; } } return booAllFulfilled; }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <remarks> /// The dependency is fulfilled if the specified minimum version of /// the game is installed. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> /// <seealso cref="ICondition.GetIsFulfilled(ConditionStateManager)"/> public override bool GetIsFulfilled(ConditionStateManager p_csmStateManager) { Version verInstalledVersion = p_csmStateManager.EnvironmentInfo.ApplicationVersion; return((verInstalledVersion != null) && (verInstalledVersion >= MinimumVersion)); }
/// <summary> /// Gets a message describing whether or not the condition is fulfilled. /// </summary> /// <remarks> /// If the condition is fulfilled the message is "Passed." If the condition is not fulfilled the /// message uses the pattern: /// Flag '<flag>' is not <value>. /// </remarks> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns>A message describing whether or not the condition is fulfilled.</returns> /// <seealso cref="ICondition.GetMessage(ConditionStateManager)"/> public string GetMessage(ConditionStateManager p_csmStateManager) { if (GetIsFulfilled(p_csmStateManager)) return "Passed"; return String.Format("Flag '{0}' is not {1}.", FlagName, Value); }
/// <summary> /// Gets whether or not the condition is fulfilled. /// </summary> /// <param name="p_csmStateManager">The manager that tracks the currect install state.</param> /// <returns><c>true</c> if the condition is fulfilled; /// <c>false</c> otherwise.</returns> public abstract bool GetIsFulfilled(ConditionStateManager p_csmStateManager);
/// <summary> /// Installs and activates files are required. This method is used by the background worker. /// </summary> /// <param name="p_scpScript">The XMl Script to execute.</param> protected bool InstallFiles(XmlScript p_xscScript, ConditionStateManager p_csmStateManager, ICollection<InstallableFile> p_colFilesToInstall, ICollection<InstallableFile> p_colPluginsToActivate) { IList<InstallableFile> lstRequiredFiles = p_xscScript.RequiredInstallFiles; IList<ConditionallyInstalledFileSet> lstConditionallyInstalledFileSets = p_xscScript.ConditionallyInstalledFileSets; OverallProgressMaximum = lstRequiredFiles.Count + p_colFilesToInstall.Count + lstConditionallyInstalledFileSets.Count; foreach (InstallableFile iflRequiredFile in lstRequiredFiles) { if (Status == TaskStatus.Cancelling) return false; if (!InstallFile(iflRequiredFile, true)) return false; StepOverallProgress(); } foreach (InstallableFile ilfFile in p_colFilesToInstall) { if (Status == TaskStatus.Cancelling) return false; if (!InstallFile(ilfFile, p_colPluginsToActivate.Contains(ilfFile))) return false; StepOverallProgress(); } foreach (ConditionallyInstalledFileSet cisFileSet in lstConditionallyInstalledFileSets) { if (cisFileSet.Condition.GetIsFulfilled(p_csmStateManager)) foreach (InstallableFile ilfFile in cisFileSet.Files) { if (Status == TaskStatus.Cancelling) return false; if (!InstallFile(ilfFile, true)) return false; } StepOverallProgress(); } return true; }