Ejemplo n.º 1
0
        public static Invocation Create(bool emitMachineEnvironment = false)
        {
            var invocation = new Invocation();

            invocation.StartTime = DateTime.UtcNow;
            invocation.ProcessId = System.Diagnostics.Process.GetCurrentProcess().Id;
            invocation.WorkingDirectory = Environment.CurrentDirectory;
            invocation.CommandLine = Environment.CommandLine;

            if (emitMachineEnvironment)
            {
                invocation.Machine = Environment.MachineName;
                invocation.Account = Environment.UserName;
                invocation.EnvironmentVariables = CopyEnvironmentVariables();
            }

            Assembly assembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
            invocation.FileName = assembly.Location;

            return invocation;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Invocation" /> 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 Invocation(Invocation other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            Init(other.CommandLine, other.ResponseFiles, other.StartTime, other.EndTime, other.Machine, other.Account, other.ProcessId, other.FileName, other.WorkingDirectory, other.EnvironmentVariables, other.Properties);
        }
Ejemplo n.º 5
0
 public bool ValueEquals(Invocation other) => ValueComparer.Equals(this, other);
Ejemplo n.º 6
0
 public bool ValueEquals(Invocation other) => ValueComparer.Equals(this, other);
Ejemplo n.º 7
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);
 }
Ejemplo n.º 8
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>
 public Conversion(Tool tool, Invocation invocation, IEnumerable <FileLocation> analysisToolLogFiles)
 {
     Init(tool, invocation, analysisToolLogFiles);
 }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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;
        }
Ejemplo n.º 11
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));
                }
            }
        }
Ejemplo 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="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);
 }
Ejemplo n.º 13
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;
        }
Ejemplo 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);
 }