Пример #1
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="conflicts">The list of file conflicts.</param>
        public ReplacingFilesForm(FileConflictCollection conflicts)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Ignore events while initializing the form.
            ignoreEvents = true;

            pictureBox.Image = SystemIcons.Exclamation.ToBitmap();

            // There appears to be a bug in the 1.0 version of the framework.  On my
            // 3.2ghz machine, if listBox.Items.Add(conflict) is placed in the
            // foreach array it hangs, unless you slow it down somehow.  Moving
            // the add outside the loop and changing it to an AddRange() to add all
            // of the conflicts in one shot makes it work correctly, thus the change
            // to the code.

            // Add all of the conflicts to the list box.
            FileConflict[] conflictArray = new FileConflict[conflicts.Count];
            for (int i = 0; i < conflicts.Count; i++)
                conflictArray[i] = conflicts[i];
            listBox.Items.AddRange(conflictArray);

            // Loop through all of the conflicts setting their check state as appropriate.
            foreach (FileConflict conflict in conflicts)
            {
                int index = listBox.Items.IndexOf(conflict);
                listBox.SetItemChecked(index, conflict.ReplaceFile);
            }

            ignoreEvents = false;
        }
Пример #2
0
        /// <summary>
        /// This method creates a conflict collection from the module.
        /// </summary>
        /// <param name="module"></param>
        /// <returns></returns>
        private FileConflictCollection CreateConflictCollection(Erf module)
        {
            FileConflictCollection conflicts = new FileConflictCollection();
            StringCollection replacedFiles = module.ReplacedFiles;
            foreach (string file in replacedFiles)
            {
                // Generate the full path of the module file, which has the same name
                // but is decompressed to the current temp directory.
                string moduleFile = Path.Combine(currentTempDir, Path.GetFileName(file));

                // Create the conflict object and add it to the collection.
                FileConflict conflict = new FileConflict(moduleFile, file);
                conflicts.Add(conflict);
            }
            return conflicts;
        }
Пример #3
0
 /// <summary>
 /// This methods should ask the user for confirmation of replacing
 /// the listed files in the module with files from sources in the
 /// hif files, as this operation may break the module.
 /// </summary>
 /// <param name="replacedFiles">The list of replaced files</param>
 /// <returns>true if the files should be replaced, false if adding
 /// the hak(s) to the module should be aborted</returns>
 bool IHakInstallProgress.ShouldReplaceFiles(FileConflictCollection conflicts)
 {
     return true;
 }
Пример #4
0
 /// <summary>
 /// Generates a copy of the FileConflictCollection
 /// </summary>
 /// <returns></returns>
 public FileConflictCollection Clone()
 {
     FileConflictCollection copy = new FileConflictCollection();
     foreach (object o in InnerList)
         copy.InnerList.Add(o);
     return copy;
 }
 /// <summary>
 /// This methods should ask the user for confirmation of replacing
 /// the listed files in the module with files from sources in the
 /// hif files, as this operation may break the module.
 /// </summary>
 /// <param name="conflicts">The list of file conflicts</param>
 /// <returns>true if the files should be replaced, false if adding
 /// the hak(s) to the module should be aborted</returns>
 bool IHakInstallProgress.ShouldReplaceFiles(FileConflictCollection conflicts)
 {
     // Confirm the file replace operation with the user.
     ReplacingFilesForm form = new ReplacingFilesForm(conflicts);
     return DialogResult.OK == form.ShowDialog((Form) this);
 }