private void GivenExistingMovie() { WaitForCompletion(() => Profiles.All().Count > 0); foreach (var title in new[] { "The Dark Knight", "Pulp Fiction" }) { var newMovie = Movies.Lookup(title).First(); newMovie.QualityProfileId = 1; newMovie.Path = string.Format(@"C:\Test\{0}", title).AsOsAgnostic(); Movies.Post(newMovie); } }
private void GivenExistingAuthor() { WaitForCompletion(() => Profiles.All().Count > 0); foreach (var name in new[] { "Alien Ant Farm", "Kiss" }) { var newAuthor = Author.Lookup(name).First(); newAuthor.QualityProfileId = 1; newAuthor.MetadataProfileId = 1; newAuthor.Path = string.Format(@"C:\Test\{0}", name).AsOsAgnostic(); Author.Post(newAuthor); } }
private async void Button_SaveProfile_Click(object sender, EventArgs e) { if (OldProfile != null) { await Profiles.ReplaceAsync(OldProfile, NewProfile); } else { if (Profiles.All(profile => profile.Name != NewProfile.Name)) { await Profiles.AddAsync(NewProfile); } } await Profiles.SaveAsync(); Close(); }
private void ChangeProfilesOrder(Profile profile, bool moveDown) { if (string.IsNullOrWhiteSpace(profile.ProfileName)) { throw new ArgumentNullException(nameof(profile.ProfileName)); } if (Profiles.All(pair => pair.Key != profile.ProfileName)) { throw new ArgumentException("Profile '" + profile.ProfileName + "' does not exist."); } int index = Profiles.IndexOf(Profiles.First(pair => pair.Key == profile.ProfileName)); if (index != 0 && moveDown) { Profiles.RemoveAt(index); Profiles.Insert(index - 1, new KeyValuePair <string, Profile>(profile.ProfileName, profile)); } if (index != Profiles.Count - 1 && !moveDown) { Profiles.RemoveAt(index); Profiles.Insert(index + 1, new KeyValuePair <string, Profile>(profile.ProfileName, profile)); } }