public ForumsNewTopicNavigationArgs(ForumBoards boardType) { Page = ForumsPageIndex.PageNewTopic; ForumType = ForumType.Normal; BoardType = boardType; Id = (int)boardType; }
public ForumsBoardNavigationArgs(ForumBoards board, int page = 0) { TargetBoard = board; Page = ForumsPageIndex.PageBoard; WorkMode = ForumBoardPageWorkModes.Standard; PageNumber = page; }
public ForumsBoardNavigationArgs(string query,ForumBoards? scope) { Query = query; Scope = scope; WorkMode = ForumBoardPageWorkModes.Search; Page = ForumsPageIndex.PageBoard; }
public ForumsBoardNavigationArgs(ForumBoards board,int page = 0) { TargetBoard = board; Page = ForumsPageIndex.PageBoard; WorkMode = ForumBoardPageWorkModes.Standard; PageNumber = page; }
private static string GetEndpoint(ForumBoards board) { if (board == ForumBoards.AnimeSeriesDisc || board == ForumBoards.MangaSeriesDisc) { return($"?subboard={(int) board - 100}"); //100 is offset to differentiate from other boards } return($"?board={(int) board}"); }
public void AddFavouriteBoard(ForumBoards board) { if (!PinnedBoards.Contains(board)) { PinnedBoards.Add(board); Settings.ForumsPinnedBoards = string.Join(",", PinnedBoards.Cast <int>()); } }
public ForumBoardEntryViewModel(string name, string description, FontAwesomeIcon icon, ForumBoards board) { Entry = new ForumBoardEntry { Name = name, Description = description }; Icon = icon; Board = board; }
/// <summary> /// /// </summary> /// <param name="board"></param> /// <param name="page">From 0</param> public ForumBoardTopicsQuery(ForumBoards board,int page) { Request = WebRequest.Create(Uri.EscapeUriString($"https://myanimelist.net/forum/{GetEndpoint(board)}&show={page*50}")); Request.ContentType = "application/x-www-form-urlencoded"; Request.Method = "GET"; _board = board; _page = page; }
/// <summary> /// /// </summary> /// <param name="board"></param> /// <param name="page">From 0</param> public ForumBoardTopicsQuery(ForumBoards board, int page) { Request = WebRequest.Create(Uri.EscapeUriString($"https://myanimelist.net/forum/{GetEndpoint(board)}&show={page*50}")); Request.ContentType = "application/x-www-form-urlencoded"; Request.Method = "GET"; _board = board; _page = page; }
private void GotoFavouriteBoard(ForumBoards board) { if (CurrentBackNavRegistrar == null) { ViewModelLocator.NavMgr.ResetMainBackNav(); ViewModelLocator.NavMgr.RegisterBackNav(PageIndex.PageForumIndex, new ForumsNavigationArgs()); } else { CurrentBackNavRegistrar.RegisterSelfBackNav(); } ViewModelLocator.GeneralMain.Navigate(PageIndex.PageForumIndex, new ForumsBoardNavigationArgs(board)); }
private View GetTemplateDelegate(int i, ForumBoards forumBoards, View arg3) { var view = Activity.LayoutInflater.Inflate(Resource.Layout.ForumMainPagePinnedBoardItem, null); var root = view.FindViewById(Resource.Id.ForumMainPagePinnedBoardItemRootContainer); root.Click += OnPinnedBoardClick; root.Tag = (int)forumBoards; var txt = forumBoards.GetDescription(); if (txt.Length > 20 && txt.Length < 23) { txt = txt.Substring(0, 20) + "..."; } view.FindViewById <TextView>(Resource.Id.ForumMainPagePinnedBoardItemText).Text = txt; return(view); }
public static async Task<ForumBoardContent> GetSearchResults(string query, ForumBoards? searchScope) { var scope = searchScope == null ? -1 : (int) searchScope; var output = new ForumBoardContent {Pages = 0}; if (query.Length > 2) try { var client = await MalHttpContextProvider.GetHttpContextAsync(); var resp = await client.GetAsync($"/forum/search?q={query}&u=&uloc=1&loc={scope}"); var doc = new HtmlDocument(); doc.LoadHtml(await resp.Content.ReadAsStringAsync()); var s = await resp.Content.ReadAsStringAsync(); var topicContainer = doc.DocumentNode.Descendants("table") .First( node => node.Attributes.Contains("id") && node.Attributes["id"].Value == "forumTopics"); foreach (var topicRow in topicContainer.Descendants("tr").Skip(1)) //skip forum table header { try { output.ForumTopicEntries.Add(ParseTopicRow(topicRow)); } catch (Exception) { // } } } catch (Exception e) { // } return output; }
public static Tuple <PageIndex, object> GetNavigationParametersForUrl(string uri) { uri = uri.Replace("http://", "https://"); if (Regex.IsMatch(uri, @"https:\/\/myanimelist.net\/forum\/\?subboard=\d+")) { var id = uri.Split('=').Last(); if (id == "1") { return(new Tuple <PageIndex, object>(PageIndex.PageForumIndex, new ForumsBoardNavigationArgs(ForumBoards.AnimeSeriesDisc))); } else if (id == "4") { return(new Tuple <PageIndex, object>(PageIndex.PageForumIndex, new ForumsBoardNavigationArgs(ForumBoards.MangaSeriesDisc))); } } else if (Regex.IsMatch(uri, @"https:\/\/myanimelist.net\/forum\/\?board=\d+")) { ForumBoards board; if (ForumBoards.TryParse(uri.Split('=').Last(), out board)) { return(new Tuple <PageIndex, object>(PageIndex.PageForumIndex, new ForumsBoardNavigationArgs(board))); } } //else if (Regex.IsMatch(uri, @"https:\/\/myanimelist.net\/forum\/\?clubid=\d+")) //{ // var id = uri.Split('=').Last(); // return new Tuple<PageIndex, object>(PageIndex.PageForumIndex, new ForumsBoardNavigationArgs()); //} else if (Regex.IsMatch(uri, @"https:\/\/myanimelist.net\/forum\/\?animeid=\d+")) { int id; if (int.TryParse(uri.Split('=').Last(), out id)) { return(new Tuple <PageIndex, object>(PageIndex.PageForumIndex, new ForumsBoardNavigationArgs(id, "Anime Series Board", true))); } } else if (Regex.IsMatch(uri, @"https:\/\/myanimelist.net\/forum\/\?mangaid=\d+")) { int id; if (int.TryParse(uri.Split('=').Last(), out id)) { return(new Tuple <PageIndex, object>(PageIndex.PageForumIndex, new ForumsBoardNavigationArgs(id, "Manga Series Board", false))); } } else if (Regex.IsMatch(uri, @"https:\/\/myanimelist\.net\/forum\/message\/\d+\.*")) { //https://myanimelist.net/forum/message/49205130?goto=topic var id = int.Parse(uri.Replace("?goto=topic", "").Substring(10).Split('/')[3]); return(new Tuple <PageIndex, object>(PageIndex.PageForumIndex, new ForumsTopicNavigationArgs(null, id))); } else if (Regex.IsMatch(uri, @"https:\/\/myanimelist.net\/forum\/\?topicid=\d+.*")) { bool lastpost = false; if (uri.Contains("&goto=lastpost")) { lastpost = true; uri = uri.Replace("&goto=lastpost", ""); } var pos = uri.IndexOf('&'); var id = (pos == -1 ? uri : uri.Substring(0, pos)).Split('=').Last(); long targetMessage = -1; if (uri.Contains("#")) { long.TryParse(uri.Split('#').Last().Substring(3), out targetMessage); } return(new Tuple <PageIndex, object>(PageIndex.PageForumIndex, new ForumsTopicNavigationArgs(id, targetMessage == 0 ? (lastpost ? (long?)-1 : null) : targetMessage))); } else if (uri == "https://myanimelist.net/forum/") { return(new Tuple <PageIndex, object>(PageIndex.PageForumIndex, new ForumsNavigationArgs())); } else if (Regex.IsMatch(uri, @"https:\/\/myanimelist.net\/comtocom.php\?id1=\d+&id2=\d+\|.*")) { var split = uri.Split('|'); uri = split[0]; var data = string.Join("", split.Skip(1)); return(new Tuple <PageIndex, object>(PageIndex.PageMessageDetails, new MalMessageDetailsNavArgs { WorkMode = MessageDetailsWorkMode.ProfileComments, Arg = new MalComment { ComToCom = uri.Split('?').Last(), User = new MalUser { Name = data } } })); } else if (Regex.IsMatch(uri, @"https:\/\/myanimelist.net\/mymessages.php\?go=read&id=\d+\|.*")) { var split = uri.Split('|'); var data = string.Join("", split.Skip(1)); var msg = JsonConvert.DeserializeObject <MalMessageModel>(data); return(new Tuple <PageIndex, object>(PageIndex.PageMessageDetails, new MalMessageDetailsNavArgs { WorkMode = MessageDetailsWorkMode.Message, Arg = msg })); } else if (uri == "https://myanimelist.net/news") { return(new Tuple <PageIndex, object>(PageIndex.PageNews, MalArticlesPageNavigationArgs.News)); } else if (uri == "https://myanimelist.net/featured") { return(new Tuple <PageIndex, object>(PageIndex.PageArticles, MalArticlesPageNavigationArgs.Articles)); } /////////////////////////////////////////////////////Removed ? from the end var paramIndex = uri.IndexOf('?'); if (paramIndex != -1) { uri = uri.Substring(0, paramIndex); } if (Regex.IsMatch(uri, "anime\\/\\d") || Regex.IsMatch(uri, "manga\\/\\d")) { var link = uri.Substring(8).Split('/'); if (link.Length < 3) //we probably don't have name { return(null); } var id = int.Parse(link[2]); //if (Settings.SelectedApiType == ApiType.Hummingbird) //id switch // id = await new AnimeDetailsHummingbirdQuery(id).GetHummingbirdId(); return(new Tuple <PageIndex, object>(PageIndex.PageAnimeDetails, new AnimeDetailsPageNavigationArgs(id, link.Length == 4 ? link[3].Replace('_', ' ').Trim() : null, null, null) { AnimeMode = link[1] == "anime" })); } if (uri.Contains("/profile/")) { return(new Tuple <PageIndex, object>(PageIndex.PageProfile, new ProfilePageNavigationArgs { TargetUser = uri.Split('/').Last() })); } return(null); }
public ForumBoardEntryViewModel(string name, string description, FontAwesomeIcon icon,ForumBoards board) { Entry = new ForumBoardEntry {Name = name, Description = description}; Icon = icon; Board = board; }
public void AddFavouriteBoard(ForumBoards board) { if (!PinnedBoards.Contains(board)) { PinnedBoards.Add(board); Settings.ForumsPinnedBoards = string.Join(",", PinnedBoards.Cast<int>()); } }
private void RemoveFavouriteBoard(ForumBoards board) { PinnedBoards.Remove(board); Settings.ForumsPinnedBoards = string.Join(",", PinnedBoards.Cast<int>()); }
public static FontAwesomeIcon BoardToIcon(ForumBoards board) { switch (board) { case ForumBoards.Updates: return(FontAwesomeIcon.Bullhorn); case ForumBoards.Guidelines: return(FontAwesomeIcon.Gavel); case ForumBoards.Support: return(FontAwesomeIcon.Support); case ForumBoards.Suggestions: return(FontAwesomeIcon.LightbulbOutline); case ForumBoards.Contests: return(FontAwesomeIcon.Trophy); case ForumBoards.NewsDisc: return(FontAwesomeIcon.NewspaperOutline); case ForumBoards.Recomms: return(FontAwesomeIcon.Gift); case ForumBoards.AnimeSeriesDisc: return(FontAwesomeIcon.FolderOutline); case ForumBoards.MangaSeriesDisc: return(FontAwesomeIcon.FolderOutline); case ForumBoards.AnimeDisc: return(FontAwesomeIcon.Television); case ForumBoards.MangaDisc: return(FontAwesomeIcon.Book); case ForumBoards.Intro: return(FontAwesomeIcon.CommentOutline); case ForumBoards.GamesTech: return(FontAwesomeIcon.Gamepad); case ForumBoards.Music: return(FontAwesomeIcon.Music); case ForumBoards.Events: return(FontAwesomeIcon.Glass); case ForumBoards.CasualDisc: return(FontAwesomeIcon.Coffee); case ForumBoards.Creative: return(FontAwesomeIcon.PictureOutline); case ForumBoards.ForumsGames: return(FontAwesomeIcon.PuzzlePiece); default: return(FontAwesomeIcon.None); } }
private void RemoveFavouriteBoard(ForumBoards board) { PinnedBoards.Remove(board); Settings.ForumsPinnedBoards = string.Join(",", PinnedBoards.Cast <int>()); }
private void GotoFavouriteBoard(ForumBoards board) { ViewModelLocator.NavMgr.ResetMainBackNav(); ViewModelLocator.NavMgr.RegisterBackNav(PageIndex.PageForumIndex, new ForumsNavigationArgs()); ViewModelLocator.GeneralMain.Navigate(PageIndex.PageForumIndex,new ForumsBoardNavigationArgs(board)); }
public ForumsTopicNavigationArgs(string topicId, ForumBoards sourceBoard, bool lastpost = false) { TopicId = topicId; Page = ForumsPageIndex.PageTopic; SourceBoard = sourceBoard; Lastpost = lastpost; }
private static string GetEndpoint(ForumBoards board) { if (board == ForumBoards.AnimeSeriesDisc || board == ForumBoards.MangaSeriesDisc) return $"?subboard={(int) board - 100}"; //100 is offset to differentiate from other boards return $"?board={(int) board}"; }