/// <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;
        }
Esempio n. 2
0
 /// <summary>
 /// Removes a conflict from the collection.
 /// </summary>
 /// <param name="conflict">The conflict to remove</param>
 public void Remove(FileConflict conflict)
 {
     InnerList.Remove(conflict);
 }
Esempio n. 3
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;
        }
Esempio n. 4
0
 /// <summary>
 /// Adds a conflict to the collection.
 /// </summary>
 /// <param name="conflict"></param>
 public void Add(FileConflict conflict)
 {
     InnerList.Add(conflict);
 }