public static int Get_Rigth() { container = ApplicationData.Current.LocalSettings; if (container.Values["Rigth"] != null) { return((int)container.Values["Rigth"]); } else { if (SettingHelper.IsPc()) { return(1); } else { return(0); } } }
public static double Get_DMSize() { container = ApplicationData.Current.LocalSettings; if (container.Values["DMSize"] != null) { return((double)container.Values["DMSize"]); } else { if (!SettingHelper.IsPc()) { container.Values["DMSize"] = 16; return(16); } else { container.Values["DMSize"] = 22; return(22); } } }
/// <summary> ///统一处理Url /// </summary> /// <param name="par"></param> public async static Task <bool> HandelUrl(string url) { /* * 视频 * https://www.bilibili.com/video/av3905642 * https://m.bilibili.com/video/av3905642.html * https://www.bilibili.com/playlist/video/pl688?aid=19827477 * bilibili://video/19239064 * bilibili://?av=4284663 */ var video = Utils.RegexMatch(url.Replace("aid", "av").Replace("/", "").Replace("=", ""), @"av(\d+)"); if (video != "") { InfoNavigateToEvent(typeof(VideoViewPage), video); return(true); } video = Utils.RegexMatch(url, @"bilibili://video/(\d+)"); if (video != "") { InfoNavigateToEvent(typeof(VideoViewPage), video); return(true); } /* * 番剧/影视 * https://bangumi.bilibili.com/anime/21680 * https://www.bilibili.com/bangumi/play/ss21715 * https://www.bilibili.com/bangumi/play/ep150706 * https://m.bilibili.com/bangumi/play/ep150706 * http://m.bilibili.com/bangumi/play/ss21715 * bilibili://bangumi/season/21715 * https://bangumi.bilibili.com/movie/12364 */ var bangumi = Utils.RegexMatch(url.Replace("movie", "ss").Replace("anime", "ss").Replace("season", "ss").Replace("/", ""), @"ss(\d+)"); if (bangumi != "") { InfoNavigateToEvent(typeof(BanInfoPage), bangumi); return(true); } bangumi = Utils.RegexMatch(url, @"ep(\d+)"); if (bangumi != "") { InfoNavigateToEvent(typeof(BanInfoPage), await Utils.BangumiEpidToSid(bangumi)); return(true); } /* * 点评 * https://www.bilibili.com/bangumi/media/md11592/ * https://bangumi.bilibili.com/review/media/11592 * bilibili://pgc/review/11592 */ var review = Utils.RegexMatch(url.Replace("media", "md").Replace("review", "md").Replace("/", ""), @"md(\d+)"); if (review != "") { //InfoNavigateToEvent(typeof(BanInfoPage), review); await new Windows.UI.Popups.MessageDialog("请求打开点评" + review).ShowAsync(); return(true); } /* * 直播 * http://live.bilibili.com/live/5619438.html * http://live.bilibili.com/h5/5619438 * http://live.bilibili.com/5619438 * bilibili://live/5619438 */ var live = Utils.RegexMatch(url.Replace("h5", "live").Replace("live.bilibili.com", "live").Replace("/", ""), @"live(\d+)"); if (live != "") { if (!SettingHelper.IsPc()) { PlayNavigateToEvent(typeof(LiveRoomPage), live); } else { PlayNavigateToEvent(typeof(LiveRoomPC), live); } return(true); } /* * 小视频 * http://vc.bilibili.com/mobile/detail?vc=1399466&bilifrom=1 * http://vc.bilibili.com/video/1357956 * bilibili://clip/1399466 */ var clip = Utils.RegexMatch(url.Replace("vc=", "clip").Replace("vc.bilibili.com/video", "clip").Replace("/", ""), @"clip(\d+)"); if (clip != "") { MiniVideoDialog miniVideoDialog = new MiniVideoDialog(); miniVideoDialog.ShowAsync(clip); return(true); } /* * 专栏 * http://www.bilibili.com/read/cv242568 * https://www.bilibili.com/read/mobile/242568 * bilibili://article/242568 */ var article = Utils.RegexMatch(url.Replace("read/mobile/", "article").Replace("read/cv", "article").Replace("/", ""), @"article(\d+)"); if (article != "") { InfoNavigateToEvent(typeof(ArticleContentPage), "https://www.bilibili.com/read/app/" + article); return(true); } /* * 音频 * https://m.bilibili.com/audio/au247991 * bilibili://music/detail/247991 */ var music = Utils.RegexMatch(url.Replace("music/detail/", "au").Replace("/", ""), @"au(\d+)"); if (music != "") { InfoNavigateToEvent(typeof(MusicInfoPage), music); return(true); } /* * 歌单 * https://m.bilibili.com/audio/am78723 * bilibili://music/menu/detail/78723 */ var musicmenu = Utils.RegexMatch(url.Replace("menu/detail/", "am").Replace("/", ""), @"am(\d+)"); if (musicmenu != "") { InfoNavigateToEvent(typeof(MusicMenuPage), musicmenu); return(true); } /* * 相簿及动态 * http://h.bilibili.com/ywh/h5/2403422 * http://h.bilibili.com/2403422 * bilibili://album/2403422 * https://t.bilibili.com/84935538081511530 */ var album = Utils.RegexMatch(url.Replace("h.bilibili.com/ywh/h5/", "album").Replace("h.bilibili.com", "album").Replace("t.bilibili.com", "album").Replace("/", ""), @"album(\d+)"); if (album != "") { InfoNavigateToEvent(typeof(DynamicInfoPage), album); return(true); } /* * 用户中心 * http://space.bilibili.com/7251681 * https://m.bilibili.com/space/7251681 * https://space.bilibili.com/1360010 * bilibili://author/2622476 */ var user = Utils.RegexMatch(url.Replace("space.bilibili.com", "space").Replace("author", "space").Replace("/", ""), @"space(\d+)"); if (user != "") { InfoNavigateToEvent(typeof(UserInfoPage), user); return(true); } /* * 话题/频道 * https://www.bilibili.com/tag/7868838/feed * bilibili://tag/0/?name=bilibili%e5%a5%bd%e4%b9%a1%e9%9f%b3 */ var topic = Utils.RegexMatch(url, @"tag/(.*?)/feed"); if (topic != "") { InfoNavigateToEvent(typeof(DynamicTopicPage), new object[] { "", topic }); return(true); } var topic1 = Utils.RegexMatch(url + "/", @"tag/.*?/\?name=(.*?)/"); if (topic1 != "") { var data = Uri.UnescapeDataString(topic1); InfoNavigateToEvent(typeof(DynamicTopicPage), new object[] { data, "" }); return(true); } /* * 播单 * https://www.bilibili.com/playlist/detail/pl792 */ /* * 投稿 * bilibili://uper/user_center/add_archive/ */ var add_archive = url.Contains("/add_archive"); if (add_archive) { //InfoNavigateToEvent(typeof(DynamicTopicPage), new object[] { "", topic }); InfoNavigateToEvent(typeof(WebPage), new object[] { "https://member.bilibili.com/v2#/upload/video/frame" }); return(true); } return(false); }
private async Task GetResults() { try { string url = "http://app.bilibili.com/x/splash?plat=0&build=414000&channel=master&width=1080&height=1920"; bool pc = SettingHelper.IsPc(); if (pc) { img.Stretch = Stretch.Uniform; url = "http://app.bilibili.com/x/splash?plat=0&build=414000&channel=master&width=1920&height=1080"; } string Result = await WebClientClass.GetResults(new Uri(url)); LoadModel obj = JsonConvert.DeserializeObject <LoadModel>(Result); if (obj.code == 0) { if (obj.data.Count != 0) { var buff = await WebClientClass.GetBuffer(new Uri(obj.data[0].image)); BitmapImage bit = new BitmapImage(); await bit.SetSourceAsync(buff.AsStream().AsRandomAccessStream()); if (!pc) { if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { var applicationView = ApplicationView.GetForCurrentView(); applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow); // StatusBar.GetForCurrentView().HideAsync(); StatusBar statusBar = StatusBar.GetForCurrentView(); statusBar.ForegroundColor = Colors.Gray; statusBar.BackgroundColor = Color.FromArgb(255, 55, 63, 76); statusBar.BackgroundOpacity = 0; } } else { img_bg.Source = bit; InitializedFrostedGlass(GlassHost); } img.Source = bit; _url = obj.data[0].param; maxnum = 5; //await Task.Delay(3000); //this.Frame.Navigate(typeof(MainPage), m); } else { // await Task.Delay(2000); } } else { // await Task.Delay(2000); //this.Frame.Navigate(typeof(MainPage), m); } } catch (Exception) { // await Task.Delay(2000); //this.Frame.Navigate(typeof(MainPage), m); } finally { } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { if (SettingHelper.IsPc()) { sp_View.DisplayMode = SplitViewDisplayMode.CompactOverlay; } else { sp_View.DisplayMode = SplitViewDisplayMode.Overlay; } ChangeTheme(); timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 5); timer.Start(); timer.Tick += Timer_Tick; MessageCenter.ChanageThemeEvent += MessageCenter_ChanageThemeEvent; MessageCenter.MianNavigateToEvent += MessageCenter_MianNavigateToEvent; MessageCenter.InfoNavigateToEvent += MessageCenter_InfoNavigateToEvent; MessageCenter.PlayNavigateToEvent += MessageCenter_PlayNavigateToEvent; MessageCenter.HomeNavigateToEvent += MessageCenter_HomeNavigateToEvent; MessageCenter.BgNavigateToEvent += MessageCenter_BgNavigateToEvent;; MessageCenter.Logined += MessageCenter_Logined; MessageCenter.ShowOrHideBarEvent += MessageCenter_ShowOrHideBarEvent; MessageCenter.ChangeBg += MessageCenter_ChangeBg; //main_frame.Navigate(typeof(HomePage)); MessageCenter_ChangeBg(); main_frame.Visibility = Visibility.Visible; menu_List.SelectedIndex = 0; Can_Nav = false; bottom.SelectedIndex = 0; Can_Nav = true; frame.Visibility = Visibility.Visible; frame.Navigate(typeof(BlankPage)); play_frame.Visibility = Visibility.Visible; play_frame.Navigate(typeof(BlankPage)); if (UserManage.IsLogin()) { MessageCenter_Logined(); } else { if (SettingHelper.Get_Password().Length != 0) { string info = await ApiHelper.LoginBilibili(SettingHelper.Get_UserName(), SettingHelper.Get_Password()); if (info != "登录成功") { messShow.Show("过期自动登录失败", 2000); } else { MessageCenter_Logined(); } } } LoadPlayApiInfo(); if (e.Parameter != null) { var m = e.Parameter as StartModel; switch (m.StartType) { case StartTypes.None: break; case StartTypes.Video: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(VideoViewPage), m.Par1); break; case StartTypes.Live: MessageCenter.SendNavigateTo(NavigateMode.Play, typeof(LiveRoomPage), m.Par1); break; case StartTypes.Bangumi: break; case StartTypes.MiniVideo: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(WebPage), "http://vc.bilibili.com/mobile/detail?vc=" + m.Par1); break; case StartTypes.Web: MessageCenter.SendNavigateTo(NavigateMode.Info, typeof(WebPage), m.Par1); break; case StartTypes.File: var files = m.Par3 as IReadOnlyList <IStorageItem>; List <PlayerModel> ls = new List <PlayerModel>(); int i = 1; foreach (StorageFile file in files) { ls.Add(new PlayerModel() { Mode = PlayMode.FormLocal, No = i.ToString(), VideoTitle = "", Title = file.DisplayName, Parameter = file, Aid = file.DisplayName, Mid = file.Path }); i++; } MessageCenter.SendNavigateTo(NavigateMode.Play, typeof(PlayerPage), new object[] { ls, 0 }); break; default: break; } } if (SettingHelper.Get_First()) { TextBlock tx = new TextBlock() { Text = @"你好,欢迎使用哔哩哔哩动画第三方UWP,使用此版本前你需要了解以下几点: 1、有些小功能尚未实现,请谅解 2、可能存在些BUG,发现请反馈至[email protected] 3、欢迎加入QQ群一起交流:499690038、530991215 4、哪里做得不好,请轻喷 如果你觉得好用,欢迎给我打赏瓶营养快线: 支付婊:[email protected],**程", IsTextSelectionEnabled = true, TextWrapping = TextWrapping.Wrap }; await new ContentDialog() { Content = tx, PrimaryButtonText = "知道了" }.ShowAsync(); SettingHelper.Set_First(false); } }