Exemplo n.º 1
0
 /// <summary>
 /// Removes an overwrite warning from the collection
 /// </summary>
 /// <param name="warning">The warning to remove</param>
 public void Remove(OverwriteWarning warning)
 {
     InnerList.Remove(warning);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Attempts to resolve conflicts for a 2da file.  It does this be attempting to
        /// merge all duplicate copies of the 2da file into one merge 2da file.
        /// </summary>
        /// <param name="hakInfos">The HIFs being added to the module</param>
        /// <param name="module">The module</param>
        /// <param name="moduleInfo">The module info for the module</param>
        /// <param name="conflict">The 2da file in conflict</param>
        private bool Resolve2daConflict(HakInfo[] hakInfos, Erf module, ModuleInfo moduleInfo,
			OverwriteWarning conflict)
        {
            try
            {
                // Create an array list and get the 2da from the module,
                // adding it to the list if we get it.
                ArrayList list = new ArrayList();
                _2DA twoDA = Get2da(moduleInfo, conflict.File);
                if (null != twoDA) list.Add(twoDA);

                // Now get all of the copies of the 2da from the various HIFs and
                // add them as well.
                foreach (HakInfo hakInfo in hakInfos)
                {
                    twoDA = Get2da(hakInfo, conflict.File);
                    if (null != twoDA) list.Add(twoDA);
                }

                // Load the BioWare version of the the 2da to use as a baseline, if the
                // file isn't in the bioware directory then we will have to make due w/o
                // it just make a blank 2da with the correct schema.
                _2DA bioware = LoadBioWare2da(conflict.File);

                // At this point we have all relevent copies of the conflicting 2da loaded into
                // memory, we now need to generate a merge 2da if possible.
                _2DA merge = Merge2das(bioware, list);
                if (null == merge) return false;

                // We have successfully merged all of the 2das, save the merge 2da and
                // return true.
                if (!Directory.Exists(conflictHakDir)) Directory.CreateDirectory(conflictHakDir);
                merge.SaveAs(Path.Combine(conflictHakDir, conflict.File));
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Adds an OverwriteWarning.
 /// </summary>
 /// <param name="warning"></param>
 public void Add(OverwriteWarning warning)
 {
     InnerList.Add(warning);
 }