Esempio n. 1
0
 /// <summary>
 ///   Raises the <see cref="ConflictDetected" /> event.
 /// </summary>
 /// <param name="p_plgConflictedPlugin">The plugin that is conflicted.</param>
 /// <param name="p_plgConflictingPlugin">The plugin that is conflicting.</param>
 /// <param name="p_uintFormId">The form id that is overridden.</param>
 /// <param name="p_criInfo">The <see cref="CriticalRecordInfo" /> describing the conflict.</param>
 protected void OnConflictDetected(Plugin p_plgConflictedPlugin, Plugin p_plgConflictingPlugin, UInt32 p_uintFormId,
                                   CriticalRecordInfo p_criInfo)
 {
     if (ConflictDetected != null)
     {
         var cdaArgs = new ConflictDetectedEventArgs(p_plgConflictedPlugin, p_plgConflictingPlugin,
                                                     p_uintFormId, p_criInfo);
         ConflictDetected(this, cdaArgs);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Called when the conflict detector has found a conflict.
        /// </summary>
        /// <remarks>
        /// This adds a message to the appropriate plugin's info box, and changes the plugin's
        /// node's background colour as appropriate.
        /// </remarks>
        /// <param name="sender">The object that trigger the event.</param>
        /// <param name="e">A <see cref="ConflictDetectedEventArgs"/> describing the event arguments.</param>
        private void cdrDetector_ConflictDetected(object sender, ConflictDetectedEventArgs e)
        {
            StringBuilder stbMessage = new StringBuilder();
            List<Color> lstBackgroundColours = new List<Color> { Color.LightSkyBlue, Color.Yellow, Color.Red };
            Int32 intColourIndex = 0;
            switch (e.ConflictInfo.Severity)
            {
                case CriticalRecordInfo.ConflictSeverity.Conflict:
                    stbMessage.Append(@"\b \cf1 CONFLICT\cf0 :\b0  ");
                    intColourIndex = 2;
                    break;
                case CriticalRecordInfo.ConflictSeverity.Warning:
                    stbMessage.Append(@"\b \cf2 WARNING\cf0 :\b0  ");
                    intColourIndex = 1;
                    break;
                case CriticalRecordInfo.ConflictSeverity.Info:
                    stbMessage.Append(@"\b \cf3 INFO\cf0 :\b0  ");
                    intColourIndex = 0;
                    break;
            }
            Color clrHighlight = lstBackgroundColours[intColourIndex];
            if (m_pfpFormatProvider.HasFormat(e.ConflictedPlugin.Name))
            {
                PluginFormat pftFormat = m_pfpFormatProvider.GetFormat(e.ConflictedPlugin.Name);
                if (pftFormat.Highlight.HasValue && (lstBackgroundColours.IndexOf(pftFormat.Highlight.Value) > intColourIndex))
                    clrHighlight = pftFormat.Highlight.Value;
            }

            if (InstallLog.Current.GetCurrentFileOwnerName(e.ConflictingPlugin.Name) == null)
                stbMessage.AppendFormat("Form Id \\b {0:x8}\\b0  is overridden by \\b {1}\\b0 .\\par \\pard\\li720\\sl240\\slmult1 {2}\\par \\pard\\sl240\\slmult1 ", e.FormId, e.ConflictingPlugin.Name, e.ConflictInfo.Reason);
            else
            {
                fomod fomodMod = new fomod(Path.Combine(Program.GameMode.ModDirectory, InstallLog.Current.GetCurrentFileOwnerName(e.ConflictingPlugin.Name) + ".fomod"));
                stbMessage.AppendFormat("Form Id \\b {0:x8}\\b0  is overridden by \\b {1}\\b0  in \\b {2}\\b0 .\\par \\pard\\li720\\sl240\\slmult1 {3}\\par \\pard\\sl240\\slmult1 ", e.FormId, e.ConflictingPlugin.Name, fomodMod.ModName, e.ConflictInfo.Reason);
            }
            m_pfpFormatProvider.AddFormat(e.ConflictedPlugin.Name, clrHighlight, stbMessage.ToString());
        }
Esempio n. 3
0
 /// <summary>
 ///   Raises the <see cref="ConflictDetected" /> event.
 /// </summary>
 /// <param name="p_plgConflictedPlugin">The plugin that is conflicted.</param>
 /// <param name="p_plgConflictingPlugin">The plugin that is conflicting.</param>
 /// <param name="p_uintFormId">The form id that is overridden.</param>
 /// <param name="p_criInfo">The <see cref="CriticalRecordInfo" /> describing the conflict.</param>
 protected void OnConflictDetected(Plugin p_plgConflictedPlugin, Plugin p_plgConflictingPlugin, UInt32 p_uintFormId,
                                   CriticalRecordInfo p_criInfo)
 {
   if (ConflictDetected != null)
   {
     var cdaArgs = new ConflictDetectedEventArgs(p_plgConflictedPlugin, p_plgConflictingPlugin,
                                                 p_uintFormId, p_criInfo);
     ConflictDetected(this, cdaArgs);
   }
 }