public void Save() { if (!IsValid()) { return; } if (ratingwidget.Value != (int)Meta.Rating) { Meta.Rating = ratingwidget.Value; } if ((int)numRuntime.Value != (int)(Meta.Runtime / 60)) { Meta.Runtime = (int)numRuntime.Value * 60; } Meta.Title = txtTitle.Text; Meta.SortTitle = txtSortTitle.Text; Meta.Set = txtSet.Text; Meta.TagLine = txtTagline.Text; Meta.Genres = txtGenres.Text.ToStringArray(); Meta.Directors = txtDirectors.Text.ToStringArray(); Meta.Writers = txtWriters.Text.ToStringArray(); Meta.Trailer = txtTrailer.Text; Meta.Id = txtImdbId.Text; Meta.Mpaa = txtMpaa.Text; Meta.ReleaseDate = !System.Text.RegularExpressions.Regex.IsMatch(txtReleaseDate.Text, @"^[\d]{4}\-[\d]{2}\-[\d]{2}$") ? DateTime.MinValue : DateTime.ParseExact(txtReleaseDate.Text, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); Meta.Plot = txtPlot.Buffer.Text ?? ""; Meta.Actors = ActorNode.GetActors(store); Meta.Save(false); Destroy(); }
public void Save() { EpisodeMeta.Title = txtEpisodeName.Text; EpisodeMeta.Studio = txtStudio.Text; EpisodeMeta.Plot = txtPlot.Buffer.Text; EpisodeMeta.Mpaa = txtMpaa.Text; EpisodeMeta.Writers = txtWriters.Text.ToStringArray(); EpisodeMeta.Directors = txtDirectors.Text.ToStringArray(); if (((int)EpisodeMeta.Rating) != ratingwidget1.Value) // check if the rating was changed { EpisodeMeta.Rating = ratingwidget1.Value; } if (!String.IsNullOrEmpty(txtAired.Text)) { EpisodeMeta.Aired = DateTime.ParseExact(txtAired.Text, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); } if (!String.IsNullOrEmpty(txtPremiered.Text)) { EpisodeMeta.Premiered = DateTime.ParseExact(txtPremiered.Text, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); } EpisodeMeta.Episode = (int)numEpisode.Value; EpisodeMeta.Season = (int)numSeason.Value; EpisodeMeta.DisplayEpisode = (int)numDisplayEpisode.Value; EpisodeMeta.DisplaySeason = (int)numDisplaySeason.Value; //EpisodeMeta.EpBookmark = (int)DateTime.ParseExact(mtbEpisodeStart.Text, "HH:mm:ss", CultureInfo.InvariantCulture).TimeOfDay.TotalSeconds; /* * List<KeyValuePair<string, string>> actors = new List<KeyValuePair<string,string>>(); * * var enumerator = store.GetEnumerator(); * while(enumerator.MoveNext()) * { * var actor = (ActorNode)enumerator.Current; * if(!String.IsNullOrWhiteSpace(actor.Name.Trim())) * actors.Add(new KeyValuePair<string, string>(actor.Name, actor.Role)); * } * EpisodeMeta.Actors = actors.ToArray();*/ EpisodeMeta.Actors = ActorNode.GetActors(store); }