From 582e626f96bb1b5e02e845c6c9a635f51af4ae8e Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Sat, 4 Nov 2023 15:27:25 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controls/CommentControl.xaml.cs | 6 ++++++ src/BiliLite.UWP/MainPage.xaml.cs | 3 +-- .../Pages/VideoDetailPage.xaml.cs | 20 +++++++++++-------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/BiliLite.UWP/Controls/CommentControl.xaml.cs b/src/BiliLite.UWP/Controls/CommentControl.xaml.cs index caa145e0..881e5fae 100644 --- a/src/BiliLite.UWP/Controls/CommentControl.xaml.cs +++ b/src/BiliLite.UWP/Controls/CommentControl.xaml.cs @@ -54,6 +54,7 @@ public CommentControl() this.InitializeComponent(); m_commentApi = new CommentApi(); emoteVM = new EmoteVM(); + Unloaded += CommentControl_Unloaded; } #endregion @@ -66,6 +67,11 @@ public CommentControl() #region Private Methods + private void CommentControl_Unloaded(object sender, RoutedEventArgs e) + { + Bindings.StopTracking(); + } + private void BtnUser_Click(object sender, RoutedEventArgs e) { MessageCenter.NavigateToPage(this, new NavigationInfo() diff --git a/src/BiliLite.UWP/MainPage.xaml.cs b/src/BiliLite.UWP/MainPage.xaml.cs index e3cfd012..23360672 100644 --- a/src/BiliLite.UWP/MainPage.xaml.cs +++ b/src/BiliLite.UWP/MainPage.xaml.cs @@ -198,7 +198,6 @@ private void TabView_AddTabButtonClick(Microsoft.UI.Xaml.Controls.TabView sender page = typeof(NewPage), title = "新建页面" }); - } private void TabView_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args) @@ -215,7 +214,7 @@ private void ClosePage(TabViewItem tabItem) // frame.BackStack.Clear(); tabItem.Content = null; tabView.TabItems.Remove(tabItem); - //GC.Collect(); + GC.Collect(); } private void tabView_Loaded(object sender, RoutedEventArgs e) { diff --git a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs index 9c0fe2bd..047ded6f 100644 --- a/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs +++ b/src/BiliLite.UWP/Pages/VideoDetailPage.xaml.cs @@ -62,17 +62,19 @@ public VideoDetailPage() dataTransferManager.DataRequested += DataTransferManager_DataRequested; m_viewModel.DefaultRightInfoWidth = new GridLength(SettingService.GetValue(SettingConstants.UI.RIGHT_DETAIL_WIDTH, 320), GridUnitType.Pixel); this.RightInfoGridSplitter.IsEnabled = SettingService.GetValue(SettingConstants.UI.RIGHT_WIDTH_CHANGEABLE, false); + Unloaded += VideoDetailPage_Unloaded; } - private void VideoDetailPage_Loaded(object sender, RoutedEventArgs e) + private void VideoDetailPage_Unloaded(object sender, RoutedEventArgs e) { + Bindings.StopTracking(); + } - if (this.Parent is MyFrame) - { - (this.Parent as MyFrame).ClosedPage -= VideoDetailPage_ClosedPage; - (this.Parent as MyFrame).ClosedPage += VideoDetailPage_ClosedPage; - } - + private void VideoDetailPage_Loaded(object sender, RoutedEventArgs e) + { + if (!(this.Parent is MyFrame frame)) return; + frame.ClosedPage -= VideoDetailPage_ClosedPage; + frame.ClosedPage += VideoDetailPage_ClosedPage; } private void VideoDetailPage_ClosedPage(object sender, EventArgs e) @@ -91,6 +93,8 @@ private void ClosePage() player?.FullScreen(false); player?.MiniWidnows(false); player?.Dispose(); + if (!(this.Parent is MyFrame frame)) return; + frame.ClosedPage -= VideoDetailPage_ClosedPage; } private void DataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args) { @@ -191,7 +195,7 @@ private async Task InitializeVideo(string id) } } InitPlayInfo(); - + comment.LoadComment(new LoadCommentInfo() { CommentMode = (int)CommentApi.CommentType.Video, From 10f5dc6c91c2c987a51519a91892f3f004cea904 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Sat, 4 Nov 2023 15:33:50 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4=E6=A0=87=E9=A2=98=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs b/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs index 6234746c..45af7dc8 100644 --- a/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs +++ b/src/BiliLite.UWP/ViewModels/Live/LiveRoomViewModel.cs @@ -103,7 +103,6 @@ public LiveRoomViewModel() /// /// 房间标题 /// - [DoNotNotify] public string RoomTitle { get; set; } [DoNotNotify] From f909a2b84772add16df3381e27c995394ae565c9 Mon Sep 17 00:00:00 2001 From: GD-Slime <82302542+GD-Slime@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:19:17 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=9B=B4=E6=8D=A2ghproxy=E7=9A=84=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=20(#393)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Pages/SettingPage.xaml.cs | 2 +- src/BiliLite.UWP/Services/ApiHelper.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BiliLite.UWP/Pages/SettingPage.xaml.cs b/src/BiliLite.UWP/Pages/SettingPage.xaml.cs index d957f694..36a25bd6 100644 --- a/src/BiliLite.UWP/Pages/SettingPage.xaml.cs +++ b/src/BiliLite.UWP/Pages/SettingPage.xaml.cs @@ -1002,7 +1002,7 @@ private void mirrorComboboxSelectAction(object selectedValue) case ApiHelper.GHPROXY_GIT_RAW_URL: { mirrorDonateText.Visibility = Visibility.Visible; - mirrorDonateUrl.NavigateUri = new Uri("https://ghproxy.com/donate"); + mirrorDonateUrl.NavigateUri = new Uri("https://gh-proxy.com"); break; } case ApiHelper.KGITHUB_GIT_RAW_URL: diff --git a/src/BiliLite.UWP/Services/ApiHelper.cs b/src/BiliLite.UWP/Services/ApiHelper.cs index b2d7aad4..b81e2f5e 100644 --- a/src/BiliLite.UWP/Services/ApiHelper.cs +++ b/src/BiliLite.UWP/Services/ApiHelper.cs @@ -21,7 +21,7 @@ public static class ApiHelper public const string GIT_RAW_URL = "https://raw.githubusercontent.com/ywmoyue/biliuwp-lite/master"; // 镜像 GIT RAW路径 - public const string GHPROXY_GIT_RAW_URL = "https://ghproxy.com/https://raw.githubusercontent.com/ywmoyue/biliuwp-lite/master"; + public const string GHPROXY_GIT_RAW_URL = "https://gh-proxy.com/https://raw.githubusercontent.com/ywmoyue/biliuwp-lite/master"; public const string KGITHUB_GIT_RAW_URL = "https://raw.kkgithub.com/ywmoyue/biliuwp-lite/master"; // 哔哩哔哩API From cd1a05a0d7cc8fe561f26fbcd557b2228b06e020 Mon Sep 17 00:00:00 2001 From: GD-Slime <82302542+GD-Slime@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:29:29 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E6=9F=90?= =?UTF-8?q?=E4=BA=9B=E8=A7=86=E9=A2=91=E5=8A=A0=E8=BD=BD=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=BA=94=E7=94=A8=E5=B4=A9=E6=BA=83=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#396)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Extensions/StringExtensions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/BiliLite.UWP/Extensions/StringExtensions.cs b/src/BiliLite.UWP/Extensions/StringExtensions.cs index 9947c570..0b3e252e 100644 --- a/src/BiliLite.UWP/Extensions/StringExtensions.cs +++ b/src/BiliLite.UWP/Extensions/StringExtensions.cs @@ -93,6 +93,9 @@ public static RichTextBlock ToRichTextBlock(this string txt, JObject emote) input = input.Replace(">", ">"); input = input.Replace("\r\n", ""); input = input.Replace("\n", ""); + //处理其他控制字符 + input = Regex.Replace(input, @"\p{C}+", string.Empty); + //处理链接 input = HandelUrl(input); From 704f7511bbb566d00fdd18021cd0b53aa769578a Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Thu, 9 Nov 2023 20:39:41 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=97=B6=E9=A6=96=E9=A1=B5=E7=83=AD=E9=97=A8?= =?UTF-8?q?=E9=A1=B5=E6=95=B0=E6=8D=AE=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Modules/Home/HotVM.cs | 79 ++++++++++++++++----- src/BiliLite.UWP/Pages/Home/HotPage.xaml | 18 ++--- src/BiliLite.UWP/Pages/Home/HotPage.xaml.cs | 14 ++-- 3 files changed, 77 insertions(+), 34 deletions(-) diff --git a/src/BiliLite.UWP/Modules/Home/HotVM.cs b/src/BiliLite.UWP/Modules/Home/HotVM.cs index 1b508c33..d0d8a095 100644 --- a/src/BiliLite.UWP/Modules/Home/HotVM.cs +++ b/src/BiliLite.UWP/Modules/Home/HotVM.cs @@ -64,7 +64,7 @@ public async Task GetPopular(string idx = "0", string last_param = "") var items = JsonConvert.DeserializeObject>(data["data"].ToString()); for (int i = items.Count - 1; i >= 0; i--) { - if (items[i].card_goto != "av") + if (items[i].CardGoto != "av") items.Remove(items[i]); } if (HotItems == null) @@ -122,29 +122,72 @@ public async void LoadMore() return; } var last = HotItems.LastOrDefault(); - await GetPopular(last.idx, last.param); + await GetPopular(last.Idx, last.Param); } } public class HotTopItemModel { - public int entrance_id { get; set; } - public string icon { get; set; } - public string module_id { get; set; } - public string uri { get; set; } - public string title { get; set; } + [JsonProperty("entrance_id")] + public int EntranceId { get; set; } + + public string Icon { get; set; } + + [JsonProperty("module_id")] + public string ModuleId { get; set; } + + public string Uri { get; set; } + + public string Title { get; set; } } + public class HotDataItemModel { - public string card_type { get; set; } - public string card_goto { get; set; } - public string param { get; set; } - public string cover { get; set; } - public string title { get; set; } - public string idx { get; set; } - public string uri { get; set; } - public string cover_right_text_1 { get; set; } - public string right_desc_1 { get; set; } - public string right_desc_2 { get; set; } - public RecommendRcmdReasonStyleModel rcmd_reason_style { get; set; } + [JsonProperty("card_type")] + public string CardType { get; set; } + + [JsonProperty("card_goto")] + public string CardGoto { get; set; } + + public string Param { get; set; } + + public string Cover { get; set; } + + public string Title { get; set; } + + public string Idx { get; set; } + + public string Uri { get; set; } + + [JsonProperty("cover_right_text_1")] + public string CoverRightText1 { get; set; } + + [JsonProperty("right_desc_1")] + public string RightDesc1 { get; set; } + + [JsonProperty("right_desc_2")] + public string RightDesc2 { get; set; } + + [JsonProperty("cover_left_text_1")] + public string CoverLeftText1 { get; set; } + + [JsonProperty("cover_left_text_2")] + public string CoverLeftText2 { get; set; } + + [JsonProperty("cover_left_text_3")] + public string CoverLeftText3 { get; set; } + + public string TextInfo1 => string.IsNullOrEmpty(CoverRightText1) ? CoverLeftText1 : CoverRightText1; + + public string TextInfo2 => string.IsNullOrEmpty(RightDesc1) ? CoverLeftText2 : RightDesc1; + + public string TextInfo3 => string.IsNullOrEmpty(RightDesc2) ? CoverLeftText3 : RightDesc2; + + [JsonProperty("rcmd_reason_style")] + public RecommendRcmdReasonStyleModel RcmdReasonStyle { get; set; } + + [JsonProperty("top_rcmd_reason_style")] + public RecommendRcmdReasonStyleModel TopRcmdReasonStyle { get; set; } + + public RecommendRcmdReasonStyleModel RcmdReason => RcmdReasonStyle ?? TopRcmdReasonStyle; } } diff --git a/src/BiliLite.UWP/Pages/Home/HotPage.xaml b/src/BiliLite.UWP/Pages/Home/HotPage.xaml index c4b6f59a..0b081c00 100644 --- a/src/BiliLite.UWP/Pages/Home/HotPage.xaml +++ b/src/BiliLite.UWP/Pages/Home/HotPage.xaml @@ -49,19 +49,19 @@ - + - + - - - + + + - - + + @@ -72,8 +72,8 @@ - - + + diff --git a/src/BiliLite.UWP/Pages/Home/HotPage.xaml.cs b/src/BiliLite.UWP/Pages/Home/HotPage.xaml.cs index 763d6b62..d8c16b57 100644 --- a/src/BiliLite.UWP/Pages/Home/HotPage.xaml.cs +++ b/src/BiliLite.UWP/Pages/Home/HotPage.xaml.cs @@ -52,20 +52,20 @@ private async void gridHot_ItemClick(object sender, ItemClickEventArgs e) private async Task HotDataItemModelOpen(object sender, HotDataItemModel item, bool dontGoTo = false) { if (item == null) return; - if (item.card_goto == "av") + if (item.CardGoto == "av") { MessageCenter.NavigateToPage(this, new NavigationInfo() { icon = Symbol.Play, page = typeof(VideoDetailPage), - title = item.title, - parameters = item.param, + title = item.Title, + parameters = item.Param, dontGoTo = dontGoTo }); } else { - await MessageCenter.HandelUrl(item.uri, dontGoTo); + await MessageCenter.HandelUrl(item.Uri, dontGoTo); } } @@ -80,7 +80,7 @@ private async void gridHot_ItemPressed(object sender, PointerRoutedEventArgs e) private async void gridTop_ItemClick(object sender, ItemClickEventArgs e) { var data = (e.ClickedItem as Modules.HotTopItemModel); - if (data.module_id == "rank") + if (data.ModuleId == "rank") { MessageCenter.NavigateToPage(this, new NavigationInfo() { @@ -91,14 +91,14 @@ private async void gridTop_ItemClick(object sender, ItemClickEventArgs e) } else { - await MessageCenter.HandelUrl(data.uri); + await MessageCenter.HandelUrl(data.Uri); } } private void AddToWatchLater_Click(object sender, RoutedEventArgs e) { var data = (sender as MenuFlyoutItem).DataContext as HotDataItemModel; - WatchLaterVM.Instance.AddToWatchlater(data.param); + WatchLaterVM.Instance.AddToWatchlater(data.Param); } } } From 240f0b329af9f08f08521a8a53494246235549b9 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Thu, 9 Nov 2023 21:31:16 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E4=B8=AD=E5=87=BA=E7=8E=B0=E9=87=8D=E5=A4=8Dav=E5=8F=B7?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=AF=8C=E6=96=87=E6=9C=AC=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=BA=94=E7=94=A8=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/StringExtensions.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/BiliLite.UWP/Extensions/StringExtensions.cs b/src/BiliLite.UWP/Extensions/StringExtensions.cs index 0b3e252e..d811c259 100644 --- a/src/BiliLite.UWP/Extensions/StringExtensions.cs +++ b/src/BiliLite.UWP/Extensions/StringExtensions.cs @@ -86,7 +86,6 @@ public static RichTextBlock ToRichTextBlock(this string txt, JObject emote) { if (txt != null) { - //处理特殊字符 input = input.Replace("&", "&"); input = input.Replace("<", "<"); @@ -358,7 +357,8 @@ private static string HandelVideoID(string input) if (!Regex.IsMatch(input, @"/[aAbBcC][vV]([a-zA-Z0-9]+)")) { //处理AV号 - MatchCollection av = Regex.Matches(input, @"[aA][vV](\d+)"); + MatchCollection av = Regex.Matches(input, @"[aA][vV](\d+)"); + var offset = 0; foreach (Match item in av) { if (keyword.Contains(item.Groups[0].Value)) @@ -372,11 +372,14 @@ private static string HandelVideoID(string input) string.Format( @" CommandParameter=""{1}"" >{0}", item.Groups[0].Value, "bilibili://video/" + item.Groups[0].Value); - input = input.Replace(item.Groups[0].Value, data); + input = input.Remove(item.Index + offset, item.Length); + input = input.Insert(item.Index + offset, data); + offset += data.Length - item.Length; } //处理AV号 MatchCollection bv = Regex.Matches(input, @"[bB][vV]([a-zA-Z0-9]{8,})"); + offset = 0; foreach (Match item in bv) { if (keyword.Contains(item.Groups[0].Value)) @@ -390,12 +393,15 @@ private static string HandelVideoID(string input) string.Format( @" CommandParameter=""{1}"" >{0}", item.Groups[0].Value, "bilibili://video/" + item.Groups[0].Value); - input = input.Replace(item.Groups[0].Value, data); + input = input.Remove(item.Index + offset, item.Length); + input = input.Insert(item.Index + offset, data); + offset += data.Length - item.Length; } //处理CV号 MatchCollection cv = Regex.Matches(input, @"[cC][vV](\d+)"); + offset = 0; foreach (Match item in cv) { if (keyword.Contains(item.Groups[0].Value)) @@ -409,7 +415,9 @@ private static string HandelVideoID(string input) string.Format( @" CommandParameter=""{1}"" >{0}", item.Groups[0].Value, "bilibili://article/" + item.Groups[1].Value); - input = input.Replace(item.Groups[0].Value, data); + input = input.Remove(item.Index + offset, item.Length); + input = input.Insert(item.Index + offset, data); + offset += data.Length - item.Length; } }