Example #1
0
        /// <summary>
        /// A simple constructor that initializes the object with the given values.
        /// </summary>
        /// <param name="p_xcsScript">The install script.</param>
        /// <param name="p_hifHeaderInfo">Information describing the form header.</param>
        /// <param name="p_dsmStateManager">The install state manager.</param>
        /// <param name="p_lstInstallSteps">The install steps.</param>
        public OptionsForm(XmlConfiguredScript p_xcsScript, HeaderInfo p_hifHeaderInfo, DependencyStateManager p_dsmStateManager, IList<InstallStep> p_lstInstallSteps)
        {
            m_xcsScript = p_xcsScript;
            m_dsmStateManager = p_dsmStateManager;
            InitializeComponent();
            hplTitle.Text = p_hifHeaderInfo.Title;
            hplTitle.Image = p_hifHeaderInfo.ShowImage ? p_hifHeaderInfo.Image : null;
            hplTitle.ShowFade = p_hifHeaderInfo.ShowFade;
            hplTitle.ForeColor = p_hifHeaderInfo.TextColour;
            hplTitle.TextPosition = p_hifHeaderInfo.TextPosition;
            if (p_hifHeaderInfo.Height > hplTitle.Height)
                hplTitle.Height = p_hifHeaderInfo.Height;

            foreach (InstallStep stpStep in p_lstInstallSteps)
            {
                OptionFormStep ofsStep = new OptionFormStep(m_dsmStateManager, stpStep.GroupedPlugins);
                ofsStep.Dock = DockStyle.Fill;
                ofsStep.Visible = false;
                ofsStep.ItemChecked += new EventHandler(ofsStep_ItemChecked);
                pnlWizardSteps.Controls.Add(ofsStep);
                m_lstInstallSteps.Add(new KeyValuePair<InstallStep, OptionFormStep>(stpStep, ofsStep));
            }
            m_intCurrentStep = -1;
            StepForward();
        }
Example #2
0
        /// <summary>
        ///   A simple constructor that initializes the object with the given values.
        /// </summary>
        /// <param name="p_xcsScript">The install script.</param>
        /// <param name="p_hifHeaderInfo">Information describing the form header.</param>
        /// <param name="p_dsmStateManager">The install state manager.</param>
        /// <param name="p_lstInstallSteps">The install steps.</param>
        public OptionsForm(XmlConfiguredScript p_xcsScript, HeaderInfo p_hifHeaderInfo,
                           DependencyStateManager p_dsmStateManager, IList <InstallStep> p_lstInstallSteps)
        {
            InitializeComponent();
            hplTitle.Text         = p_hifHeaderInfo.Title;
            hplTitle.Image        = p_hifHeaderInfo.ShowImage ? p_hifHeaderInfo.Image : null;
            hplTitle.ShowFade     = p_hifHeaderInfo.ShowFade;
            hplTitle.ForeColor    = p_hifHeaderInfo.TextColour;
            hplTitle.TextPosition = p_hifHeaderInfo.TextPosition;
            if (p_hifHeaderInfo.Height > hplTitle.Height)
            {
                hplTitle.Height = p_hifHeaderInfo.Height;
            }

            foreach (var stpStep in p_lstInstallSteps)
            {
                var ofsStep = new OptionFormStep(p_dsmStateManager, stpStep.GroupedPlugins);
                ofsStep.Dock         = DockStyle.Fill;
                ofsStep.Visible      = false;
                ofsStep.ItemChecked += ofsStep_ItemChecked;
                pnlWizardSteps.Controls.Add(ofsStep);
                m_lstInstallSteps.Add(new KeyValuePair <InstallStep, OptionFormStep>(stpStep, ofsStep));
            }
            m_intCurrentStep = -1;
            StepForward();
        }
Example #3
0
        /// <summary>
        ///   Displays the option form and starts the background worker to do the install.
        /// </summary>
        /// <returns><lang langref="true" /> if the mod installed correctly; <lang langref="false" /> otherwise.</returns>
        public bool Install()
        {
            var xmlConfig = new XmlDocument();
            var strConfig = m_misInstallScript.Fomod.GetInstallScript().Text;

            xmlConfig.LoadXml(strConfig);

            //remove comments so we don't have to deal with them later
            var xnlComments = xmlConfig.SelectNodes("//comment()");

            foreach (XmlNode xndComment in xnlComments)
            {
                xndComment.ParentNode.RemoveChild(xndComment);
            }

            m_dsmStateManager = Program.GameMode.CreateDependencyStateManager(m_misInstallScript);

            var prsParser          = Parser.GetParser(xmlConfig, m_misInstallScript.Fomod, m_dsmStateManager);
            var cpdModDependencies = prsParser.GetModDependencies();

            if ((cpdModDependencies != null) && !cpdModDependencies.IsFufilled)
            {
                throw new DependencyException(cpdModDependencies.Message);
            }

            var  lstSteps      = prsParser.GetInstallSteps();
            var  hifHeaderInfo = prsParser.GetHeaderInfo();
            var  ofmOptions    = new OptionsForm(this, hifHeaderInfo, m_dsmStateManager, lstSteps);
            bool booPerformInstall;

            if (lstSteps.Count == 0)
            {
                booPerformInstall = true;
            }
            else
            {
                booPerformInstall = (ofmOptions.ShowDialog() == DialogResult.OK);
            }

            if (booPerformInstall)
            {
                using (m_bwdProgress = new BackgroundWorkerProgressDialog(InstallFiles))
                {
                    m_bwdProgress.WorkMethodArguments = new InstallFilesArguments(prsParser, ofmOptions);
                    m_bwdProgress.OverallMessage      = "Installing " + hifHeaderInfo.Title;
                    m_bwdProgress.OverallProgressStep = 1;
                    m_bwdProgress.ItemProgressStep    = 1;
                    if (m_bwdProgress.ShowDialog() == DialogResult.Cancel)
                    {
                        return(false);
                    }
                }
                return(true);
            }

            return(false);
        }
 /// <summary>
 ///   Parses the given dependency.
 /// </summary>
 /// <param name="p_xndDependency">The dependency to parse.</param>
 /// <param name="p_dsmSate">The state manager for this install.</param>
 /// <returns>the dependency represented by the given node.</returns>
 public override IDependency ParseDependency(XmlNode p_xndDependency, DependencyStateManager p_dsmSate)
 {
   switch (p_xndDependency.Name)
   {
     case "foseDependancy":
       var verMinFoseVersion = new Version(p_xndDependency.Attributes["version"].InnerText);
       return new FoseDependency((Fallout3DependencyStateManager) p_dsmSate, verMinFoseVersion);
   }
   return null;
 }
Example #5
0
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_dsmStateManager">The install state manager.</param>
		/// <param name="p_lstGroups">The plugin groups to display.</param>
		public OptionFormStep(DependencyStateManager p_dsmStateManager, IList<PluginGroup> p_lstGroups)
		{
			m_dsmStateManager = p_dsmStateManager;

			InitializeComponent();

			loadPlugins(p_lstGroups);
			if (lvwPlugins.Items.Count > 0)
				lvwPlugins.Items[0].Selected = true;
		}
Example #6
0
        /// <summary>
        ///   A simple constructor that initializes the object with the given values.
        /// </summary>
        /// <param name="p_dsmStateManager">The install state manager.</param>
        /// <param name="p_lstGroups">The plugin groups to display.</param>
        public OptionFormStep(DependencyStateManager p_dsmStateManager, IList <PluginGroup> p_lstGroups)
        {
            m_dsmStateManager = p_dsmStateManager;

            InitializeComponent();

            loadPlugins(p_lstGroups);
            if (lvwPlugins.Items.Count > 0)
            {
                lvwPlugins.Items[0].Selected = true;
            }
        }
Example #7
0
        /// <summary>
        /// Displays the option form and starts the background worker to do the install.
        /// </summary>
        /// <returns><lang cref="true"/> if the mod installed correctly; <lang cref="false"/> otherwise.</returns>
        public bool Install()
        {
            XmlDocument xmlConfig = new XmlDocument();
            string strConfig = m_misInstallScript.Fomod.GetInstallScript().Text;
            xmlConfig.LoadXml(strConfig);

            //remove comments so we don't have to deal with them later
            XmlNodeList xnlComments = xmlConfig.SelectNodes("//comment()");
            foreach (XmlNode xndComment in xnlComments)
                xndComment.ParentNode.RemoveChild(xndComment);

            m_dsmStateManager = Program.GameMode.CreateDependencyStateManager(m_misInstallScript);

            Parser prsParser = Parser.GetParser(xmlConfig, m_misInstallScript.Fomod, m_dsmStateManager);
            CompositeDependency cpdModDependencies = prsParser.GetModDependencies();
            if ((cpdModDependencies != null) && !cpdModDependencies.IsFufilled)
                throw new DependencyException(cpdModDependencies.Message);

            IList<InstallStep> lstSteps = prsParser.GetInstallSteps();
            HeaderInfo hifHeaderInfo = prsParser.GetHeaderInfo();
            OptionsForm ofmOptions = new OptionsForm(this, hifHeaderInfo, m_dsmStateManager, lstSteps);
            bool booPerformInstall = false;
            if (lstSteps.Count == 0)
                booPerformInstall = true;
            else
                booPerformInstall = (ofmOptions.ShowDialog() == DialogResult.OK);

            if (booPerformInstall)
            {
                using (m_bwdProgress = new BackgroundWorkerProgressDialog(InstallFiles))
                {
                    m_bwdProgress.WorkMethodArguments = new InstallFilesArguments(prsParser, ofmOptions);
                    m_bwdProgress.OverallMessage = "Installing " + hifHeaderInfo.Title;
                    m_bwdProgress.OverallProgressStep = 1;
                    m_bwdProgress.ItemProgressStep = 1;
                    if (m_bwdProgress.ShowDialog() == DialogResult.Cancel)
                        return false;
                }
                return true;
            }

            return false;
        }
Example #8
0
 /// <summary>
 ///   A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_dsmStateManager">The manager that reports the currect install state.</param>
 /// <param name="p_verVersion">The minimum required version of FOMM.</param>
 public FommDependency(DependencyStateManager p_dsmStateManager, Version p_verVersion)
 {
   m_dsmStateManager = p_dsmStateManager;
   m_verMinVersion = p_verVersion;
 }
Example #9
0
 /// <summary>
 ///   A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_strFile">The file that must be is the specified state.</param>
 /// <param name="p_mfsState">The state in which the specified file must be.</param>
 /// <param name="p_dsmStateManager">The manager that reports the currect install state.</param>
 public FileDependency(string p_strFile, ModFileState p_mfsState, DependencyStateManager p_dsmStateManager)
 {
   m_mfsState = p_mfsState;
   File = p_strFile;
   m_dsmStateManager = p_dsmStateManager;
 }
Example #10
0
 /// <summary>
 ///   A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_dsmStateManager">The manager that reports the currect install state.</param>
 /// <param name="p_verVersion">The minimum required version of FOMM.</param>
 public FommDependency(DependencyStateManager p_dsmStateManager, Version p_verVersion)
 {
     m_dsmStateManager = p_dsmStateManager;
     m_verMinVersion   = p_verVersion;
 }
Example #11
0
 /// <summary>
 ///   A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_strFile">The name of the falge that must have a specific value.</param>
 /// <param name="p_mfsState">The state in which the specified file must be.</param>
 /// <param name="p_dsmStateManager">The value the flag that must have.</param>
 public FlagDependency(string p_strFlagName, string p_strValue, DependencyStateManager p_dsmStateManager)
 {
     FlagName          = p_strFlagName;
     Value             = p_strValue;
     m_dsmStateManager = p_dsmStateManager;
 }
Example #12
0
 /// <summary>
 /// A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_strFile">The name of the falge that must have a specific value.</param>
 /// <param name="p_mfsState">The state in which the specified file must be.</param>
 /// <param name="p_dsmStateManager">The value the flag that must have.</param>
 public FlagDependency(string p_strFlagName, string p_strValue, DependencyStateManager p_dsmStateManager)
 {
     FlagName = p_strFlagName;
     Value = p_strValue;
     m_dsmStateManager = p_dsmStateManager;
 }
Example #13
0
 /// <summary>
 ///   A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_strFile">The file that must be is the specified state.</param>
 /// <param name="p_mfsState">The state in which the specified file must be.</param>
 /// <param name="p_dsmStateManager">The manager that reports the currect install state.</param>
 public FileDependency(string p_strFile, ModFileState p_mfsState, DependencyStateManager p_dsmStateManager)
 {
     m_mfsState        = p_mfsState;
     File              = p_strFile;
     m_dsmStateManager = p_dsmStateManager;
 }