private void ButtonStream_Click(object sender, EventArgs e) { var flickr = new Flickr(Program.ApiKey, Program.SharedSecret, Program.AuthToken); // Referrers DateTime day = DateTime.Today; var statfile = new System.IO.StreamWriter("stream_domains.csv"); var reffile = new System.IO.StreamWriter("stream_referrers.csv"); while (day > Program.LastUpdate) { try { // Liste des domaines référents var s = flickr.StatsGetPhotostreamDomains(day, 1, 100); StatusLabel.Text = "Statistiques du flux pour le " + day.ToShortDateString(); Application.DoEvents(); statfile.Write(Utility.toCSV(s, day.ToShortDateString())); foreach (StatDomain dom in s) { var r = flickr.StatsGetPhotostreamReferrers(day, dom.Name, 1, 100); reffile.Write(Utility.toCSV(r, day.ToShortDateString() + ";" + dom.Name)); } } catch (FlickrApiException ex) { MessageBox.Show("Erreur lors du chargement des domaines référents du " + day.ToShortDateString() + " : " + ex.OriginalMessage, "Erreur", MessageBoxButtons.OK); break; } day -= TimeSpan.FromDays(1); } // Fermeture des fichiers statfile.Close(); reffile.Close(); }