Inheritance: PropertyBagHolder, ISarifNode
Esempio n. 1
0
        public static Tool CreateFromAssemblyData(string prereleaseInfo = null)
        {
            Assembly assembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
            string name = Path.GetFileNameWithoutExtension(assembly.Location);

            Tool tool = new Tool();

            // 'name'
            tool.Name = name;

            // 'version' : primary tool version.
            Version version = assembly.GetName().Version;
            tool.Version = version.ToString();

            // Synthesized semver 2.0 version required by spec
            tool.SemanticVersion = version.Major.ToString() + "." + version.Minor.ToString() + "." + version.Build.ToString();

            // Binary file version
            FileVersionInfo fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location);

            if (fileVersion.FileVersion != tool.Version)
            {
                tool.FileVersion = fileVersion.FileVersion;
            }

            tool.FullName = name + " " + tool.Version + (prereleaseInfo ?? "");

            tool.Language = CultureInfo.CurrentCulture.Name;

            if (!string.IsNullOrEmpty(fileVersion.Comments)) { tool.SetProperty("Comments", fileVersion.Comments); }
            if (!string.IsNullOrEmpty(fileVersion.CompanyName)) { tool.SetProperty("CompanyName", fileVersion.CompanyName); }
            if (!string.IsNullOrEmpty(fileVersion.ProductName)) { tool.SetProperty("ProductName", fileVersion.ProductName); }

            return tool;
        }
Esempio n. 2
0
 public bool ValueEquals(Tool other) => ValueComparer.Equals(this, other);
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Tool" /> 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 Tool(Tool other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            Init(other.Name, other.FullName, other.Version, other.SemanticVersion, other.FileVersion, other.SarifLoggerVersion, other.Language, other.Properties);
        }
Esempio n. 4
0
 public static void ValidateTool(Tool tool)
 {
     Assert.Equal("BinSkim", tool.Name);
     // TODO version, etc
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Run" /> class from the supplied values.
 /// </summary>
 /// <param name="tool">
 /// An initialization value for the <see cref="P: Tool" /> property.
 /// </param>
 /// <param name="invocation">
 /// An initialization value for the <see cref="P: Invocation" /> property.
 /// </param>
 /// <param name="files">
 /// An initialization value for the <see cref="P: Files" /> property.
 /// </param>
 /// <param name="results">
 /// An initialization value for the <see cref="P: Results" /> property.
 /// </param>
 /// <param name="rules">
 /// An initialization value for the <see cref="P: Rules" /> property.
 /// </param>
 /// <param name="startTime">
 /// An initialization value for the <see cref="P: StartTime" /> property.
 /// </param>
 /// <param name="endTime">
 /// An initialization value for the <see cref="P: EndTime" /> property.
 /// </param>
 /// <param name="correlationId">
 /// An initialization value for the <see cref="P: CorrelationId" /> property.
 /// </param>
 /// <param name="architecture">
 /// An initialization value for the <see cref="P: Architecture" /> property.
 /// </param>
 /// <param name="properties">
 /// An initialization value for the <see cref="P: Properties" /> property.
 /// </param>
 /// <param name="tags">
 /// An initialization value for the <see cref="P: Tags" /> property.
 /// </param>
 public Run(Tool tool, string invocation, IDictionary <string, IList <FileData> > files, IEnumerable <Result> results, IDictionary <string, Rule> rules, DateTime startTime, DateTime endTime, string correlationId, string architecture, IDictionary <string, string> properties, IEnumerable <string> tags)
 {
     Init(tool, invocation, files, results, rules, startTime, endTime, correlationId, architecture, properties, tags);
 }
Esempio n. 6
0
        private void Init(Tool tool, string invocation, IDictionary <string, IList <FileData> > files, IEnumerable <Result> results, IDictionary <string, Rule> rules, DateTime startTime, DateTime endTime, string correlationId, string architecture, IDictionary <string, string> properties, IEnumerable <string> tags)
        {
            if (tool != null)
            {
                Tool = new Tool(tool);
            }

            Invocation = invocation;
            if (files != null)
            {
                Files = new Dictionary <string, IList <FileData> >();
                foreach (var value_0 in files)
                {
                    var destination_0 = new List <FileData>();
                    foreach (var value_1 in value_0.Value)
                    {
                        if (value_1 == null)
                        {
                            destination_0.Add(null);
                        }
                        else
                        {
                            destination_0.Add(new FileData(value_1));
                        }
                    }

                    Files.Add(value_0.Key, destination_0);
                }
            }

            if (results != null)
            {
                var destination_1 = new List <Result>();
                foreach (var value_2 in results)
                {
                    if (value_2 == null)
                    {
                        destination_1.Add(null);
                    }
                    else
                    {
                        destination_1.Add(new Result(value_2));
                    }
                }

                Results = destination_1;
            }

            if (rules != null)
            {
                Rules = new Dictionary <string, Rule>();
                foreach (var value_3 in rules)
                {
                    Rules.Add(value_3.Key, new Rule(value_3.Value));
                }
            }

            StartTime     = startTime;
            EndTime       = endTime;
            CorrelationId = correlationId;
            Architecture  = architecture;
            if (properties != null)
            {
                Properties = new Dictionary <string, string>(properties);
            }

            if (tags != null)
            {
                var destination_2 = new List <string>();
                foreach (var value_4 in tags)
                {
                    destination_2.Add(value_4);
                }

                Tags = destination_2;
            }
        }
Esempio n. 7
0
        public override int GetHashCode()
        {
            int result = 17;
            unchecked
            {
                if (Tool != null)
                {
                    result = (result * 31) + Tool.GetHashCode();
                }

                if (Invocation != null)
                {
                    result = (result * 31) + Invocation.GetHashCode();
                }

                if (Files != null)
                {
                    // Use xor for dictionaries to be order-independent.
                    int xor_0 = 0;
                    foreach (var value_0 in Files)
                    {
                        xor_0 ^= value_0.Key.GetHashCode();
                        if (value_0.Value != null)
                        {
                            xor_0 ^= value_0.Value.GetHashCode();
                        }
                    }

                    result = (result * 31) + xor_0;
                }

                if (LogicalLocations != null)
                {
                    // Use xor for dictionaries to be order-independent.
                    int xor_1 = 0;
                    foreach (var value_1 in LogicalLocations)
                    {
                        xor_1 ^= value_1.Key.GetHashCode();
                        if (value_1.Value != null)
                        {
                            xor_1 ^= value_1.Value.GetHashCode();
                        }
                    }

                    result = (result * 31) + xor_1;
                }

                if (Results != null)
                {
                    foreach (var value_2 in Results)
                    {
                        result = result * 31;
                        if (value_2 != null)
                        {
                            result = (result * 31) + value_2.GetHashCode();
                        }
                    }
                }

                if (Rules != null)
                {
                    // Use xor for dictionaries to be order-independent.
                    int xor_2 = 0;
                    foreach (var value_3 in Rules)
                    {
                        xor_2 ^= value_3.Key.GetHashCode();
                        if (value_3.Value != null)
                        {
                            xor_2 ^= value_3.Value.GetHashCode();
                        }
                    }

                    result = (result * 31) + xor_2;
                }
            }

            return result;
        }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Run" /> class from the supplied values.
 /// </summary>
 /// <param name="tool">
 /// An initialization value for the <see cref="P:Tool" /> property.
 /// </param>
 /// <param name="invocations">
 /// An initialization value for the <see cref="P:Invocations" /> property.
 /// </param>
 /// <param name="conversion">
 /// An initialization value for the <see cref="P:Conversion" /> property.
 /// </param>
 /// <param name="versionControlProvenance">
 /// An initialization value for the <see cref="P:VersionControlProvenance" /> property.
 /// </param>
 /// <param name="originalUriBaseIds">
 /// An initialization value for the <see cref="P:OriginalUriBaseIds" /> property.
 /// </param>
 /// <param name="artifacts">
 /// An initialization value for the <see cref="P:Artifacts" /> property.
 /// </param>
 /// <param name="logicalLocations">
 /// An initialization value for the <see cref="P:LogicalLocations" /> property.
 /// </param>
 /// <param name="graphs">
 /// An initialization value for the <see cref="P:Graphs" /> property.
 /// </param>
 /// <param name="results">
 /// An initialization value for the <see cref="P:Results" /> property.
 /// </param>
 /// <param name="id">
 /// An initialization value for the <see cref="P:Id" /> property.
 /// </param>
 /// <param name="aggregateIds">
 /// An initialization value for the <see cref="P:AggregateIds" /> property.
 /// </param>
 /// <param name="baselineInstanceGuid">
 /// An initialization value for the <see cref="P:BaselineInstanceGuid" /> property.
 /// </param>
 /// <param name="markdownMessageMimeType">
 /// An initialization value for the <see cref="P:MarkdownMessageMimeType" /> property.
 /// </param>
 /// <param name="redactionToken">
 /// An initialization value for the <see cref="P:RedactionToken" /> property.
 /// </param>
 /// <param name="defaultFileEncoding">
 /// An initialization value for the <see cref="P:DefaultFileEncoding" /> property.
 /// </param>
 /// <param name="defaultSourceLanguage">
 /// An initialization value for the <see cref="P:DefaultSourceLanguage" /> property.
 /// </param>
 /// <param name="newlineSequences">
 /// An initialization value for the <see cref="P:NewlineSequences" /> property.
 /// </param>
 /// <param name="columnKind">
 /// An initialization value for the <see cref="P:ColumnKind" /> property.
 /// </param>
 /// <param name="externalPropertyFiles">
 /// An initialization value for the <see cref="P:ExternalPropertyFiles" /> property.
 /// </param>
 /// <param name="properties">
 /// An initialization value for the <see cref="P:Properties" /> property.
 /// </param>
 public Run(Tool tool, IEnumerable <Invocation> invocations, Conversion conversion, IEnumerable <VersionControlDetails> versionControlProvenance, IDictionary <string, ArtifactLocation> originalUriBaseIds, IEnumerable <Artifact> artifacts, IEnumerable <LogicalLocation> logicalLocations, IDictionary <string, Graph> graphs, IEnumerable <Result> results, RunAutomationDetails id, IEnumerable <RunAutomationDetails> aggregateIds, string baselineInstanceGuid, string markdownMessageMimeType, string redactionToken, string defaultFileEncoding, string defaultSourceLanguage, IEnumerable <string> newlineSequences, ColumnKind columnKind, ExternalPropertyFiles externalPropertyFiles, IDictionary <string, SerializedPropertyInfo> properties)
 {
     Init(tool, invocations, conversion, versionControlProvenance, originalUriBaseIds, artifacts, logicalLocations, graphs, results, id, aggregateIds, baselineInstanceGuid, markdownMessageMimeType, redactionToken, defaultFileEncoding, defaultSourceLanguage, newlineSequences, columnKind, externalPropertyFiles, properties);
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Run" /> class from the supplied values.
 /// </summary>
 /// <param name="tool">
 /// An initialization value for the <see cref="P: Tool" /> property.
 /// </param>
 /// <param name="invocation">
 /// An initialization value for the <see cref="P: Invocation" /> property.
 /// </param>
 /// <param name="files">
 /// An initialization value for the <see cref="P: Files" /> property.
 /// </param>
 /// <param name="logicalLocations">
 /// An initialization value for the <see cref="P: LogicalLocations" /> property.
 /// </param>
 /// <param name="results">
 /// An initialization value for the <see cref="P: Results" /> property.
 /// </param>
 /// <param name="rules">
 /// An initialization value for the <see cref="P: Rules" /> property.
 /// </param>
 public Run(Tool tool, Invocation invocation, IDictionary<string, IList<FileData>> files, IDictionary<string, IList<LogicalLocationComponent>> logicalLocations, ISet<Result> results, IDictionary<string, Rule> rules)
 {
     Init(tool, invocation, files, logicalLocations, results, rules);
 }
Esempio n. 10
0
        private void Init(Tool tool, Invocation invocation, IDictionary<string, IList<FileData>> files, IDictionary<string, IList<LogicalLocationComponent>> logicalLocations, ISet<Result> results, IDictionary<string, Rule> rules)
        {
            if (tool != null)
            {
                Tool = new Tool(tool);
            }

            if (invocation != null)
            {
                Invocation = new Invocation(invocation);
            }

            if (files != null)
            {
                Files = new Dictionary<string, IList<FileData>>();
                foreach (var value_0 in files)
                {
                    var destination_0 = new List<FileData>();
                    foreach (var value_1 in value_0.Value)
                    {
                        if (value_1 == null)
                        {
                            destination_0.Add(null);
                        }
                        else
                        {
                            destination_0.Add(new FileData(value_1));
                        }
                    }

                    Files.Add(value_0.Key, destination_0);
                }
            }

            if (logicalLocations != null)
            {
                LogicalLocations = new Dictionary<string, IList<LogicalLocationComponent>>();
                foreach (var value_2 in logicalLocations)
                {
                    var destination_1 = new List<LogicalLocationComponent>();
                    foreach (var value_3 in value_2.Value)
                    {
                        if (value_3 == null)
                        {
                            destination_1.Add(null);
                        }
                        else
                        {
                            destination_1.Add(new LogicalLocationComponent(value_3));
                        }
                    }

                    LogicalLocations.Add(value_2.Key, destination_1);
                }
            }

            if (results != null)
            {
                var destination_2 = new HashSet<Result>();
                foreach (var value_4 in results)
                {
                    if (value_4 == null)
                    {
                        destination_2.Add(null);
                    }
                    else
                    {
                        destination_2.Add(new Result(value_4));
                    }
                }

                Results = destination_2;
            }

            if (rules != null)
            {
                Rules = new Dictionary<string, Rule>();
                foreach (var value_5 in rules)
                {
                    Rules.Add(value_5.Key, new Rule(value_5.Value));
                }
            }
        }
Esempio n. 11
0
        private void Init(Tool tool, Invocation invocation, IDictionary <string, FileData> files, IDictionary <string, LogicalLocation> logicalLocations, IEnumerable <Result> results, IEnumerable <Notification> toolNotifications, IEnumerable <Notification> configurationNotifications, IDictionary <string, Rule> rules, string id, string stableId, string automationId, string baselineId, string architecture)
        {
            if (tool != null)
            {
                Tool = new Tool(tool);
            }

            if (invocation != null)
            {
                Invocation = new Invocation(invocation);
            }

            if (files != null)
            {
                Files = new Dictionary <string, FileData>();
                foreach (var value_0 in files)
                {
                    Files.Add(value_0.Key, new FileData(value_0.Value));
                }
            }

            if (logicalLocations != null)
            {
                LogicalLocations = new Dictionary <string, LogicalLocation>();
                foreach (var value_1 in logicalLocations)
                {
                    LogicalLocations.Add(value_1.Key, new LogicalLocation(value_1.Value));
                }
            }

            if (results != null)
            {
                var destination_0 = new List <Result>();
                foreach (var value_2 in results)
                {
                    if (value_2 == null)
                    {
                        destination_0.Add(null);
                    }
                    else
                    {
                        destination_0.Add(new Result(value_2));
                    }
                }

                Results = destination_0;
            }

            if (toolNotifications != null)
            {
                var destination_1 = new List <Notification>();
                foreach (var value_3 in toolNotifications)
                {
                    if (value_3 == null)
                    {
                        destination_1.Add(null);
                    }
                    else
                    {
                        destination_1.Add(new Notification(value_3));
                    }
                }

                ToolNotifications = destination_1;
            }

            if (configurationNotifications != null)
            {
                var destination_2 = new List <Notification>();
                foreach (var value_4 in configurationNotifications)
                {
                    if (value_4 == null)
                    {
                        destination_2.Add(null);
                    }
                    else
                    {
                        destination_2.Add(new Notification(value_4));
                    }
                }

                ConfigurationNotifications = destination_2;
            }

            if (rules != null)
            {
                Rules = new Dictionary <string, Rule>();
                foreach (var value_5 in rules)
                {
                    Rules.Add(value_5.Key, new Rule(value_5.Value));
                }
            }

            Id           = id;
            StableId     = stableId;
            AutomationId = automationId;
            BaselineId   = baselineId;
            Architecture = architecture;
        }
Esempio n. 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Run" /> class from the supplied values.
 /// </summary>
 /// <param name="tool">
 /// An initialization value for the <see cref="P: Tool" /> property.
 /// </param>
 /// <param name="invocation">
 /// An initialization value for the <see cref="P: Invocation" /> property.
 /// </param>
 /// <param name="files">
 /// An initialization value for the <see cref="P: Files" /> property.
 /// </param>
 /// <param name="logicalLocations">
 /// An initialization value for the <see cref="P: LogicalLocations" /> property.
 /// </param>
 /// <param name="results">
 /// An initialization value for the <see cref="P: Results" /> property.
 /// </param>
 /// <param name="toolNotifications">
 /// An initialization value for the <see cref="P: ToolNotifications" /> property.
 /// </param>
 /// <param name="configurationNotifications">
 /// An initialization value for the <see cref="P: ConfigurationNotifications" /> property.
 /// </param>
 /// <param name="rules">
 /// An initialization value for the <see cref="P: Rules" /> property.
 /// </param>
 /// <param name="id">
 /// An initialization value for the <see cref="P: Id" /> property.
 /// </param>
 /// <param name="stableId">
 /// An initialization value for the <see cref="P: StableId" /> property.
 /// </param>
 /// <param name="automationId">
 /// An initialization value for the <see cref="P: AutomationId" /> property.
 /// </param>
 /// <param name="baselineId">
 /// An initialization value for the <see cref="P: BaselineId" /> property.
 /// </param>
 /// <param name="architecture">
 /// An initialization value for the <see cref="P: Architecture" /> property.
 /// </param>
 public Run(Tool tool, Invocation invocation, IDictionary <string, FileData> files, IDictionary <string, LogicalLocation> logicalLocations, IEnumerable <Result> results, IEnumerable <Notification> toolNotifications, IEnumerable <Notification> configurationNotifications, IDictionary <string, Rule> rules, string id, string stableId, string automationId, string baselineId, string architecture)
 {
     Init(tool, invocation, files, logicalLocations, results, toolNotifications, configurationNotifications, rules, id, stableId, automationId, baselineId, architecture);
 }
Esempio n. 13
0
        private void Init(Tool tool, IEnumerable <Invocation> invocations, Conversion conversion, IEnumerable <VersionControlDetails> versionControlProvenance, IDictionary <string, ArtifactLocation> originalUriBaseIds, IEnumerable <Artifact> artifacts, IEnumerable <LogicalLocation> logicalLocations, IDictionary <string, Graph> graphs, IEnumerable <Result> results, RunAutomationDetails id, IEnumerable <RunAutomationDetails> aggregateIds, string baselineInstanceGuid, string markdownMessageMimeType, string redactionToken, string defaultFileEncoding, string defaultSourceLanguage, IEnumerable <string> newlineSequences, ColumnKind columnKind, ExternalPropertyFiles externalPropertyFiles, IDictionary <string, SerializedPropertyInfo> properties)
        {
            if (tool != null)
            {
                Tool = new Tool(tool);
            }

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

                Invocations = destination_0;
            }

            if (conversion != null)
            {
                Conversion = new Conversion(conversion);
            }

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

                VersionControlProvenance = destination_1;
            }

            if (originalUriBaseIds != null)
            {
                OriginalUriBaseIds = new Dictionary <string, ArtifactLocation>();
                foreach (var value_2 in originalUriBaseIds)
                {
                    OriginalUriBaseIds.Add(value_2.Key, new ArtifactLocation(value_2.Value));
                }
            }

            if (artifacts != null)
            {
                var destination_2 = new List <Artifact>();
                foreach (var value_3 in artifacts)
                {
                    if (value_3 == null)
                    {
                        destination_2.Add(null);
                    }
                    else
                    {
                        destination_2.Add(new Artifact(value_3));
                    }
                }

                Artifacts = destination_2;
            }

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

                LogicalLocations = destination_3;
            }

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

            if (results != null)
            {
                var destination_4 = new List <Result>();
                foreach (var value_6 in results)
                {
                    if (value_6 == null)
                    {
                        destination_4.Add(null);
                    }
                    else
                    {
                        destination_4.Add(new Result(value_6));
                    }
                }

                Results = destination_4;
            }

            if (id != null)
            {
                Id = new RunAutomationDetails(id);
            }

            if (aggregateIds != null)
            {
                var destination_5 = new List <RunAutomationDetails>();
                foreach (var value_7 in aggregateIds)
                {
                    if (value_7 == null)
                    {
                        destination_5.Add(null);
                    }
                    else
                    {
                        destination_5.Add(new RunAutomationDetails(value_7));
                    }
                }

                AggregateIds = destination_5;
            }

            BaselineInstanceGuid    = baselineInstanceGuid;
            MarkdownMessageMimeType = markdownMessageMimeType;
            RedactionToken          = redactionToken;
            DefaultFileEncoding     = defaultFileEncoding;
            DefaultSourceLanguage   = defaultSourceLanguage;
            if (newlineSequences != null)
            {
                var destination_6 = new List <string>();
                foreach (var value_8 in newlineSequences)
                {
                    destination_6.Add(value_8);
                }

                NewlineSequences = destination_6;
            }

            ColumnKind = columnKind;
            if (externalPropertyFiles != null)
            {
                ExternalPropertyFiles = new ExternalPropertyFiles(externalPropertyFiles);
            }

            if (properties != null)
            {
                Properties = new Dictionary <string, SerializedPropertyInfo>(properties);
            }
        }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Run" /> class from the supplied values.
 /// </summary>
 /// <param name="tool">
 /// An initialization value for the <see cref="P: Tool" /> property.
 /// </param>
 /// <param name="invocation">
 /// An initialization value for the <see cref="P: Invocation" /> property.
 /// </param>
 /// <param name="files">
 /// An initialization value for the <see cref="P: Files" /> property.
 /// </param>
 /// <param name="logicalLocations">
 /// An initialization value for the <see cref="P: LogicalLocations" /> property.
 /// </param>
 /// <param name="results">
 /// An initialization value for the <see cref="P: Results" /> property.
 /// </param>
 /// <param name="toolNotifications">
 /// An initialization value for the <see cref="P: ToolNotifications" /> property.
 /// </param>
 /// <param name="configurationNotifications">
 /// An initialization value for the <see cref="P: ConfigurationNotifications" /> property.
 /// </param>
 /// <param name="rules">
 /// An initialization value for the <see cref="P: Rules" /> property.
 /// </param>
 /// <param name="id">
 /// An initialization value for the <see cref="P: Id" /> property.
 /// </param>
 /// <param name="stableId">
 /// An initialization value for the <see cref="P: StableId" /> property.
 /// </param>
 /// <param name="automationId">
 /// An initialization value for the <see cref="P: AutomationId" /> property.
 /// </param>
 /// <param name="baselineId">
 /// An initialization value for the <see cref="P: BaselineId" /> property.
 /// </param>
 /// <param name="architecture">
 /// An initialization value for the <see cref="P: Architecture" /> property.
 /// </param>
 public Run(Tool tool, Invocation invocation, IDictionary<string, FileData> files, IDictionary<string, LogicalLocation> logicalLocations, IEnumerable<Result> results, IEnumerable<Notification> toolNotifications, IEnumerable<Notification> configurationNotifications, IDictionary<string, Rule> rules, string id, string stableId, string automationId, string baselineId, string architecture)
 {
     Init(tool, invocation, files, logicalLocations, results, toolNotifications, configurationNotifications, rules, id, stableId, automationId, baselineId, architecture);
 }
Esempio n. 15
0
        public override int GetHashCode()
        {
            int result = 17;

            unchecked
            {
                if (Tool != null)
                {
                    result = (result * 31) + Tool.GetHashCode();
                }

                if (Invocation != null)
                {
                    result = (result * 31) + Invocation.GetHashCode();
                }

                if (Files != null)
                {
                    // Use xor for dictionaries to be order-independent.
                    int xor_0 = 0;
                    foreach (var value_0 in Files)
                    {
                        xor_0 ^= value_0.Key.GetHashCode();
                        if (value_0.Value != null)
                        {
                            xor_0 ^= value_0.Value.GetHashCode();
                        }
                    }

                    result = (result * 31) + xor_0;
                }

                if (Results != null)
                {
                    foreach (var value_1 in Results)
                    {
                        result = result * 31;
                        if (value_1 != null)
                        {
                            result = (result * 31) + value_1.GetHashCode();
                        }
                    }
                }

                if (Rules != null)
                {
                    // Use xor for dictionaries to be order-independent.
                    int xor_1 = 0;
                    foreach (var value_2 in Rules)
                    {
                        xor_1 ^= value_2.Key.GetHashCode();
                        if (value_2.Value != null)
                        {
                            xor_1 ^= value_2.Value.GetHashCode();
                        }
                    }

                    result = (result * 31) + xor_1;
                }

                result = (result * 31) + StartTime.GetHashCode();
                result = (result * 31) + EndTime.GetHashCode();
                if (CorrelationId != null)
                {
                    result = (result * 31) + CorrelationId.GetHashCode();
                }

                if (Architecture != null)
                {
                    result = (result * 31) + Architecture.GetHashCode();
                }

                if (Properties != null)
                {
                    // Use xor for dictionaries to be order-independent.
                    int xor_2 = 0;
                    foreach (var value_3 in Properties)
                    {
                        xor_2 ^= value_3.Key.GetHashCode();
                        if (value_3.Value != null)
                        {
                            xor_2 ^= value_3.Value.GetHashCode();
                        }
                    }

                    result = (result * 31) + xor_2;
                }

                if (Tags != null)
                {
                    foreach (var value_4 in Tags)
                    {
                        result = result * 31;
                        if (value_4 != null)
                        {
                            result = (result * 31) + value_4.GetHashCode();
                        }
                    }
                }
            }

            return(result);
        }
Esempio n. 16
0
        private void Init(Tool tool, Invocation invocation, IDictionary<string, FileData> files, IDictionary<string, LogicalLocation> logicalLocations, IEnumerable<Result> results, IEnumerable<Notification> toolNotifications, IEnumerable<Notification> configurationNotifications, IDictionary<string, Rule> rules, string id, string stableId, string automationId, string baselineId, string architecture)
        {
            if (tool != null)
            {
                Tool = new Tool(tool);
            }

            if (invocation != null)
            {
                Invocation = new Invocation(invocation);
            }

            if (files != null)
            {
                Files = new Dictionary<string, FileData>();
                foreach (var value_0 in files)
                {
                    Files.Add(value_0.Key, new FileData(value_0.Value));
                }
            }

            if (logicalLocations != null)
            {
                LogicalLocations = new Dictionary<string, LogicalLocation>();
                foreach (var value_1 in logicalLocations)
                {
                    LogicalLocations.Add(value_1.Key, new LogicalLocation(value_1.Value));
                }
            }

            if (results != null)
            {
                var destination_0 = new List<Result>();
                foreach (var value_2 in results)
                {
                    if (value_2 == null)
                    {
                        destination_0.Add(null);
                    }
                    else
                    {
                        destination_0.Add(new Result(value_2));
                    }
                }

                Results = destination_0;
            }

            if (toolNotifications != null)
            {
                var destination_1 = new List<Notification>();
                foreach (var value_3 in toolNotifications)
                {
                    if (value_3 == null)
                    {
                        destination_1.Add(null);
                    }
                    else
                    {
                        destination_1.Add(new Notification(value_3));
                    }
                }

                ToolNotifications = destination_1;
            }

            if (configurationNotifications != null)
            {
                var destination_2 = new List<Notification>();
                foreach (var value_4 in configurationNotifications)
                {
                    if (value_4 == null)
                    {
                        destination_2.Add(null);
                    }
                    else
                    {
                        destination_2.Add(new Notification(value_4));
                    }
                }

                ConfigurationNotifications = destination_2;
            }

            if (rules != null)
            {
                Rules = new Dictionary<string, Rule>();
                foreach (var value_5 in rules)
                {
                    Rules.Add(value_5.Key, new Rule(value_5.Value));
                }
            }

            Id = id;
            StableId = stableId;
            AutomationId = automationId;
            BaselineId = baselineId;
            Architecture = architecture;
        }
Esempio n. 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Conversion" /> class from the supplied values.
 /// </summary>
 /// <param name="tool">
 /// An initialization value for the <see cref="P:Tool" /> property.
 /// </param>
 /// <param name="invocation">
 /// An initialization value for the <see cref="P:Invocation" /> property.
 /// </param>
 /// <param name="analysisToolLogFiles">
 /// An initialization value for the <see cref="P:AnalysisToolLogFiles" /> property.
 /// </param>
 /// <param name="properties">
 /// An initialization value for the <see cref="P:Properties" /> property.
 /// </param>
 public Conversion(Tool tool, Invocation invocation, IEnumerable <ArtifactLocation> analysisToolLogFiles, IDictionary <string, SerializedPropertyInfo> properties)
 {
     Init(tool, invocation, analysisToolLogFiles, properties);
 }