예제 #1
0
        private void button9_Click(object sender, EventArgs e)
        {
            //update group 4 vulnerabilities
            string[]      group4 = new String[] { "TargetAsset_9", "TargetAsset_10", "ToughTargetAsset_11" };
            List <string> states = new List <string>(new string[] { "Completed", "Unknown" });
            Dictionary <int, List <string> > capabilities  = new Dictionary <int, List <string> >();
            Dictionary <int, List <double> > ranges        = new Dictionary <int, List <double> >();
            Dictionary <int, List <int> >    intensities   = new Dictionary <int, List <int> >();
            Dictionary <int, List <double> > probabilities = new Dictionary <int, List <double> >();

            for (int y = 0; y < states.Count; y++)
            {
                if (!capabilities.ContainsKey(y))
                {
                    capabilities.Add(y, new List <string>());
                }
                if (!ranges.ContainsKey(y))
                {
                    ranges.Add(y, new List <double>());
                }
                if (!intensities.ContainsKey(y))
                {
                    intensities.Add(y, new List <int>());
                }
                if (!probabilities.ContainsKey(y))
                {
                    probabilities.Add(y, new List <double>());
                }
            }

            //transition to completed
            capabilities[0].Add("STRK");
            ranges[0].Add(0);
            intensities[0].Add(1);
            probabilities[0].Add(100);

            //transition to unknown
            capabilities[1].Add("C2");
            ranges[1].Add(0);
            intensities[1].Add(1);
            probabilities[1].Add(100);


            try
            {
                for (int x = 0; x < group4.Length; x++)
                {
                    _connection.UpdateObjectVulnerabilities(group4[x], states, capabilities, ranges, intensities, probabilities);
                }
            }
            catch (Exception ex)
            {
                UpdateTextBox(String.Format("Error updating group 4 vulnerabilities: {0}", ex.Message));
            }
        }