Ejemplo n.º 1
0
 private void processStep(IList <InstallStep> lstSteps, int stepIdx, TaskCompletionSource <IList <Instruction> > Source,
                          XmlScript xscScript, List <InstallableFile> PluginsToActivate)
 {
     if (stepIdx == -1)
     {
         m_Delegates.ui.EndDialog();
         XmlScriptInstaller            xsiInstaller   = new XmlScriptInstaller(ModArchive);
         IEnumerable <InstallableFile> FilesToInstall = new List <InstallableFile>();
         foreach (IEnumerable <InstallableFile> files in m_SelectedOptions.Select(option => option.Files))
         {
             FilesToInstall = FilesToInstall.Union(files);
         }
         Source.SetResult(xsiInstaller.Install(xscScript, m_csmState, m_Delegates, FilesToInstall, PluginsToActivate));
     }
     else
     {
         preselectOptions(lstSteps[stepIdx]);
         sendState(lstSteps, ModArchive.Prefix, stepIdx);
     }
 }
        private void processStep(IList <InstallStep> lstSteps, int stepIdx, TaskCompletionSource <IList <Instruction> > Source,
                                 XmlScript xscScript, List <InstallableFile> PluginsToActivate)
        {
            if (stepIdx == -1)
            {
                m_Delegates.ui.EndDialog();

                XmlScriptInstaller            xsiInstaller   = new XmlScriptInstaller(ModArchive);
                IEnumerable <InstallableFile> FilesToInstall = new List <InstallableFile>();
                foreach (InstallStep step in lstSteps)
                {
                    foreach (OptionGroup group in step.OptionGroups)
                    {
                        foreach (Option option in group.Options)
                        {
                            if (m_SelectedOptions.Contains(option))
                            {
                                FilesToInstall = FilesToInstall.Union(option.Files);
                            }
                            else
                            {
                                IEnumerable <InstallableFile> installAnyway = option.Files.Where(
                                    file => file.AlwaysInstall ||
                                    (file.InstallIfUsable && option.GetOptionType(m_csmState, m_Delegates) != OptionType.NotUsable));
                                if (installAnyway.Count() > 0)
                                {
                                    FilesToInstall = FilesToInstall.Union(installAnyway);
                                }
                            }
                        }
                    }
                }

                Source.SetResult(xsiInstaller.Install(xscScript, m_csmState, m_Delegates, FilesToInstall, PluginsToActivate));
            }
            else
            {
                preselectOptions(lstSteps[stepIdx]);
                sendState(lstSteps, ModArchive.Prefix, stepIdx);
            }
        }