/// <summary>
        /// Initializes a new instance of the <see cref="ResultProvenance" /> class from the specified instance.
        /// </summary>
        /// <param name="other">
        /// The instance from which the new instance is to be initialized.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="other" /> is null.
        /// </exception>
        public ResultProvenance(ResultProvenance other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            Init(other.FirstDetectionTimeUtc, other.LastDetectionTimeUtc, other.FirstDetectionRunGuid, other.LastDetectionRunGuid, other.InvocationIndex, other.ConversionSources, other.Properties);
        }
        public virtual ResultProvenance VisitResultProvenance(ResultProvenance node)
        {
            if (node != null)
            {
                if (node.ConversionSources != null)
                {
                    for (int index_0 = 0; index_0 < node.ConversionSources.Count; ++index_0)
                    {
                        node.ConversionSources[index_0] = VisitNullChecked(node.ConversionSources[index_0]);
                    }
                }
            }

            return(node);
        }
Ejemplo n.º 3
0
        private void Init(string ruleId, int ruleIndex, int extensionIndex, ResultKind kind, FailureLevel level, Message message, ArtifactLocation analysisTarget, IEnumerable <Location> locations, string instanceGuid, string correlationGuid, int occurrenceCount, IDictionary <string, string> partialFingerprints, IDictionary <string, string> fingerprints, IEnumerable <Stack> stacks, IEnumerable <CodeFlow> codeFlows, IDictionary <string, Graph> graphs, IEnumerable <GraphTraversal> graphTraversals, IEnumerable <Location> relatedLocations, SuppressionStates suppressionStates, BaselineState baselineState, double rank, IEnumerable <Attachment> attachments, Uri hostedViewerUri, IEnumerable <Uri> workItemUris, ResultProvenance provenance, IEnumerable <Fix> fixes, IDictionary <string, SerializedPropertyInfo> properties)
        {
            RuleId             = ruleId;
            RuleIndex          = ruleIndex;
            RuleExtensionIndex = extensionIndex;
            Kind  = kind;
            Level = level;
            if (message != null)
            {
                Message = new Message(message);
            }

            if (analysisTarget != null)
            {
                AnalysisTarget = new ArtifactLocation(analysisTarget);
            }

            if (locations != null)
            {
                var destination_0 = new List <Location>();
                foreach (var value_0 in locations)
                {
                    if (value_0 == null)
                    {
                        destination_0.Add(null);
                    }
                    else
                    {
                        destination_0.Add(new Location(value_0));
                    }
                }

                Locations = destination_0;
            }

            InstanceGuid    = instanceGuid;
            CorrelationGuid = correlationGuid;
            OccurrenceCount = occurrenceCount;
            if (partialFingerprints != null)
            {
                PartialFingerprints = new Dictionary <string, string>(partialFingerprints);
            }

            if (fingerprints != null)
            {
                Fingerprints = new Dictionary <string, string>(fingerprints);
            }

            if (stacks != null)
            {
                var destination_1 = new List <Stack>();
                foreach (var value_1 in stacks)
                {
                    if (value_1 == null)
                    {
                        destination_1.Add(null);
                    }
                    else
                    {
                        destination_1.Add(new Stack(value_1));
                    }
                }

                Stacks = destination_1;
            }

            if (codeFlows != null)
            {
                var destination_2 = new List <CodeFlow>();
                foreach (var value_2 in codeFlows)
                {
                    if (value_2 == null)
                    {
                        destination_2.Add(null);
                    }
                    else
                    {
                        destination_2.Add(new CodeFlow(value_2));
                    }
                }

                CodeFlows = destination_2;
            }

            if (graphs != null)
            {
                Graphs = new Dictionary <string, Graph>();
                foreach (var value_3 in graphs)
                {
                    Graphs.Add(value_3.Key, new Graph(value_3.Value));
                }
            }

            if (graphTraversals != null)
            {
                var destination_3 = new List <GraphTraversal>();
                foreach (var value_4 in graphTraversals)
                {
                    if (value_4 == null)
                    {
                        destination_3.Add(null);
                    }
                    else
                    {
                        destination_3.Add(new GraphTraversal(value_4));
                    }
                }

                GraphTraversals = destination_3;
            }

            if (relatedLocations != null)
            {
                var destination_4 = new List <Location>();
                foreach (var value_5 in relatedLocations)
                {
                    if (value_5 == null)
                    {
                        destination_4.Add(null);
                    }
                    else
                    {
                        destination_4.Add(new Location(value_5));
                    }
                }

                RelatedLocations = destination_4;
            }

            SuppressionStates = suppressionStates;
            BaselineState     = baselineState;
            Rank = rank;
            if (attachments != null)
            {
                var destination_5 = new List <Attachment>();
                foreach (var value_6 in attachments)
                {
                    if (value_6 == null)
                    {
                        destination_5.Add(null);
                    }
                    else
                    {
                        destination_5.Add(new Attachment(value_6));
                    }
                }

                Attachments = destination_5;
            }

            if (hostedViewerUri != null)
            {
                HostedViewerUri = new Uri(hostedViewerUri.OriginalString, hostedViewerUri.IsAbsoluteUri ? UriKind.Absolute : UriKind.Relative);
            }

            if (workItemUris != null)
            {
                var destination_6 = new List <Uri>();
                foreach (var value_7 in workItemUris)
                {
                    destination_6.Add(value_7);
                }

                WorkItemUris = destination_6;
            }

            if (provenance != null)
            {
                Provenance = new ResultProvenance(provenance);
            }

            if (fixes != null)
            {
                var destination_7 = new List <Fix>();
                foreach (var value_8 in fixes)
                {
                    if (value_8 == null)
                    {
                        destination_7.Add(null);
                    }
                    else
                    {
                        destination_7.Add(new Fix(value_8));
                    }
                }

                Fixes = destination_7;
            }

            if (properties != null)
            {
                Properties = new Dictionary <string, SerializedPropertyInfo>(properties);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Result" /> class from the supplied values.
 /// </summary>
 /// <param name="ruleId">
 /// An initialization value for the <see cref="P:RuleId" /> property.
 /// </param>
 /// <param name="ruleIndex">
 /// An initialization value for the <see cref="P:RuleIndex" /> property.
 /// </param>
 /// <param name="extensionIndex">
 /// An initialization value for the <see cref="P:ExtensionIndex" /> property.
 /// </param>
 /// <param name="kind">
 /// An initialization value for the <see cref="P:Kind" /> property.
 /// </param>
 /// <param name="level">
 /// An initialization value for the <see cref="P:Level" /> property.
 /// </param>
 /// <param name="message">
 /// An initialization value for the <see cref="P:Message" /> property.
 /// </param>
 /// <param name="analysisTarget">
 /// An initialization value for the <see cref="P:AnalysisTarget" /> property.
 /// </param>
 /// <param name="locations">
 /// An initialization value for the <see cref="P:Locations" /> property.
 /// </param>
 /// <param name="instanceGuid">
 /// An initialization value for the <see cref="P:InstanceGuid" /> property.
 /// </param>
 /// <param name="correlationGuid">
 /// An initialization value for the <see cref="P:CorrelationGuid" /> property.
 /// </param>
 /// <param name="occurrenceCount">
 /// An initialization value for the <see cref="P:OccurrenceCount" /> property.
 /// </param>
 /// <param name="partialFingerprints">
 /// An initialization value for the <see cref="P:PartialFingerprints" /> property.
 /// </param>
 /// <param name="fingerprints">
 /// An initialization value for the <see cref="P:Fingerprints" /> property.
 /// </param>
 /// <param name="stacks">
 /// An initialization value for the <see cref="P:Stacks" /> property.
 /// </param>
 /// <param name="codeFlows">
 /// An initialization value for the <see cref="P:CodeFlows" /> property.
 /// </param>
 /// <param name="graphs">
 /// An initialization value for the <see cref="P:Graphs" /> property.
 /// </param>
 /// <param name="graphTraversals">
 /// An initialization value for the <see cref="P:GraphTraversals" /> property.
 /// </param>
 /// <param name="relatedLocations">
 /// An initialization value for the <see cref="P:RelatedLocations" /> property.
 /// </param>
 /// <param name="suppressionStates">
 /// An initialization value for the <see cref="P:SuppressionStates" /> property.
 /// </param>
 /// <param name="baselineState">
 /// An initialization value for the <see cref="P:BaselineState" /> property.
 /// </param>
 /// <param name="rank">
 /// An initialization value for the <see cref="P:Rank" /> property.
 /// </param>
 /// <param name="attachments">
 /// An initialization value for the <see cref="P:Attachments" /> property.
 /// </param>
 /// <param name="hostedViewerUri">
 /// An initialization value for the <see cref="P:HostedViewerUri" /> property.
 /// </param>
 /// <param name="workItemUris">
 /// An initialization value for the <see cref="P:WorkItemUris" /> property.
 /// </param>
 /// <param name="provenance">
 /// An initialization value for the <see cref="P:Provenance" /> property.
 /// </param>
 /// <param name="fixes">
 /// An initialization value for the <see cref="P:Fixes" /> property.
 /// </param>
 /// <param name="properties">
 /// An initialization value for the <see cref="P:Properties" /> property.
 /// </param>
 public Result(string ruleId, int ruleIndex, int extensionIndex, ResultKind kind, FailureLevel level, Message message, ArtifactLocation analysisTarget, IEnumerable <Location> locations, string instanceGuid, string correlationGuid, int occurrenceCount, IDictionary <string, string> partialFingerprints, IDictionary <string, string> fingerprints, IEnumerable <Stack> stacks, IEnumerable <CodeFlow> codeFlows, IDictionary <string, Graph> graphs, IEnumerable <GraphTraversal> graphTraversals, IEnumerable <Location> relatedLocations, SuppressionStates suppressionStates, BaselineState baselineState, double rank, IEnumerable <Attachment> attachments, Uri hostedViewerUri, IEnumerable <Uri> workItemUris, ResultProvenance provenance, IEnumerable <Fix> fixes, IDictionary <string, SerializedPropertyInfo> properties)
 {
     Init(ruleId, ruleIndex, extensionIndex, kind, level, message, analysisTarget, locations, instanceGuid, correlationGuid, occurrenceCount, partialFingerprints, fingerprints, stacks, codeFlows, graphs, graphTraversals, relatedLocations, suppressionStates, baselineState, rank, attachments, hostedViewerUri, workItemUris, provenance, fixes, properties);
 }
 public bool ValueEquals(ResultProvenance other) => ValueComparer.Equals(this, other);