Example #1
0
        /// <summary>
        /// Adds a generic violation.
        /// </summary>
        /// <param name="sourceCode">The file to add the violation to.</param>
        /// <param name="violation">The violation to add to the element.</param>
        internal void AddViolation(SourceCode sourceCode, Violation violation)
        {
            Param.Ignore(sourceCode, "sourceCode");
            Param.AssertNotNull(violation, "violation");

            bool signal = true;

            // Add the violation to the file.
            if (sourceCode != null)
            {
                if (!sourceCode.AddViolation(violation))
                {
                    signal = false;
                }
            }

            // Signal that there is a new violation.
            if (signal)
            {
                this.OnViolationEncountered(new ViolationEventArgs(violation));
            }
        }
Example #2
0
 internal void AddViolation(SourceCode sourceCode, Violation violation)
 {
     bool flag = true;
     if ((sourceCode != null) && !sourceCode.AddViolation(violation))
     {
         flag = false;
     }
     if (flag)
     {
         this.OnViolationEncountered(new ViolationEventArgs(violation));
     }
 }