private void SuccessfulInput() { getset.Movie movie = new getset.Movie(); movie.Name = NameTxt; movie.Airdate = new DateTime(AiredOnTxt["Year"], AiredOnTxt["Day"], AiredOnTxt["Month"]); movie.RottenTomatoRating = Convert.ToInt32(RatingTxt); movie.MainCharacters = MainCharsTxt.Split(',').ToArray(); movie.Genres = GenresTxt; string moviedetails = JsonConvert.SerializeObject(movie); File.WriteAllText($@".\Jsons\{NameTxt}.txt", moviedetails); AiredOnTxt.Clear(); }
private void Output() { string mainChars = ""; string JsonInput = File.ReadAllText($@".\Jsons\{TextboxJson.Text}.txt"); getset.Movie m = JsonConvert.DeserializeObject <getset.Movie>(JsonInput); foreach (var i in m.MainCharacters) { mainChars = mainChars.Insert(mainChars.Length, i).Insert(mainChars.Length, ", "); } NameOutput.Text = $"Name: {m.Name}"; AiredOnOutput.Text = $"Aired on: {m.Airdate.ToShortDateString()}"; RTOutput.Text = $"Rotten Tomatoes Rating: {m.RottenTomatoRating.ToString()}"; MainCharsOutput.Text = $"Main Characters: {mainChars.TrimStart(',')}"; GenreOutput.Text = $"Genre: {m.Genres}"; }