Exemplo n.º 1
0
        /// <summary>
        /// Returns the environmental score of the CVSS object.
        /// </summary>
        /// <exception cref="System.ArgumentException">Thrown when vector is not valid.</exception>
        public double EnvironmentalScore()
        {
            if (!IsValid())
            {
                throw new ArgumentException();
            }

            return(EnvironmentalMetric.Score());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the selected value for a metric.
        /// </summary>
        /// <returns>
        /// Returns the selected value or empty string if metric is not found.
        /// </returns>
        /// <example>
        /// <code>
        /// var selected = cvss.SelectedValue("Access Vector");
        /// returns "Network"
        /// </code>
        /// </example>
        /// <param name="metric">A valid metric e.g. "Access Vector", "Authentication", "Attack Vector".</param>
        /// <exception cref="System.ArgumentException">Thrown when vector is not valid.</exception>
        public string SelectedMetric(string metric)
        {
            if (!IsValid())
            {
                throw new ArgumentException();
            }

            if (!String.IsNullOrEmpty(BaseMetric.SelectedValue(metric)))
            {
                return(BaseMetric.SelectedValue(metric));
            }
            if (!String.IsNullOrEmpty(TemporalMetric.SelectedValue(metric)))
            {
                return(TemporalMetric.SelectedValue(metric));
            }
            if (!String.IsNullOrEmpty(EnvironmentalMetric.SelectedValue(metric)))
            {
                return(EnvironmentalMetric.SelectedValue(metric));
            }
            return("");
        }