//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static string StrImagesToJson(string strImagesFromTweet_I) { if (string.IsNullOrWhiteSpace(strImagesFromTweet_I)) { return(null); } string[] arrstrImages = TweetJsonFormat.ParseImages(strImagesFromTweet_I); return(JsonConvert.SerializeObject(arrstrImages)); }
//------------------------------------------------------------------------------------------------------------- // //METHODS //------------------------------------------------------------------------------------------------------------- public Tweet ToTweet() { Tweet tweetToReturn = new Tweet(); tweetToReturn.Id = this.Id; tweetToReturn.Likes = TweetJsonFormat.ProcessLikesFromString(this.Likes); tweetToReturn.DatePublished = this.DatePublished; tweetToReturn.Text = this.Text; tweetToReturn.Images = TweetJsonFormat.ProcessIncomingArrayOfImages(this.Images); tweetToReturn.PersonId = this.PersonId; tweetToReturn.ResponseId = this.ResponseId; return(tweetToReturn); }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public TweetJsonFormat(TweetViewModel tweetViewModel) { this.Id = tweetViewModel.Id; this.DatePublished = tweetViewModel.DatePublished; this.Text = tweetViewModel.Text; this.PersonId = tweetViewModel.PersonId; this.ResponseId = tweetViewModel.ResponseId; // this.Likes = tweetViewModel.Likes; // this.Images = tweetViewModel.Images; this.Likes = Like.ParseLikes(tweetViewModel.Likes); this.Images = TweetJsonFormat.ParseImages(tweetViewModel.Images); }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static string ProcessIncomingArrayOfImages(string strImagesFromTweet_I) { if (string.IsNullOrWhiteSpace(strImagesFromTweet_I)) { return(null); } string[] arrstrImages = JsonConvert.DeserializeObject <string[]>(strImagesFromTweet_I); System.Diagnostics.Debug.WriteLine("IMAGENES!!!!!!!!!!!!!!"); foreach (string strImage in arrstrImages) { System.Diagnostics.Debug.WriteLine(strImage); } return(TweetJsonFormat.ImagesToStr(arrstrImages)); }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static string ProcessLikesFromString(string strLikes_I) { Like[] arrlikeLikes = JsonConvert.DeserializeObject <Like[]>(strLikes_I); return(TweetJsonFormat.LikesToStr(arrlikeLikes)); }