示例#1
0
 private UpdateAnswer UpdateThreats()
 {
     try
     {
         var savedThreats = DBThreatsService.GetAllThreats();
         var newThreats   = GetThreatsFromFile(DownloadFile(FILE_LINK));
         DBThreatsService.ClearSavedThreats();
         DBThreatsService.SaveThreats(newThreats);
         var compareResult = CompareThreatLists(savedThreats, newThreats);
         return(new UpdateAnswer(compareResult));
     } catch (Exception ex) {
         return(new UpdateAnswer(ex.Message));
     }
 }
示例#2
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog fd = new SaveFileDialog();

            fd.Filter = "Excel file (*.xlsx)|*.xlsx";
            if (fd.ShowDialog() == true && fd.FileName != "")
            {
                string path = fd.FileName;
                MessageBox.Show(path);
                var    threatlist = DBThreatsService.GetAllThreats();
                Mapper mapper     = new Mapper();
                mapper.Save(path, threatlist);
            }
        }