/// <summary> /// Put given post in given box. /// </summary> /// <param name="i_IndexInList">The value that the scroll bar points on.</param> /// <param name="i_BoxIndex">The index of the box that will hold the post.</param> protected override void updateItem(int i_IndexInList, int i_BoxIndex) { PostInformation currentPost = m_posts[i_IndexInList]; FBBoxProxy fBBox = new FBBoxProxy(currentPost); m_boxes[i_BoxIndex] = fBBox; }
public PostViewModel(PostInformation postInformation) { Date = postInformation.Date; Markdown = File.ReadAllText(postInformation.FilePath); var converter = new Markdown(); Text = converter.Transform(Markdown); var regexMatch = TitleRegex.Match(Text); Title = regexMatch.Value.Replace("<h1>", string.Empty) .Replace("</h1>", string.Empty); if (!string.IsNullOrEmpty(regexMatch.Value)) { Text = Text.Replace(regexMatch.Value, string.Empty); } Year = postInformation.Date.Year; Month = postInformation.Date.Month; Name = postInformation.Name.Substring(0, postInformation.Name.LastIndexOf("_")); Summary = GetSummary(Text); }
/// <summary> /// FBBoxProxy constructor using PostInformation. /// </summary> /// <param name="i_PostInformation">Post information.</param> public FBBoxProxy(PostInformation i_PostInformation) { string text2 = i_PostInformation.Rate != 0 ? string.Format("Rate: {0}", i_PostInformation.Rate) : string.Empty; m_instance = GenerateFBBox(i_PostInformation.m_Message, text2, i_PostInformation.m_ImageURL); m_instance.MouseClicked += m_instance_MouseClicked; }
/// <summary> /// Update the currently funniest posts. /// </summary> /// <param name="i_PostInformation">New top funny post.</param> private void updateFunniestPosts(PostInformation i_PostInformation) { for (int i = sr_showTop - 1; i >= 0; i--) { if (m_funniestPosts[i].Rate <= i_PostInformation.Rate) { if (i == 0) { m_funniestPosts[i] = i_PostInformation; } else { m_funniestPosts[i] = m_funniestPosts[i - 1]; } } else if (i < sr_showTop - 1) { m_funniestPosts[i + 1] = i_PostInformation; } else { break; } } m_smallestTopRate = m_funniestPosts[sr_showTop - 1].Rate; }
public void ShouldReturnFeaturedImageUrlFromPost() { var postInformation = new PostInformation(new Post { FeaturedImage = "someurl" }); Assert.AreEqual("someurl", postInformation.FeaturedImage); }
public ActionResult UpdatePost(PostInformation objItem) { ALLMENU allMenu = new ALLMENU(); allMenu = (ALLMENU)Session["Menu"]; if (allMenu != null) { DBSubmitPost objDB = new DBSubmitPost(); return(Json(objDB.UpdatePost(objItem, allMenu.ListObjMenuPermission[0].UserID.ToString()))); } else { return(Json(new { JsonData = "", IsLogin = "******", redirectUrl = Url.Action("Index", "Security") }, JsonRequestBehavior.AllowGet)); } }
public ActionResult SignUp(UserSignUpModel model) { try { if (ModelState.IsValid) { var users = new ForumUser(); var data = new byte[model.File.ContentLength]; model.File.InputStream.Read(data, 0, model.File.ContentLength); model.Image = data; users.Image = model.Image; users.FirstName = model.FirstName; users.LastName = model.LastName; users.UserName = model.UserName; users.Country = model.Country; users.Email = model.Email; users.Password = model.Password; _db.ForumUser.Add(users); _db.SaveChanges(); var pi = new PostInformation(); var u = _db.ForumUser.SingleOrDefault(m => m.UserName.Equals(model.UserName)); if (u != null) { pi.UserId = u.UserId; } pi.TotalAnsPost = 0; pi.TotalCommentPost = 0; pi.TotalQuesPost = 0; pi.TotalValidPost = 0; _db.PostInformation.Add(pi); _db.SaveChanges(); return(RedirectToAction("Login", "Account")); } } catch (Exception) { Response.Write("<div id='logDialog'>"); Response.Write("You must upload your Image.And Image must be of jpg typed"); Response.Write("</div>"); return(View(model)); } return(View()); }
public void ShouldReturnFeaturedImageUrlFromPost() { var postInformation = new PostInformation(new Post { FeaturedImage = "someurl"}); Assert.AreEqual("someurl", postInformation.FeaturedImage); }
static void Main(string[] args) { Console.WriteLine("Initializing API..."); HF_API api = new HF_API("", "HF-Sharp"); // Use this if you're running your program on a server or VPN. // The parameter passed to 'BypassCaptchaSystem' should be a 2Captcha API Key. /*Console.WriteLine("Bypassing captcha system..."); * api.BypassCaptchaSystem("");*/ Console.WriteLine("\nTesting GetVersion..."); Console.WriteLine("Completed. Version #" + api.GetVersion()); Console.WriteLine("\nTesting GetUserInformation..."); UserInformation user = api.GetUserInformation(3241222); Console.WriteLine("username: "******"\nTesting GetCategoryInformation..."); CategoryInformation category = api.GetCategoryInformation(151); Console.WriteLine("category name: " + category.Name); Console.WriteLine("\nTesting GetForumInformation..."); ForumInformation forum = api.GetForumInformation(208); Console.WriteLine("forum name: " + forum.Name); Console.WriteLine("\nTesting GetThreadInformation..."); ThreadInformation thread = api.GetThreadInformation(5665556); Console.WriteLine("thread name: " + thread.Subject); Console.WriteLine("\nTesting GetPostInformation..."); PostInformation post = api.GetPostInformation(58564495); Console.WriteLine("post message: " + post.Message); Console.WriteLine("\nTesting GetPrivateMessageContainer..."); PrivateMessageContainer privateMessageContainer = api.GetPrivateMessageContainer(); Console.WriteLine("box information: " + privateMessageContainer.ContainerName + ", " + privateMessageContainer.PageInfo.TotalMessages + " messages"); Console.WriteLine("\nTesting GetPrivateMessages..."); List <PrivateMessageInformation> messages = api.GetPrivateMessages(); Console.WriteLine("got messages: " + messages.Count + " total, first id: " + messages[0].ID); Console.WriteLine("\nTesting GetPrivateMessage..."); PrivateMessage message = api.GetPrivateMessage(messages[0].ID); Console.WriteLine("got message: from " + message.FromUsername + ", to " + message.ToUsername + ", subject = " + message.Subject); Console.WriteLine("\nTesting GetGroupInformation..."); GroupInformation group = api.GetGroupInformation(52); Console.WriteLine("group: " + group.Name + ", owner: " + group.Owner.Username); Console.ReadKey(); }