コード例 #1
0
        public string Get_RSS(string filePath, int daysAgo)
        {
            //Initialize Variables
            List <string> outputList = new List <string>();
            DateTime      now        = DateTime.Now;
            //declare Dictionary with input filepath
            RSSDictionary dictionary = new RSSDictionary(filePath);

            //read in file
            String fileString = dictionary.RetrieveDictionary();

            //parse dictionary
            dictionary.setDictionary(fileString);

            //get feeds from dictionary
            dictionary.getFeeds();

            //get postBy date
            DateTime postBy = now.AddDays(-daysAgo);

            //add feeds without posts to output
            foreach (var company in dictionary.postDict)
            {
                if (company.Value < postBy)
                {
                    outputList.Add(company.Key);
                }
            }

            var result = $"The following companies have not posted in the past {daysAgo} days: \n" + String.Join(", ", outputList.ToArray());

            return(result);
        }
コード例 #2
0
        private void ButtonPress(object sender, RoutedEventArgs e)
        {
            //Initialize Variables
            outputBox.Text = "";
            var outputList = new List <string>();
            var filePath   = URLBox.Text;
            var dictionary = new RSSDictionary(filePath);

            var fileString = dictionary.RetrieveDictionary();

            outputBox.Text += "Reading File...\n";
            outputBox.Text += fileString;

            var result = String.Join(",", outputList.ToArray());

            outputBox.Text += result;
        }