public IAttemptResult UnWireVideo(int videoId, int playlistId) { if (!this.Exists(playlistId)) { return(AttemptResult.Fail("指定したプレイリストが存在しません。")); } IAttemptResult <STypes::Playlist> pResult = this.GetPlaylist(playlistId); if (!pResult.IsSucceeded || pResult.Data is null) { return(AttemptResult.Fail("プレイリストの取得に失敗しました。")); } STypes::Playlist playlist = pResult.Data; playlist.Videos.RemoveAll(v => v.Id == videoId); playlist.CustomVideoSequence.RemoveAll(v => v == videoId); var uResult = this.databaseInstance.Update(playlist, STypes::Playlist.TableName); if (!uResult.IsSucceeded) { return(AttemptResult.Fail($"動画の削除に失敗しました。(詳細:{uResult.ExceptionMessage})")); } this.logger.Log($"{playlist.PlaylistName}からの動画({videoId})を削除しました。"); return(AttemptResult.Succeeded()); }
public ITreePlaylistInfo ConvertStorePlaylistToLocalPlaylist(STypes::Playlist source) { var converted = this._playlistInfoContainer.GetPlaylist(source.Id); converted.Id = source.Id; converted.ParentId = source.ParentPlaylist?.Id ?? -1; converted.IsRoot = source.IsRoot; converted.Name.Value = source.PlaylistName ?? string.Empty; converted.IsRemotePlaylist = source.IsRemotePlaylist; converted.RemoteType = source.IsMylist ? RemoteType.Mylist : source.IsUserVideos ? RemoteType.UserVideos : source.IsWatchLater ? RemoteType.WatchLater : source.IsChannel ? RemoteType.Channel : source.IsSeries ? RemoteType.Series : RemoteType.None; converted.RemoteId = source.RemoteId ?? string.Empty; converted.Folderpath = source.FolderPath ?? string.Empty; converted.IsExpanded = converted.IsExpanded || source.IsExpanded; converted.VideoSortType = source.SortType; converted.IsVideoDescending = source.IsVideoDescending; converted.IsDownloadFailedHistory = source.IsDownloadFailedHistory; converted.IsDownloadSucceededHistory = source.IsDownloadSucceededHistory; converted.IsTemporary = source.IsTemporary; converted.BookMarkedVideoID = source.BookMarkedVideoID; converted.Videos.Clear(); converted.Videos.AddRange(source.Videos.Select(v => this.ConvertStoreVideoToLocalVideo(v))); if (source.ParentPlaylist is not null) { converted.ParentId = source.ParentPlaylist.Id; } return(converted); }
/// <summary> /// 子プレイリストを辿って削除する /// </summary> /// <param name="parentId"></param> private IAttemptResult RemoveChildPlaylist(STypes::Playlist self) { if (self.IsConcretePlaylist) { return(AttemptResult.Succeeded()); } IAttemptResult <List <STypes::Playlist> > cResult = this.GetChildPlaylists(self.Id); if (!cResult.IsSucceeded || cResult.Data is null) { return(AttemptResult.Fail("子プレイリストの取得に失敗しました。")); } foreach (var childPlaylist in cResult.Data) { IAttemptResult crResult = this.RemoveChildPlaylist(childPlaylist); if (!crResult.IsSucceeded) { return(AttemptResult.Fail("子孫プレイリストの削除に失敗しました。")); } IAttemptResult dResul = this.DeletePlaylist(childPlaylist.Id); if (!dResul.IsSucceeded) { return(AttemptResult.Fail("子プレイリストの削除に失敗しました。")); } this.logger.Log($"{self.Id}の子プレイリストを削除しました。"); } return(AttemptResult.Succeeded()); }
public STypes::Playlist ConvertLocalPlaylistToStorePlaylist(ITreePlaylistInfo source) { var converted = new STypes::Playlist(); converted.Id = source.Id; converted.IsRoot = source.IsRoot; converted.PlaylistName = source.Name.Value; converted.FolderPath = source.Folderpath; converted.IsExpanded = source.IsExpanded; converted.SortType = source.VideoSortType; converted.IsVideoDescending = source.IsVideoDescending; converted.IsTemporary = source.IsTemporary; converted.IsDownloadSucceededHistory = source.IsDownloadSucceededHistory; converted.IsDownloadFailedHistory = source.IsDownloadFailedHistory; converted.IsRemotePlaylist = source.RemoteType != RemoteType.None; converted.RemoteId = source.RemoteId; converted.IsWatchLater = source.RemoteType == RemoteType.WatchLater; converted.IsMylist = source.RemoteType == RemoteType.Mylist; converted.IsSeries = source.RemoteType == RemoteType.Series; converted.IsChannel = source.RemoteType == RemoteType.Channel; converted.IsUserVideos = source.RemoteType == RemoteType.UserVideos; converted.BookMarkedVideoID = source.BookMarkedVideoID; converted.Videos.Clear(); converted.Videos.AddRange(source.Videos.Select(v => this.ConvertLocalVideoToStoreVideo(v))); IAttemptResult <STypes::Playlist> pResult = this._playlistStoreHandler.GetPlaylist(source.ParentId); if (pResult.IsSucceeded && pResult.Data is not null) { converted.ParentPlaylist = pResult.Data; } return(converted); }
public IAttemptResult MoveVideoToPrev(int playlistID, int videoIndex) { if (!this.Exists(playlistID)) { return new AttemptResult() { Message = $"指定されたプレイリストは存在しません。(id={playlistID})" } } ; IAttemptResult <STypes::Playlist> pResult = this.GetPlaylist(playlistID); if (!pResult.IsSucceeded || pResult.Data is null) { return(AttemptResult.Fail("プレイリストの取得に失敗しました。")); } STypes::Playlist playlist = pResult.Data; if (playlist.Videos.Count < videoIndex + 1) { return new AttemptResult() { Message = $"指定されたインデックスは範囲外です。(index={videoIndex}, actual={playlist.Videos.Count})" } } ; if (videoIndex == 0) { return new AttemptResult() { Message = $"指定されたインデックスは最初の動画です。(index={videoIndex})" } } ; try { playlist.CustomVideoSequence.InsertIntoPrev(videoIndex); } catch (Exception e) { return(new AttemptResult() { Message = $"挿入操作に失敗しました。", Exception = e }); } playlist.SortType = STypes.VideoSortType.Custom; this.Update(playlist); this.logger.Log($"{playlistID}の{videoIndex + 1}番目の動画を一つ後ろに挿入しました。"); return(new AttemptResult() { IsSucceeded = true }); }
public void SetUp() { ///・名前 ///各IDを漢数字に置き換えたもの ///・ツリー構造 ///親(1)─子(2)─子(4)─子(5) /// └子(3) ┠子(6) /// └子(7) var first = new STypes::Playlist() { Id = 1, IsRoot = true, PlaylistName = "一", IsTemporary = true }; var second = new STypes::Playlist() { Id = 2, PlaylistName = "二", IsDownloadFailedHistory = true }; var third = new STypes::Playlist() { Id = 3, PlaylistName = "三", IsDownloadSucceededHistory = true }; var fourth = new STypes::Playlist() { Id = 4, PlaylistName = "四" }; var fifth = new STypes::Playlist() { Id = 5, PlaylistName = "五" }; var sixth = new STypes::Playlist() { Id = 6, PlaylistName = "六" }; var seventh = new STypes::Playlist() { Id = 7, PlaylistName = "七" }; //親を設定 second.ParentPlaylist = first; third.ParentPlaylist = first; fourth.ParentPlaylist = second; fifth.ParentPlaylist = fourth; sixth.ParentPlaylist = fourth; seventh.ParentPlaylist = fourth; //全て追加 var playlists = new List <STypes::Playlist>() { first, second, third, fourth, fifth, sixth, seventh }; this.handler = new PlaylistTreeHandler(new PlaylistSettingsHandlerStab()); this.handler.Initialize(playlists.Select(p => NonBindableTreePlaylistInfo.ConvertToTreePlaylistInfo(p)).ToList()); }
/// <summary> /// データをセットする /// </summary> /// <param name="dbPlaylist"></param> /// <param name="playlistInfo"></param> private void SetData(STypes::Playlist dbPlaylist, ITreePlaylistInfo playlistInfo) { dbPlaylist.PlaylistName = playlistInfo.Name.Value; dbPlaylist.FolderPath = playlistInfo.Folderpath; dbPlaylist.IsExpanded = playlistInfo.IsExpanded; dbPlaylist.CustomVideoSequence.Clear(); dbPlaylist.CustomVideoSequence.AddRange(playlistInfo.CustomSortSequence); dbPlaylist.SortType = playlistInfo.VideoSortType; dbPlaylist.IsVideoDescending = playlistInfo.IsVideoDescending; dbPlaylist.IsTemporary = playlistInfo.IsTemporary; dbPlaylist.IsDownloadSucceededHistory = playlistInfo.IsDownloadSucceededHistory; dbPlaylist.IsDownloadFailedHistory = playlistInfo.IsDownloadFailedHistory; dbPlaylist.BookMarkedVideoID = playlistInfo.BookMarkedVideoID; }
public IAttemptResult Update(STypes::Playlist playlist) { if (!this.Exists(playlist.Id)) { this.logger.Error($"存在しないプレイリストに対して更新が試行されました。(name:{playlist.PlaylistName}, ID:{playlist.Id})"); return(AttemptResult.Fail("存在しないプレイリストに対して更新が試行されました。")); } this.databaseInstance.Update(playlist, STypes::Playlist.TableName); this.logger.Log($"プレイリスト(name:{playlist.PlaylistName}, ID:{playlist.Id})を更新しました。"); return(AttemptResult.Succeeded()); }
public void テストプレイリストを保存する() { var playlist = new STypes::Playlist() { PlaylistName = "テスト" }; int id = this.dataBase?.Store(playlist, STypes::Playlist.TableName).Data ?? -1; Assert.AreNotEqual(-1, id); Assert.IsTrue(this.dataBase?.Exists <STypes::Playlist>(STypes::Playlist.TableName, id)); this.dataBase?.Delete(STypes::Playlist.TableName, id); }
private IAttemptResult FixPlaylist(STypes::Playlist playlist) { //親が存在しないプレイリスト(孤児プレイリスト)の場合はそれ自体を削除 if (playlist.ParentPlaylist is not null && !this.Exists(playlist.ParentPlaylist.Id)) { IAttemptResult dResult = this.DeletePlaylist(playlist.Id); if (!dResult.IsSucceeded) { return(dResult); } this.logger.Log($"孤児プレイリスト(name:{playlist.PlaylistName}, ID:{playlist.Id})を削除しました。"); return(AttemptResult.Succeeded()); } //並び替え情報を実際の動画と揃える if (playlist.Videos.Count > 0 && playlist.Videos.Count != playlist.CustomVideoSequence.Count) { if (playlist.Videos.Count > playlist.CustomVideoSequence.Count) { var videosToAdd = playlist.Videos.Select(v => v.Id).Where(id => !playlist.CustomVideoSequence.Contains(id)); playlist.CustomVideoSequence.AddRange(videosToAdd); } else { var videoIDs = playlist.Videos.Select(v => v.Id).ToList(); var newSequence = playlist.CustomVideoSequence.Where(id => videoIDs.Contains(id)); playlist.CustomVideoSequence.Clear(); playlist.CustomVideoSequence.AddRange(newSequence); } IAttemptResult uResult = this.Update(playlist); if (!uResult.IsSucceeded) { return(uResult); } this.logger.Log($"並び替え順情報を登録されている動画数と同期しました。(id:{playlist.Id})"); } return(AttemptResult.Succeeded()); }
public IAttemptResult DeletePlaylist(int playlistID) { if (!this.Exists(playlistID)) { this.logger.Error("存在しないプレイリストに対して削除が試行されました。"); return(AttemptResult.Fail("存在しないプレイリストに対して削除が試行されました。")); } IAttemptResult <STypes::Playlist> result = this.GetPlaylist(playlistID); if (!result.IsSucceeded || result.Data is null) { this.logger.Error("削除対象のプレイリストの取得に失敗しました。"); return(AttemptResult.Fail("削除対象のプレイリストの取得に失敗しました。")); } STypes::Playlist playlist = result.Data; //ルートプレイリストは削除禁止 if (playlist.IsRoot || playlist.Layer == 1 || playlist !.IsTemporary || playlist !.IsDownloadFailedHistory || playlist !.IsDownloadSucceededHistory) { this.logger.Log($"削除できないプレイリストに対する削除が試行されました。(isRoot:{playlist.IsRoot}, layer:{playlist.Layer}, isTmp:{playlist.IsTemporary}, isFailed:{ playlist.IsDownloadFailedHistory}, IsSucceeeded:{playlist.IsDownloadSucceededHistory})"); return(AttemptResult.Fail("削除できないプレイリストに対する削除が試行されました。")); } IAttemptResult cResult = this.RemoveChildPlaylist(playlist); if (!cResult.IsSucceeded) { return(cResult); } IAttemptResult <bool> deleteResult = this.databaseInstance.Delete(STypes::Playlist.TableName, playlistID); if (!deleteResult.IsSucceeded || !deleteResult.Data) { return(AttemptResult.Fail("プレイリストの削除に失敗しました。")); } this.logger.Log($"{playlistID}を削除しました。"); return(AttemptResult.Succeeded()); }
private IAttemptResult SetPlaylists(bool expandAll = false, bool inheritExpandedState = false, bool isInitialRefresh = false) { //プレイリスト var list = new List <ITreePlaylistInfo>(); //プレイリストを取得する IAttemptResult <List <STypes::Playlist> > pResult = this._playlistStoreHandler.GetAllPlaylists(); if (!pResult.IsSucceeded || pResult.Data is null) { return(AttemptResult.Fail()); } for (var i = 0; i < pResult.Data.Count; ++i) { STypes::Playlist p = pResult.Data[i]; ITreePlaylistInfo playlist = this._converter.ConvertStorePlaylistToLocalPlaylist(p); var ex = playlist.IsExpanded; if (isInitialRefresh && !inheritExpandedState) { ex = false; } if (expandAll) { ex = true; } else if (inheritExpandedState) { ex = p.IsExpanded; } playlist.IsExpanded = ex; list.Add(playlist); } this._treeHandler.Initialize(list); return(AttemptResult.Succeeded()); }
public IAttemptResult WireVideo(STypes::Video video, int playlistId) { if (!this.Exists(playlistId)) { return(AttemptResult.Fail("指定したプレイリストが存在しません。")); } IAttemptResult <STypes::Playlist> pResult = this.GetPlaylist(playlistId); if (!pResult.IsSucceeded || pResult.Data is null) { return(AttemptResult.Fail("プレイリストの取得に失敗しました。")); } STypes::Playlist playlist = pResult.Data; if (playlist.Videos is null) { playlist.Videos = new List <STypes.Video>(); } if (playlist.Videos.Any(v => v.NiconicoId == video.NiconicoId)) { return(AttemptResult.Fail("すでに登録されている動画です。")); } playlist.Videos.Add(video); playlist.CustomVideoSequence.Add(video.Id); IAttemptResult uResult = this.databaseInstance.Update(playlist, STypes::Playlist.TableName); if (!uResult.IsSucceeded) { return(AttemptResult.Fail($"動画の追加に失敗しました。(詳細:{uResult.ExceptionMessage})")); } this.logger.Log($"{video.NiconicoId}をプレイリスト({playlist.PlaylistName})に追加しました。"); return(AttemptResult.Succeeded()); }
/// <summary> /// プレイリストのコピー・移動を行う内部メソッド /// </summary> /// <param name="id"></param> /// <param name="destId"></param> /// <param name="IsCopy"></param> private IAttemptResult InternalMove(int id, int destId, bool IsCopy) { //移動先と異動元が同一のプレイリストの場合キャンセル //(自分に自分を入れることは出来ない。) if (id == destId) { return(AttemptResult.Fail("移動先と移動元が同じです。")); } IAttemptResult <STypes::Playlist> rDestination = this.GetPlaylist(destId) !; IAttemptResult <STypes::Playlist> rTarget = this.GetPlaylist(id) !; if (!rDestination.IsSucceeded || rDestination.Data is null || !rTarget.IsSucceeded || rTarget.Data is null) { return(AttemptResult.Fail("プレイリストの取得に失敗しました。")); } STypes::Playlist destination = rDestination.Data; STypes::Playlist target = rTarget.Data; //フォルダー・プレイリストでない場合はキャンセル if (destination.IsConcretePlaylist) { return(AttemptResult.Fail("移動先のプレイリストが不適切です。")); } if (IsCopy) { STypes::Playlist newtarget = target with { ParentPlaylist = destination }; return(this.databaseInstance.Store(newtarget, STypes::Playlist.TableName)); } else { target.ParentPlaylist = destination; this.logger.Log($"プレイリスト(name:{target.PlaylistName}, ID:{target.Id})を{target.ParentPlaylist.PlaylistName}から{destination.PlaylistName}に移動しました。"); return(this.Update(target)); } }
public IAttemptResult Update(ITreePlaylistInfo newpaylist) { if (!this._playlistStoreHandler.Exists(newpaylist.Id)) { return(AttemptResult.Fail("指定されたプレイリストが存在しません。")); } STypes::Playlist converted = this._converter.ConvertLocalPlaylistToStorePlaylist(newpaylist); IAttemptResult result = this._playlistStoreHandler.Update(converted); if (!result.IsSucceeded) { return(AttemptResult.Fail()); } this._treeHandler.MergeRange(new List <ITreePlaylistInfo> { newpaylist }); return(AttemptResult.Succeeded()); }
public IAttemptResult SetAsLocalPlaylist(int playlistId) { if (!this.Exists(playlistId)) { return new AttemptResult() { Message = $"指定されたプレイリストは存在しません。(id={playlistId})" } } ; IAttemptResult <STypes::Playlist> pResult = this.GetPlaylist(playlistId); if (!pResult.IsSucceeded || pResult.Data is null) { return(AttemptResult.Fail("プレイリストの取得に失敗しました。")); } STypes::Playlist playlist = pResult.Data; playlist.IsRemotePlaylist = false; playlist.IsMylist = false; playlist.IsUserVideos = false; playlist.IsWatchLater = false; playlist.IsChannel = false; playlist.IsSeries = false; IAttemptResult uResult = this.Update(playlist); if (!uResult.IsSucceeded) { return(uResult); } this.logger.Log($"{playlistId}をローカルプレイリストに設定しました。"); return(AttemptResult.Succeeded()); }
public void データベース型からTreePlaylistInfo型への変換() { var storeData = new STypes::Playlist() { Id = 1, ParentPlaylist = new STypes.Playlist() { Id = 1 }, IsRoot = true, PlaylistName = "テスト" }; var playlistInfo = NonBindableTreePlaylistInfo.ConvertToTreePlaylistInfo(storeData); //プレイリスト名 Assert.AreEqual("テスト", storeData.PlaylistName); //ID Assert.AreEqual(playlistInfo.Id, 1); //親のID Assert.AreEqual(playlistInfo.ParentId, 1); //ルートフラグ Assert.IsTrue(playlistInfo.IsRoot); }
public IAttemptResult <int> AddPlaylist(int parentId, string name) { if (this.Exists(parentId)) { var parent = this.databaseInstance.GetRecord <STypes::Playlist>(STypes::Playlist.TableName, parentId); if (!parent.IsSucceeded || parent.Data is null) { if (parent.Exception is not null) { this.logger.Error("親プレイリストの取得に失敗しました。", parent.Exception); } else { this.logger.Error("親プレイリストの取得に失敗しました。"); } return(AttemptResult <int> .Fail("親プレイリストの取得に失敗しました。")); } //動画を保持している、特殊なプレイリスト場合はキャンセル if (parent.Data !.IsConcretePlaylist || parent.Data.IsTemporary || parent.Data.IsDownloadFailedHistory || parent.Data.IsDownloadSucceededHistory) { return(AttemptResult <int> .Fail("指定したプレイリストは子プレイリストを持つことができません。")); } //5階層よりも深い場合はキャンセル if (parent.Data.Layer > 5) { return(AttemptResult <int> .Fail("5階層よりも深くすることはできません。")); } var playlist = new STypes::Playlist(parent.Data) { PlaylistName = name }; var storeResult = this.databaseInstance.Store(playlist, STypes::Playlist.TableName); if (!storeResult.IsSucceeded) { if (storeResult.Exception is not null) { this.logger.Error("プレイリストの保存に失敗しました。", storeResult.Exception); } else { this.logger.Error("プレイリストの保存に失敗しました。"); } return(AttemptResult <int> .Fail("プレイリストの保存に失敗しました。")); } this.logger.Log($"新規プレイリスト`{name}`を追加しました。"); return(AttemptResult <int> .Succeeded(storeResult.Data)); } else { this.logger.Error("親プレイリストが存在しなかったため新規プレイリストを保存できませんでした。"); return(AttemptResult <int> .Fail("親プレイリストが存在しなかったため新規プレイリストを保存できませんでした。")); } }
public IAttemptResult Update(STypes::Playlist playlist) { return(AttemptResult.Succeeded()); }
public IAttemptResult SetAsRemotePlaylist(int playlistId, string remoteId, RemoteType type) { if (!this.Exists(playlistId)) { return new AttemptResult() { Message = $"指定されたプレイリストは存在しません。(id={playlistId})" } } ; IAttemptResult <STypes::Playlist> pResult = this.GetPlaylist(playlistId); if (!pResult.IsSucceeded || pResult.Data is null) { return(AttemptResult.Fail("プレイリストの取得に失敗しました。")); } STypes::Playlist playlist = pResult.Data; playlist !.IsRemotePlaylist = true; playlist.RemoteId = remoteId; playlist.IsMylist = false; playlist.IsUserVideos = false; playlist.IsWatchLater = false; playlist.IsChannel = false; playlist.IsSeries = false; switch (type) { case RemoteType.Mylist: playlist.IsMylist = true; break; case RemoteType.UserVideos: playlist.IsUserVideos = true; break; case RemoteType.WatchLater: playlist.IsWatchLater = true; break; case RemoteType.Channel: playlist.IsChannel = true; break; case RemoteType.Series: playlist.IsSeries = true; break; } IAttemptResult uResult = this.Update(playlist); if (!uResult.IsSucceeded) { return(uResult); } this.logger.Log($"{playlistId}をリモートプレイリスト({type})に設定しました。"); return(AttemptResult.Succeeded()); }
/// <summary> /// 初期化 /// </summary> /// <returns></returns> public IAttemptResult Initialize() { if (!this.Exists(p => p.IsRoot)) { var root = new STypes::Playlist() { IsRoot = true, PlaylistName = "プレイリスト一覧", }; var result = this.databaseInstance.Store(root, STypes::Playlist.TableName); if (!result.IsSucceeded) { if (result.Exception is not null) { this.logger.Error($"ルートプレイリストの保存に失敗しました。({result.Message})", result.Exception); } else { this.logger.Error($"ルートプレイリストの保存に失敗しました。({result.Message})"); } return(new AttemptResult() { Message = "ルートプレイリストの保存に失敗しました。", Exception = result.Exception }); } this.logger.Log("ルートプレイリストが存在しなかったので作成しました。"); } if (!this.Exists(p => p.IsDownloadSucceededHistory)) { var succeeded = new STypes::Playlist() { IsDownloadSucceededHistory = true, PlaylistName = "最近ダウンロードした動画", }; var result = this.databaseInstance.Store(succeeded, STypes::Playlist.TableName); if (!result.IsSucceeded) { if (result.Exception is not null) { this.logger.Error($"DL成功履歴の保存に失敗しました。({result.Message})", result.Exception); } else { this.logger.Error($"DL成功履歴の保存に失敗しました。({result.Message})"); } return(new AttemptResult() { Message = "DL成功履歴の保存に失敗しました。", Exception = result.Exception }); } this.logger.Log("DL成功履歴が存在しなかったので作成しました。"); } if (!this.Exists(p => p.IsDownloadFailedHistory)) { var failed = new STypes::Playlist() { IsDownloadFailedHistory = true, PlaylistName = "最近ダウンロードに失敗した動画", }; var result = this.databaseInstance.Store(failed, STypes::Playlist.TableName); if (!result.IsSucceeded) { if (result.Exception is not null) { this.logger.Error($"DL失敗履歴の保存に失敗しました。({result.Message})", result.Exception); } else { this.logger.Error($"DL失敗履歴の保存に失敗しました。({result.Message})"); } return(new AttemptResult() { Message = "DL失敗履歴の保存に失敗しました。", Exception = result.Exception }); } this.logger.Log("DL失敗履歴が存在しなかったので作成しました。"); } if (!this.Exists(p => p.IsTemporary)) { var failed = new STypes::Playlist() { IsTemporary = true, PlaylistName = "一時プレイリスト", }; var result = this.databaseInstance.Store(failed, STypes::Playlist.TableName); if (!result.IsSucceeded) { if (result.Exception is not null) { this.logger.Error($"一時プレイリストの保存に失敗しました。({result.Message})", result.Exception); } else { this.logger.Error($"一時プレイリストの保存に失敗しました。({result.Message})"); } return(new AttemptResult() { Message = "一時プレイリストの保存に失敗しました。", Exception = result.Exception }); } this.logger.Log("一時プレイリストが存在しなかったので作成しました。"); } IAttemptResult <List <STypes::Playlist> > pResult = this.GetAllPlaylists(); if (!pResult.IsSucceeded || pResult.Data is null) { return(AttemptResult.Fail("プレイリストの取得に失敗しました。")); } foreach (var playlist in pResult.Data) { this.FixPlaylist(playlist); } return(AttemptResult.Succeeded()); }