/*private functions*/ //Function responsible for handling the match to a tweet from the stream void handleMatchingTweet(object sender, MatchedTweetReceivedEventArgs args) { Matches++; foreach (var media in args.Tweet.Media) { //If the media is a photo //right now the only mediatype twitter gives us, but can change in the future if (media.MediaType == "photo") { var url = media.MediaURL ?? media.MediaURLHttps; //Filename is taken from the last section of the url var fileName = url.Substring(url.LastIndexOf("/") + 1); //download picture to image var image = GetDataByHttp(url); //TODO: Find male and female faces in image and generate a Gender[] //Store Metadata for the processed picture(Todo: pass Gender[] instead of null PictureMetaData meta = new PictureMetaData(DateTime.Now, null); PictureMetaDataList.Add(meta); //save the picture in the pictureQueue(treadsafe) EnqueuePicture(new PictureData(image, fileName, meta)); DownloadedPictures++; } } }
public PictureData(byte[] imageData, string fileName, PictureMetaData meta) : this(imageData, fileName) { this.MetaData = meta; }