コード例 #1
0
ファイル: XmlConfiguredScript.cs プロジェクト: BioBrainX/fomm
        /// <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;
        }
コード例 #2
0
ファイル: XmlConfiguredScript.cs プロジェクト: BioBrainX/fomm
 /// <summary>
 /// A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_xmlConfig">The xml configuration file.</param>
 /// <param name="p_ofmForm">The options form used to selected what needs to be installed.</param>
 public InstallFilesArguments(Parser p_psrParser, OptionsForm p_ofmForm)
 {
     Parser = p_psrParser;
     Form = p_ofmForm;
 }
コード例 #3
0
ファイル: XmlConfiguredScript.cs プロジェクト: vjmira/fomm
 /// <summary>
 ///   A simple constructor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_xmlConfig">The xml configuration file.</param>
 /// <param name="p_ofmForm">The options form used to selected what needs to be installed.</param>
 public InstallFilesArguments(Parser p_psrParser, OptionsForm p_ofmForm)
 {
     Parser = p_psrParser;
     Form   = p_ofmForm;
 }