public bool Remove(PlaylistItem item) { if (PlaylistItems.Contains(item)) { if (_PlaylistItems.Remove(item)) { HohoemaPlaylist.Save(this).ConfigureAwait(false); return(true); } } return(false); }
public PlaylistItem AddVideo(string contentId, string contentName = null, ContentInsertPosition insertPosition = ContentInsertPosition.Tail) { if (contentId == null) { throw new Exception(); } // すでに登録済みの場合 var alreadyAdded = _PlaylistItems.SingleOrDefault(x => x.Type == PlaylistItemType.Video && x.ContentId == contentId); if (alreadyAdded != null) { // 何もしない return(alreadyAdded); } var newItem = new QualityVideoPlaylistItem() { Type = PlaylistItemType.Video, ContentId = contentId, Title = contentName, Quality = null, Owner = this, }; if (insertPosition == ContentInsertPosition.Head) { _PlaylistItems.Insert(0, newItem); } else { _PlaylistItems.Add(newItem); } HohoemaPlaylist.Save(this).ConfigureAwait(false); return(newItem); }