From c02c100ad8a4d5c976682c66f556f09104112c18 Mon Sep 17 00:00:00 2001 From: tobiichiamane Date: Tue, 12 May 2020 16:14:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=86=E8=8A=82=E4=BB=A5?= =?UTF-8?q?=E6=9B=B4=E8=B4=B4=E8=BF=91=E4=BB=A5=E5=89=8DTryGetString?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PixivFSUWP/Data/Collections/BookmarkIllustsCollection.cs | 2 +- PixivFSUWP/Data/Collections/CommentsCollection.cs | 2 +- PixivFSUWP/Data/Collections/FollowingIllustsCollection.cs | 2 +- PixivFSUWP/Data/Collections/RankingIllustsCollection.cs | 2 +- PixivFSUWP/Data/Collections/RecommendIllustsCollection.cs | 2 +- .../Data/Collections/SearchResultIllustsCollection.cs | 2 +- PixivFSUWP/Data/Collections/UserIllustsCollection.cs | 2 +- PixivFSUWP/Data/CurrentUser.cs | 6 +++--- PixivFSUWP/Data/IllustCommentItem.cs | 2 +- PixivFSUWP/Data/IllustDetail.cs | 4 ++-- PixivFSUWP/Data/UgoiraHelper.cs | 2 +- PixivFSUWP/Data/WaterfallItem.cs | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/PixivFSUWP/Data/Collections/BookmarkIllustsCollection.cs b/PixivFSUWP/Data/Collections/BookmarkIllustsCollection.cs index 42bbec5..41a60c2 100644 --- a/PixivFSUWP/Data/Collections/BookmarkIllustsCollection.cs +++ b/PixivFSUWP/Data/Collections/BookmarkIllustsCollection.cs @@ -92,7 +92,7 @@ protected async Task LoadMoreItemsAsync(CancellationToken c { return toret; } - nexturl = bookmarkres.NextUrl?.ToString(); + nexturl = bookmarkres.NextUrl?.ToString() ?? ""; foreach (var recillust in bookmarkres.Illusts) { await Task.Run(() => pause.WaitOne()); diff --git a/PixivFSUWP/Data/Collections/CommentsCollection.cs b/PixivFSUWP/Data/Collections/CommentsCollection.cs index 4f81319..68e2fc8 100644 --- a/PixivFSUWP/Data/Collections/CommentsCollection.cs +++ b/PixivFSUWP/Data/Collections/CommentsCollection.cs @@ -92,7 +92,7 @@ protected async Task LoadMoreItemsAsync(CancellationToken c { return toret; } - nexturl = commentres.NextUrl?.ToString(); + nexturl = commentres.NextUrl?.ToString() ?? ""; foreach (var recillust in commentres.Comments) { await Task.Run(() => pause.WaitOne()); diff --git a/PixivFSUWP/Data/Collections/FollowingIllustsCollection.cs b/PixivFSUWP/Data/Collections/FollowingIllustsCollection.cs index 5156a39..65482e6 100644 --- a/PixivFSUWP/Data/Collections/FollowingIllustsCollection.cs +++ b/PixivFSUWP/Data/Collections/FollowingIllustsCollection.cs @@ -83,7 +83,7 @@ protected async Task LoadMoreItemsAsync(CancellationToken c { return toret; } - nexturl = followingres.NextUrl?.ToString(); + nexturl = followingres.NextUrl?.ToString() ?? ""; foreach (var recillust in followingres.Illusts) { await Task.Run(() => pause.WaitOne()); diff --git a/PixivFSUWP/Data/Collections/RankingIllustsCollection.cs b/PixivFSUWP/Data/Collections/RankingIllustsCollection.cs index 981a3e2..846b88f 100644 --- a/PixivFSUWP/Data/Collections/RankingIllustsCollection.cs +++ b/PixivFSUWP/Data/Collections/RankingIllustsCollection.cs @@ -83,7 +83,7 @@ protected async Task LoadMoreItemsAsync(CancellationToken c { return toret; } - nexturl = rankingres.NextUrl?.ToString(); + nexturl = rankingres.NextUrl?.ToString() ?? ""; foreach (var recillust in rankingres.Illusts) { await Task.Run(() => pause.WaitOne()); diff --git a/PixivFSUWP/Data/Collections/RecommendIllustsCollection.cs b/PixivFSUWP/Data/Collections/RecommendIllustsCollection.cs index e5c45af..2115038 100644 --- a/PixivFSUWP/Data/Collections/RecommendIllustsCollection.cs +++ b/PixivFSUWP/Data/Collections/RecommendIllustsCollection.cs @@ -90,7 +90,7 @@ protected async Task LoadMoreItemsAsync(CancellationToken c { return toret; } - nexturl = recommendres.NextUrl?.ToString(); + nexturl = recommendres.NextUrl?.ToString() ?? ""; foreach (var recillust in recommendres.Illusts) { await Task.Run(() => pause.WaitOne()); diff --git a/PixivFSUWP/Data/Collections/SearchResultIllustsCollection.cs b/PixivFSUWP/Data/Collections/SearchResultIllustsCollection.cs index 4ab41fd..7272faf 100644 --- a/PixivFSUWP/Data/Collections/SearchResultIllustsCollection.cs +++ b/PixivFSUWP/Data/Collections/SearchResultIllustsCollection.cs @@ -98,7 +98,7 @@ protected async Task LoadMoreItemsAsync(CancellationToken c { return toret; } - nexturl = searchres.NextUrl?.ToString(); + nexturl = searchres.NextUrl?.ToString() ?? ""; foreach (var recillust in searchres.Illusts) { await Task.Run(() => pause.WaitOne()); diff --git a/PixivFSUWP/Data/Collections/UserIllustsCollection.cs b/PixivFSUWP/Data/Collections/UserIllustsCollection.cs index 8760f9f..af6cb0d 100644 --- a/PixivFSUWP/Data/Collections/UserIllustsCollection.cs +++ b/PixivFSUWP/Data/Collections/UserIllustsCollection.cs @@ -89,7 +89,7 @@ protected async Task LoadMoreItemsAsync(CancellationToken c { return toret; } - nexturl = illustsres.NextUrl?.ToString(); + nexturl = illustsres.NextUrl?.ToString() ?? ""; foreach (var recillust in illustsres.Illusts) { await Task.Run(() => pause.WaitOne()); diff --git a/PixivFSUWP/Data/CurrentUser.cs b/PixivFSUWP/Data/CurrentUser.cs index 7f88330..6c4fdcd 100644 --- a/PixivFSUWP/Data/CurrentUser.cs +++ b/PixivFSUWP/Data/CurrentUser.cs @@ -29,9 +29,9 @@ public static CurrentUser FromObject(PixivCS.Objects.ResponseUser Source) toret.Email = Source.MailAddress; toret.IsMailAuthorized = Source.IsMailAuthorized; toret.IsPremium = Source.IsPremium; - toret.Avatar16 = Source.ProfileImageUrls.Px16X16?.ToString(); - toret.Avatar50 = Source.ProfileImageUrls.Px50X50?.ToString(); - toret.Avatar170 = Source.ProfileImageUrls.Px170X170?.ToString(); + toret.Avatar16 = Source.ProfileImageUrls.Px16X16?.ToString() ?? ""; + toret.Avatar50 = Source.ProfileImageUrls.Px50X50?.ToString() ?? ""; + toret.Avatar170 = Source.ProfileImageUrls.Px170X170?.ToString() ?? ""; return toret; } } diff --git a/PixivFSUWP/Data/IllustCommentItem.cs b/PixivFSUWP/Data/IllustCommentItem.cs index 1fc5dce..5356f8b 100644 --- a/PixivFSUWP/Data/IllustCommentItem.cs +++ b/PixivFSUWP/Data/IllustCommentItem.cs @@ -25,7 +25,7 @@ public static IllustCommentItem FromObject(PixivCS.Objects.Comment Source) toret.DateTime = Source.Date; toret.UserName = Source.User.Name; toret.UserAccount = Source.User.Account; - toret.AvatarUrl = Source.User.ProfileImageUrls.Medium?.ToString(); + toret.AvatarUrl = Source.User.ProfileImageUrls.Medium?.ToString() ?? ""; if (Source.ParentComment.CommentComment != null) { //有父级评论 diff --git a/PixivFSUWP/Data/IllustDetail.cs b/PixivFSUWP/Data/IllustDetail.cs index c73918a..17b74e5 100644 --- a/PixivFSUWP/Data/IllustDetail.cs +++ b/PixivFSUWP/Data/IllustDetail.cs @@ -41,7 +41,7 @@ public static IllustDetail FromObject(PixivCS.Objects.IllustDetail Source) toret.AuthorID = (int)Source.Illust.User.Id; toret.Author = Source.Illust.User.Name; toret.AuthorAccount = Source.Illust.User.Account; - toret.AuthorAvatarUrl = Source.Illust.User.ProfileImageUrls.Medium?.ToString(); + toret.AuthorAvatarUrl = Source.Illust.User.ProfileImageUrls.Medium?.ToString() ?? ""; toret.IsUserFollowed = Source.Illust.User.IsFollowed.HasValue ? Source.Illust.User.IsFollowed.Value : false; var tags = Source.Illust.Tags; toret.Tags = new List(); @@ -52,7 +52,7 @@ public static IllustDetail FromObject(PixivCS.Objects.IllustDetail Source) foreach (var tool in tools) toret.Tools.Add(tool); toret.CreateDate = Source.Illust.CreateDate; - toret.MediumUrl = Source.Illust.ImageUrls.SquareMedium?.ToString(); + toret.MediumUrl = Source.Illust.ImageUrls.SquareMedium?.ToString() ?? ""; var pgCount = (int)Source.Illust.PageCount; toret.OriginalUrls = new List(); if (pgCount == 1) toret.OriginalUrls.Add(Source.Illust.MetaSinglePage.OriginalImageUrl?.ToString()); diff --git a/PixivFSUWP/Data/UgoiraHelper.cs b/PixivFSUWP/Data/UgoiraHelper.cs index 724a7f2..b61365f 100644 --- a/PixivFSUWP/Data/UgoiraHelper.cs +++ b/PixivFSUWP/Data/UgoiraHelper.cs @@ -29,7 +29,7 @@ public static async Task GetUgoiraAsync(string IllustID) framefiles.Add(file); framedelays.Add(file, (int)i.Delay); } - var zipurl = res.UgoiraMetadataUgoiraMetadata.ZipUrls.Medium?.ToString(); + var zipurl = res.UgoiraMetadataUgoiraMetadata.ZipUrls.Medium?.ToString() ?? ""; using (var zipfile = await OverAll.DownloadImage(zipurl)) { using (ZipArchive ziparc = new ZipArchive(zipfile, ZipArchiveMode.Read)) diff --git a/PixivFSUWP/Data/WaterfallItem.cs b/PixivFSUWP/Data/WaterfallItem.cs index 229cfad..be76a39 100644 --- a/PixivFSUWP/Data/WaterfallItem.cs +++ b/PixivFSUWP/Data/WaterfallItem.cs @@ -25,7 +25,7 @@ public static WaterfallItem FromObject(PixivCS.Objects.UserPreviewIllust Source) toret.Id = (int)Source.Id; toret.Title = Source.Title; toret.Author = Source.User.Name; - toret.ImageUri = Source.ImageUrls.Medium?.ToString(); + toret.ImageUri = Source.ImageUrls.Medium?.ToString() ?? ""; toret.Stars = (int)Source.TotalBookmarks; toret.Pages = (int)Source.PageCount; toret.IsBookmarked = Source.IsBookmarked;