public IBarelyView New(string entryid, CommentData post) { if(Form["Link"]!=""){ return null; } post.Name=post.Name.Substring(0,Math.Min(post.Name.Length,32)); post.Text=post.Text.Substring(0,Math.Min(post.Text.Length,1024)); post.IPAddress=Request.UserHostAddress; post.UserAgent=Request.UserAgent; post.Text=CheckLines(post.Text); if(post.Text=="OOONNNNYYYYTTTTIIIII") { throw new HttpException(500, "F**k you."); } BlogEntryData entry=BlogEntryData.Get(entryid); if(entry==null) { throw new HttpException(404, "Blog entry not found"); } post.EntryID=entry.ID; post.Posted=DateTime.Now; post.Save(); BlogEntryData.RecalculateComments(entry.ID); Response.Redirect(BlogHandler.GetUrl(entry)); return null; }
public Scenario3() { this.InitializeComponent(); // initializing sample data commentData = new CommentData(); // setting reivew ListView with sample data source ReviewsListView.ItemsSource = commentData.Collection; }
public void ToCode_given_OneRowSummary_should_ReturnCommentOnTwoRows() { // # Arrange. var sut = new CommentData("MyComment"); // # Act. var res = sut.ToCode(); // # Arrange. Assert.AreEqual(2, res.Count); CollectionAssert.AreEqual( new[] { "/// <summary> MyComment", "/// </summary>"}, res.ToList()); }
public void ParseLiveChatTextMessageRenderer_ModeratorTest() { var data = Tools.GetSampleData("AddChatItemAction_authorBadge_moderator.txt"); dynamic d = JsonConvert.DeserializeObject(data); CommentData commentData = YouTubeLiveSitePlugin.Test2.Parser.ParseLiveChatTextMessageRenderer(d.addChatItemAction.item.liveChatTextMessageRenderer.ToString()); Assert.AreEqual("UCTBOZy7Q97gvK_TeaqkFQjQ", commentData.UserId); Assert.IsFalse(commentData.IsPaidMessage); Assert.AreEqual(new List <IMessagePart> { Common.MessagePartFactory.CreateMessageText("Taku73"), }, commentData.NameItems); Assert.AreEqual(new List <IMessagePart> { Common.MessagePartFactory.CreateMessageText("逆さでも使えたよ"), }, commentData.MessageItems); Assert.AreEqual(1541606987038506, commentData.TimestampUsec); Assert.AreEqual(new Common.MessageImage { Alt = null, Url = "https://yt3.ggpht.com/--ifK17iopQY/AAAAAAAAAAI/AAAAAAAAAAA/xnoUPmWt5mY/s32-c-k-no-mo-rj-c0xffffff/photo.jpg", Width = 32, Height = 32 }, commentData.Thumbnail); }
// セーブ public void Save(CommentData commentData) { CommentMethod data = new CommentMethod(); // セーブデータ代入 data.commentdata_one = commentData.Commentdata_one; data.commentdata_two = commentData.Commentdata_two; data.commentdata_three = commentData.Commentdata_three; data.commentdata_four = commentData.Commentdata_four; data.commentdata_five = commentData.Commentdata_five; data.commentdata_six = commentData.Commentdata_six; data.commentdata_seven = commentData.Commentdata_seven; // jsonに書き出し StreamWriter writer; string jsonData = JsonUtility.ToJson(data); writer = new StreamWriter(Application.persistentDataPath + "/commentdata.json", false); // trueで追記、falseで上書き writer.Write(jsonData); writer.Flush(); writer.Close(); }
public void ParseLiveChatPaidMessageRenderer() { var data = Tools.GetSampleData("AddChatAction_liveChatPaidMessageRenderer.txt"); dynamic d = JsonConvert.DeserializeObject(data); CommentData commentData = YouTubeLiveSitePlugin.Test2.Parser.ParseLiveChatPaidMessageRenderer(d.addChatItemAction.item.liveChatPaidMessageRenderer.ToString()); Assert.AreEqual("UCWzefMLeuAhrCyhqYsFLl5Q", commentData.UserId); Assert.IsTrue(commentData.IsPaidMessage); Assert.AreEqual("¥1,200", commentData.PurchaseAmount); Assert.AreEqual(new List <IMessagePart> { Common.MessagePartFactory.CreateMessageText("ん ん"), }, commentData.NameItems); Assert.AreEqual(new List <IMessagePart> { Common.MessagePartFactory.CreateMessageText("面白かったです ではまた^ ^"), }, commentData.MessageItems); Assert.AreEqual(1541607010250939, commentData.TimestampUsec); Assert.AreEqual(new Common.MessageImage { Alt = null, Url = "https://yt3.ggpht.com/-BrEaZAWz_Do/AAAAAAAAAAI/AAAAAAAAAAA/n2m4xm5WT40/s32-c-k-no-mo-rj-c0xffffff/photo.jpg", Width = 32, Height = 32 }, commentData.Thumbnail); }
public void CommentModelTest1() { var data = new CommentData { CommentKey = 1, EntityKey = 1, EntityType = 1, CommentTypeKey = 1, CommentValue = "TEST", AuditAddUserId = "TEST", AuditAddDatetime = new System.DateTime(2018, 1, 1), AuditUpdateUserId = "TEST", AuditUpdateDatetime = new System.DateTime(2018, 1, 1), }; var sut = new Comment(data); Assert.True(sut.CommentKey == 1); Assert.True(sut.EntityKey == 1); Assert.True(sut.EntityTypeKey == 1); Assert.True(sut.CommentType == QIQOCommentType.Public); Assert.True(sut.CommentValue == "TEST"); }
public void Receive(CommentData comment) { if (setting.Enable) { Task.Run(() => { ExecuteProcess(); if (setting.BlackListEnable) { if (IsRead(comment)) { Http.Get($"http://localhost:50080/Talk?text={HttpUtility.UrlEncode(DataFormat(comment))}"); } } else { Http.Get($"http://localhost:50080/Talk?text={HttpUtility.UrlEncode(DataFormat(comment))}"); } }); } }
private CommentData GetCommentArray(string comments) { var mm = commentArrayRegex.Matches(comments); l.Clear(); for (var i = 0; i <= mm.Count - 1; i++) { var line = mm[i].Groups[1].Value.Trim(); line = line.Replace("<", "<"); if (!string.IsNullOrWhiteSpace(line)) { if (!line.Equals("The resulting string must be freed by calling cef_string_userfree_free().")) { l.Add(line); } } } var cc = new CommentData(); cc.Lines = l.ToArray(); return(cc); }
public static void TransToCommentData() { for (int i = 0; i < Info.items.Count; i++) { COMMENT a = Info.items[i]; CommentData comment = new CommentData(); comment.id = a.comment_id; comment.targetId = 0; comment.userId = a.user_id; comment.info = a.comment_info; comment.order = a.order; comment.commentType = (CommentType)a.target_type; List <CommentData> comments; int targetUserId = ZoneManager.Instance.GetCommentTargetId(comment); if (!ZoneManager.Instance.id2Comment.TryGetValue(targetUserId, out comments)) { comments = new List <CommentData>(); ZoneManager.Instance.id2Comment.Add(targetUserId, comments); } comments.Add(comment); } }
/// <summary> /// 解析留言資訊 /// </summary> /// <param name="commentActions">json data.</param> /// <returns>成功則回傳留言列表,失敗則回傳null</returns> private List <CommentData> ParseComment(dynamic commentActions) { if (commentActions == null) { return(null); } List <CommentData> ret = new List <CommentData>(); for (int i = 0; i < commentActions.Count; i++) { CommentData cmt = new CommentData(); var data = JsonHelper.TryGetValueByXPath(commentActions[i], "replayChatItemAction.actions", null); if (data != null) { var txtMsgRd = JsonHelper.TryGetValueByXPath(data[0], "addChatItemAction.item.liveChatTextMessageRenderer", null); if (txtMsgRd != null) { ParseTextMessage(cmt.addChatItemAction.item.liveChatTextMessageRenderer, txtMsgRd); } else { dynamic paidMsgRd = JsonHelper.TryGetValueByXPath(data[0], "addChatItemAction.item.liveChatPaidMessageRenderer", null); if (paidMsgRd == null) { continue; } ParsePaidMessage(cmt.addChatItemAction.item.liveChatPaidMessageRenderer, paidMsgRd); } cmt.addChatItemAction.clientId = Convert.ToString(JsonHelper.TryGetValueByXPath(data[0], "addChatItemAction.clientId", "")); cmt.videoOffsetTimeMsec = new TimeSpan(0, 0, 0, 0, Convert.ToInt32(JsonHelper.TryGetValueByXPath(commentActions[i], "replayChatItemAction.videoOffsetTimeMsec"))); ret.Add(cmt); } } return(ret); }
public ViewResult AddCommentAndVote() { AppUser user = GetUser().Result; CommentData data = repository.CommentAndVoteCheck(user); AddVoteCommentViewModel model = new AddVoteCommentViewModel(); model.Comment.AppointmentId = data.appointment.AppointmentId; model.Comment.CommentAvailable = (DateTime)data.appointment.AppointmentEnd; model.Comment.CommentDate = DateTime.Now; model.Comment.Done = false; model.Comment.Points = 0; model.Comment.PatientEmail = user.Email; model.Comment.PatientId = (int)user.PatientId; AppUser doctor = repository.GetUserByDoctorId((int)data.appointment.DoctorId); model.Message = $"Prosimy o komentarz i ocenę dotyczącą wizyty u {doctor.UserName + " "+doctor.Surname} z dnia {((DateTime)data.appointment.AppointmentEnd).ToShortDateString() }"; return(View(model)); }
public void ParseLiveChatTextMessageRendererTest() { var data = Tools.GetSampleData("AddChatItemAction_authorBadge.txt"); dynamic d = JsonConvert.DeserializeObject(data); CommentData commentData = YouTubeLiveSitePlugin.Test2.Parser.ParseLiveChatTextMessageRenderer(d.addChatItemAction.item.liveChatTextMessageRenderer.ToString()); Assert.AreEqual("UC0jl5mtntIH8O0ajZ0_V-tw", commentData.UserId); Assert.IsFalse(commentData.IsPaidMessage); Assert.AreEqual(new List <IMessagePart> { Common.MessagePartFactory.CreateMessageText("haza max//"), new Common.MessageImage { Alt = "新規メンバー", Url = "https://yt3.ggpht.com/qPJX8KBpz4yOeltrmSzw1j0_K0TV_J3mddsGQ5D0ilq02_kDNl1O9-D9BOw3noFjdEsqpqRBdA=s16-c-k", Width = 16, Height = 16 }, }, commentData.NameItems); Assert.AreEqual(new List <IMessagePart> { Common.MessagePartFactory.CreateMessageText("古坂大魔王"), }, commentData.MessageItems); Assert.AreEqual(1541607345750974, commentData.TimestampUsec); Assert.AreEqual(new Common.MessageImage { Alt = null, Url = "https://yt3.ggpht.com/-G-W5PcqlqqY/AAAAAAAAAAI/AAAAAAAAAAA/nZt7m0jgEGg/s32-c-k-no-mo-rj-c0xffffff/photo.jpg", Width = 32, Height = 32 }, commentData.Thumbnail); }
public void ToCode_given_TwoRowsSummary_should_returnThreeRows() { // # Arrange. var sut = new CommentData(); sut.Summary = new List<string> { "First row", "second row." }; // # Act. var res = sut.ToCode(); // # Assert. Assert.AreEqual(3, res.Count); CollectionAssert.AreEqual( new[] { "/// <summary> First row", "/// second row.", "/// </summary>" }, res.ToList()); }
public async Task <ActionResult <CommentIdData> > PostComment([FromBody] CommentData model, string caffId) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var userId = this.User.Claims.FirstOrDefault().Value; try { await authService.CheckIfUserIsLoggedIn(userId); var commentId = caffService.CreateNewComment(mapper.Map <Comment>(model), caffId, userId); return(new CommentIdData() { Id = commentId }); } catch (Exception e) { return(BadRequest(new { error = e.Message })); } }
private YouTubeLiveMessageContext CreateMessageContext(CommentData commentData, bool isInitialComment) { IYouTubeLiveMessage message; IEnumerable <IMessagePart> commentItems; IEnumerable <IMessagePart> nameItems; if (commentData.IsPaidMessage) { var superchat = new YouTubeLiveSuperchat(commentData); message = superchat; nameItems = superchat.NameItems; commentItems = superchat.CommentItems; } else { var comment = new YouTubeLiveComment(commentData); message = comment; nameItems = comment.NameItems; commentItems = comment.CommentItems; } var metadata = CreateMetadata(message, isInitialComment); var methods = new YouTubeLiveMessageMethods(); if (_siteOptions.IsAutoSetNickname) { var user = metadata.User; var messageText = Common.MessagePartsTools.ToText(commentItems); var nick = SitePluginCommon.Utils.ExtractNickname(messageText); if (!string.IsNullOrEmpty(nick)) { user.Nickname = nick; } } metadata.User.Name = nameItems; return(new YouTubeLiveMessageContext(message, metadata, methods)); }
protected CfxClass(CefStructType cefStruct, Parser.StructData sd, ApiTypeBuilder api) { CefStruct = cefStruct; OriginalSymbol = cefStruct.OriginalSymbol; CfxNativeSymbol = cefStruct.CfxNativeSymbol; CfxName = cefStruct.CfxName; ClassName = cefStruct.ClassName; ApiClassName = ClassName.Substring(3); RemoteClassName = cefStruct.RemoteClassName; Comments = sd.Comments; if (sd.CefConfig != null) { switch (sd.CefConfig.Source) { case "client": Category = StructCategory.ApiCallbacks; break; case "library": Category = StructCategory.ApiCalls; break; default: Debug.Assert(false); break; } } else { Debug.Assert(sd.StructMembers.Count == 1 || sd.StructMembers[1].CallbackSignature == null); Category = StructCategory.Values; } Debug.Assert(sd.CefFunctions.Count == 0 || Category == StructCategory.ApiCalls); }
public async Task <IActionResult> Login(LoginModel details, string returnUrl) { if (ModelState.IsValid) { AppUser user = await userManager.FindByEmailAsync(details.Email); if (user != null) { await signInManager.SignOutAsync(); Microsoft.AspNetCore.Identity.SignInResult result = await signInManager.PasswordSignInAsync(user, details.Password, false, false); if (result.Succeeded) { if (user.ChooseRole == "Pacjent") { CommentData data = repository.CommentAndVoteCheck(user); if (data != null) { SubjectMakeComment subject = new SubjectMakeComment(data.appointment, data.user); Observer obserwer = new Observer(subject, repository, (int)user.PatientId); subject.MakeNotificationMakeCommentAndVote(data.appointment); subject.notifyObservers(); } } return(Redirect(returnUrl ?? "/")); } } ModelState.AddModelError(nameof(LoginModel.Email), "Nieprawidłowa nazwa użytkownika lub hasło"); } return(View(details)); }
public CefCallbackFunction(CefStructType parent, StructCategory category, string name, CefConfigData cefConfig, Parser.SignatureData sd, ApiTypeBuilder api, CommentData comments) { Name = name; this.Parent = parent; this.Comments = comments; if (cefConfig == null) { CefConfig = new CefConfigData(); } else { CefConfig = cefConfig; } if (category == StructCategory.ApiCallbacks) { m_callMode = CfxCallMode.Callback; this.Signature = Signature.Create(SignatureType.ClientCallback, CefName, CefConfig, CallMode, sd, api); } else { m_callMode = CfxCallMode.FunctionCall; this.Signature = Signature.Create(SignatureType.LibraryCall, CefName, CefConfig, CallMode, sd, api); } }
public List <SqlParameter> MapParamsForDelete(CommentData entity) { return(MapParamsForDelete(entity.CommentKey)); }
public CommentVM(CommentData data) { _data = data; }
public CommentObject AddComment(CommentData cd) { return AddComment (cd.objectId, cd.commentType, cd.comment, cd.loc); }
public void EmitPublicEventArgsAndHandler(CodeBuilder b, CommentData comments) { if (emittedHandlers.ContainsKey(EventName)) { var c0 = emittedHandlers[EventName]; if (c0 != null) { if (c0.Lines.Length != comments.Lines.Length) { System.Diagnostics.Debugger.Break(); } for (var i = 0; i <= c0.Lines.Length - 1; i++) { if (c0.Lines[i] != comments.Lines[i]) { // two handlers use same event but with different comments System.Diagnostics.Debugger.Break(); } } } return; } emittedHandlers.Add(EventName, comments); if (IsBasicEvent) { return; } b.AppendSummaryAndRemarks(comments, false, true); b.AppendLine("public delegate void {0}(object sender, {1} e);", EventHandlerName, PublicEventArgsClassName); b.AppendLine(); b.AppendSummaryAndRemarks(comments, false, true); b.BeginClass(PublicEventArgsClassName + " : CfxEventArgs", GeneratorConfig.ClassModifiers(PublicEventArgsClassName)); b.AppendLine(); for (var i = 1; i <= Signature.ManagedArguments.Count() - 1; i++) { Signature.ManagedArguments[i].EmitPublicEventArgFields(b); } b.AppendLine(); if (!Signature.PublicReturnType.IsVoid) { b.AppendLine("internal {0} m_returnValue;", Signature.PublicReturnType.PublicSymbol); b.AppendLine("private bool returnValueSet;"); b.AppendLine(); } b.BeginBlock("internal {0}({1})", PublicEventArgsClassName, Signature.PublicEventConstructorArgumentList); Signature.EmitPublicEventCtorStatements(b); b.EndBlock(); b.AppendLine(); for (var i = 1; i <= Signature.ManagedArguments.Count() - 1; i++) { var arg = Signature.ManagedArguments[i]; var cd = new CommentData(); if (arg.ArgumentType.IsIn && arg.ArgumentType.IsOut) { cd.Lines = new string[] { string.Format("Get or set the {0} parameter for the <see cref=\"{1}.{2}\"/> callback.", arg.PublicPropertyName, Parent.ClassName, PublicName) }; } else if (arg.ArgumentType.IsIn) { cd.Lines = new string[] { string.Format("Get the {0} parameter for the <see cref=\"{1}.{2}\"/> callback.", arg.PublicPropertyName, Parent.ClassName, PublicName) }; } else { cd.Lines = new string[] { string.Format("Set the {0} out parameter for the <see cref=\"{1}.{2}\"/> callback.", arg.PublicPropertyName, Parent.ClassName, PublicName) }; } if (arg.ArgumentType is CefStructArrayType && arg.ArgumentType.IsIn) { cd.Lines = cd.Lines.Concat(new string[] { "Do not keep a reference to the elements of this array outside of this function." }).ToArray(); } b.AppendSummary(cd); b.BeginBlock("public {0} {1}", arg.ArgumentType.PublicSymbol, arg.PublicPropertyName); if (arg.ArgumentType.IsIn) { b.BeginBlock("get"); b.AppendLine("CheckAccess();"); arg.EmitPublicEventArgGetterStatements(b); b.EndBlock(); } if (arg.ArgumentType.IsOut) { b.BeginBlock("set"); b.AppendLine("CheckAccess();"); arg.EmitPublicEventArgSetterStatements(b); b.EndBlock(); } b.EndBlock(); } if (!Signature.PublicReturnType.IsVoid) { var cd = new CommentData(); cd.Lines = new string[] { string.Format("Set the return value for the <see cref=\"{0}.{1}\"/> callback.", Parent.ClassName, PublicFunctionName), "Calling SetReturnValue() more then once per callback or from different event handlers will cause an exception to be thrown." }; b.AppendSummary(cd); b.BeginBlock("public void SetReturnValue({0} returnValue)", Signature.PublicReturnType.PublicSymbol); b.AppendLine("CheckAccess();"); b.BeginIf("returnValueSet"); b.AppendLine("throw new CfxException(\"The return value has already been set\");"); b.EndBlock(); b.AppendLine("returnValueSet = true;"); b.AppendLine("this.m_returnValue = returnValue;"); b.EndBlock(); } if (Signature.ManagedArguments.Count() > 1) { b.AppendLine(); EmitEventToString(b); } b.EndBlock(); }
public async Task <string> Put(int id, [FromBody] CommentData value) { return(await _clientFactoryService.PutAsync(id, value)); }
public void Post([FromBody] CommentData Comment) { SqlConnector.PostComment(Comment); }
public override float SetData(object o) { base.SetData(o); data = o as TweetData; HeadSpriteUtils.Instance.SetHead(head, data.userId); userName.text = XMLSaver.saveData.GetAccountData(data.userId).GetAnyName(); float itemHeight = 0.0f; itemHeight -= root.anchoredPosition.y; itemHeight -= mainBody.rectTransform.anchoredPosition.y; mainBody.text = data.info; mainBody.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 2000.0f); mainBody.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, mainBody.preferredHeight); itemHeight += mainBody.rectTransform.sizeDelta.y; itemHeight += 26.0f; picGroup.anchoredPosition = new Vector2(picGroup.anchoredPosition.x, -itemHeight + 20.0f); for (int i = 0; i < pic.Length; i++) { pic [i].gameObject.SetActive(false); } mainPic.gameObject.SetActive(false); if (data.pics.Length == 1) { mainPic.sprite = ZoneManager.Instance.picArray[data.pics[0]].pic; mainPic.sizeDelta = Utils.CalSpriteDisplaySize(pic[0].sprite.bounds.size, new Vector2(750.0f, 535.0f)); itemHeight += mainPic.sizeDelta.y; itemHeight += 30.0f; mainPic.gameObject.SetActive(true); } else if (data.pics.Length >= 2) { for (int i = 0; i < Mathf.Min(data.pics.Length, 6); i++) { pic[i].sprite = ZoneManager.Instance.picArray[data.pics[i]].pic; pic[i].gameObject.SetActive(true); } mainPic.sprite = ZoneManager.Instance.picArray[data.pics[0]].pic; mainPic.sizeDelta = Utils.CalSpriteDisplaySize(pic[0].sprite.bounds.size, new Vector2(750.0f, 535.0f)); mainPic.gameObject.SetActive(true); if (data.pics.Length <= 3) { itemHeight += 260.0f; } else { itemHeight += 530.0f; } itemHeight += 30.0f; } locationText.anchoredPosition = new Vector2(locationText.anchoredPosition.x, -itemHeight + 20.0f); locationText.text = data.location; itemHeight += 70.0f; comments.Clear(); likes.Clear(); if (ZoneManager.Instance.id2Comment.ContainsKey(data.userId)) { for (int i = 0; i < ZoneManager.Instance.id2Comment[data.userId].Count; i++) { CommentData commentData = ZoneManager.Instance.id2Comment[data.userId][i]; if (commentData.commentType != CommentType.Tweet || commentData.targetId != data.id) { continue; } if (commentData.info == null) { likes.Add(commentData); } else { comments.Add(commentData); } } } if (likes.Count == 0 && comments.Count == 0) { downPanel.gameObject.SetActive(false); itemHeight += 10.0f; height = itemHeight; dotsCanvas.alpha = 0.0f; dotsCanvas.blocksRaycasts = false; comments.Clear(); likes.Clear(); sb.Length = 0; return(itemHeight); } downPanelLine.gameObject.SetActive(likes.Count != 0 && comments.Count != 0); downPanel.gameObject.SetActive(true); downPanel.anchoredPosition = new Vector2(downPanel.anchoredPosition.x, -itemHeight + 20.0f); sb.Length = 0; float addHeight = 0.0f; addHeight += 25.0f; if (likes.Count != 0) { sb.Append(XMLSaver.saveData.GetAccountData(likes[0].userId).GetAnyName()); } for (int i = 1; i < likes.Count; i++) { sb.Append("," + XMLSaver.saveData.GetAccountData(likes[0].userId).GetAnyName()); } if (likes.Count == 0) { likesText.gameObject.SetActive(false); heartIcon.gameObject.SetActive(false); } else { likesText.text = sb.ToString(); //likeNames.rectTransform.SetSizeWithCurrentAnchors (RectTransform.Axis.Vertical,2000.0f); likesText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, likesText.preferredHeight); likesText.gameObject.SetActive(true); heartIcon.gameObject.SetActive(true); addHeight += (90.0f - 40.0f + likesText.height); } sb.Length = 0; if (comments.Count != 0) { sb.Append(XMLSaver.saveData.GetAccountData(comments[0].userId).GetAnyName() + ":<color=black>" + comments[0].info + "</color>"); } for (int i = 1; i < comments.Count; i++) { sb.Append("\n"); sb.Append(XMLSaver.saveData.GetAccountData(comments[i].userId).GetAnyName() + ":<color=black>" + comments[i].info + "</color>"); } if (comments.Count == 0) { commentText.gameObject.SetActive(false); } else { commentText.text = sb.ToString(); commentText.anchoredPosition = new Vector2(commentText.anchoredPosition.x, -addHeight - 20.0f); //comment.rectTransform.SetSizeWithCurrentAnchors (RectTransform.Axis.Vertical,2000.0f); commentText.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, commentText.preferredHeight); commentText.gameObject.SetActive(true); addHeight += (40.0f + commentText.height); } addHeight += 25.0f; downPanel.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, addHeight); itemHeight += addHeight; itemHeight += 10.0f; height = itemHeight; dotsCanvas.alpha = 0.0f; dotsCanvas.blocksRaycasts = false; comments.Clear(); likes.Clear(); sb.Length = 0; return(itemHeight); }
public Task <CommentData> SaveComment(CommentData comment) { return(Task.Run <CommentData>(() => comment)); }
public static CommentData ToCommentData(CommentObject pi) { CommentData pid = new CommentData (); pid.comment = pi.commentPanel.text.text; pid.loc = pi.transform.position; pid.commentType = pi.commentPanel.commentType; return pid; }
public async Task CreateComment([FromBody] CommentData commentData) { await CommentService.CreateCommentAsync(commentData); }
/**************************************************** OTHER METHODS ******************************************************/ /// <summary> /// <para>parses and returns the FeedData in the form of list</para> /// </summary> /// <param name="ParsedJson"></param> /// <returns></returns> private List <FeedData> ParseFeeds(dynamic ParsedJson) { // CREATE FEEDDATA LIST List <FeedData> Data = new List <FeedData>(); foreach (dynamic Post in ParsedJson.data) { // CREATE FEEDDATA OBJECT FeedData Feed = new FeedData(); // CREATE ATTRIBUTION OBJECT; if (Post.attribution == null) { Feed.Attribution = null; } else { AttributionData Attribution = new AttributionData(); Attribution.Website = Post.Attribution.website; Attribution.ItunesUrl = Post.Attribution.itunes_url; Attribution.Name = Post.Attribution.name; Feed.Attribution = Attribution; } // SET TAGS List <String> Tags = new List <String>(); foreach (dynamic Tag in Post.tags) { Tags.Add(Tag.ToString()); } Feed.Tags = Tags; // SET TYPE Feed.Type = Post.type; // SET LOCATION if (Post.location == null) { Feed.Location = null; } else { LocationData Location = new LocationData(); Location.Id = Post.location.id; Location.Latitude = Post.location.latitude; Location.Longitude = Post.location.longitude; Location.Name = Post.location.name; Feed.Location = Location; } // SET COMMENTS CommentData Comments = new CommentData(); Comments.Count = Post.comments.count; List <Comment> CommentData = new List <Comment>(); foreach (dynamic EachComment in Post.comments.data) { // CREATE COMMENT OBJECT Comment Comment = new Comment(); Comment.CreatedTime = new DateTime(long.Parse(EachComment.created_time.ToString())); Comment.Id = EachComment.id; Comment.Text = EachComment.text; // CREATE USER OBJECT User CommentedBy = new User(); CommentedBy.UserName = EachComment.from.username; CommentedBy.ProfilePicture = EachComment.from.profile_pciture; CommentedBy.Id = EachComment.from.id; CommentedBy.FullName = EachComment.from.full_name; // ASSOCIATE COMMENT WITH USER Comment.From = CommentedBy; // ADD COMMENT TO THE LIST CommentData.Add(Comment); } Comments.Data = CommentData; Feed.Comments = Comments; // SET FILTER Feed.Filter = Post.filter; // SET CREATED TIME Feed.CreatedTime = new DateTime(long.Parse(Post.created_time.ToString())); // SET LINK Feed.Link = Post.link; // SET LIKES LikesData Likes = new LikesData(); Likes.Count = Post.likes.count; List <User> LikedByUsers = new List <User>(); foreach (dynamic EachLike in Post.likes.data) { // CREATE USER OBJECT User LikedBy = new User(); LikedBy.UserName = EachLike.username; LikedBy.ProfilePicture = EachLike.profile_picture; LikedBy.Id = EachLike.id; LikedBy.FullName = EachLike.full_name; // ADD USER TO THE LIST LikedByUsers.Add(LikedBy); } Likes.Data = LikedByUsers; Feed.Likes = Likes; // SET VIDEO if (Feed.Type.Equals("video")) { VideosData VideoData = new VideosData(); LowResolutionVideo LRVideo = new LowResolutionVideo(); LRVideo.url = Post.videos.low_resolution.url; LRVideo.width = Post.videos.low_resolution.width; LRVideo.height = Post.videos.low_resolution.height; VideoData.LowResolution = LRVideo; StandardResolutionVideo SRVideo = new StandardResolutionVideo(); SRVideo.url = Post.videos.standard_resolution.url; SRVideo.width = Post.videos.standard_resolution.width; SRVideo.height = Post.videos.standard_resolution.height; VideoData.StandardResolution = SRVideo; Feed.Videos = VideoData; } else { Feed.Videos = null; } // SET IMAGES ImagesData Images = new ImagesData(); StandardResolutionImage SRImage = new StandardResolutionImage(); SRImage.url = Post.images.standard_resolution.url; SRImage.width = Post.images.standard_resolution.width; SRImage.height = Post.images.standard_resolution.height; Images.StandardResolution = SRImage; ThumbnailImage TImage = new ThumbnailImage(); TImage.url = Post.images.thumbnail.url; TImage.width = Post.images.thumbnail.width; TImage.height = Post.images.thumbnail.height; Images.Thumbnail = TImage; LowResolutionImage LRImage = new LowResolutionImage(); LRImage.url = Post.images.low_resolution.url; LRImage.width = Post.images.low_resolution.width; LRImage.height = Post.images.low_resolution.height; Images.LowResolution = LRImage; Feed.Images = Images; // SET CAPTIONS CaptionData Caption = new CaptionData(); if (Post.caption != null) { Caption.CreratedTime = new DateTime(long.Parse(Post.caption.created_time.ToString())); Caption.Text = Post.caption.text; Caption.Id = Post.caption.id; User CaptionedBy = new User(); CaptionedBy.UserName = Post.caption.from.username; CaptionedBy.ProfilePicture = Post.caption.from.profile_pciture; CaptionedBy.Id = Post.caption.from.id; CaptionedBy.FullName = Post.caption.from.full_name; Caption.From = CaptionedBy; } Feed.Caption = Caption; // SET TAGGED USER List <TaggedUser> UserInPhotos = new List <TaggedUser>(); if (Post.users_in_photo != null) { foreach (dynamic UserTag in Post.users_in_photo) { // CREATE TAGGED USER OBJECT TaggedUser TUser = new TaggedUser(); // SET USER User TaggedUser = new User(); TaggedUser.UserName = UserTag.user.username; TaggedUser.FullName = UserTag.user.full_name; TaggedUser.Id = UserTag.user.id; TaggedUser.ProfilePicture = UserTag.user.profile_picture; TUser.User = TaggedUser; // SET POSITION Position TagPosition = new Position(); TagPosition.x = float.Parse(UserTag.position.x.ToString()); TagPosition.y = float.Parse(UserTag.position.y.ToString()); TUser.Position = TagPosition; // ADD TO LIST UserInPhotos.Add(TUser); } } Feed.UsersInPhoto = UserInPhotos; // SET USER LIKE Feed.UserHasLiked = Post.user_has_liked; // SET ID Feed.Id = Post.id; // SET USER User FeedBy = new User(); FeedBy.UserName = Post.user.username; FeedBy.Website = Post.user.webste; FeedBy.ProfilePicture = Post.user.profile_picture; FeedBy.FullName = Post.user.full_name; FeedBy.Bio = Post.user.bio; FeedBy.Id = Post.user.id; Feed.User = FeedBy; // ADD FEED TO LIST Data.Add(Feed); } return(Data); }
public async Task <string> Post([FromBody] CommentData value) { return(await _clientFactoryService.PostAsync(value)); }
public CefStructType(string name, CommentData comments) : base(name) { }
public void EmitRemoteEventArgsAndHandler(CodeBuilder b, CommentData comments) { if (IsBasicEvent) { return; } b.AppendSummaryAndRemarks(comments, true, true); b.AppendLine("public delegate void {0}(object sender, {1} e);", RemoteEventHandlerName, RemoteEventArgsClassName); b.AppendLine(); b.AppendSummaryAndRemarks(comments, true, true); b.BeginClass(RemoteEventArgsClassName + " : CfrEventArgs", GeneratorConfig.ClassModifiers(RemoteEventArgsClassName)); b.AppendLine(); for (var i = 1; i <= Signature.ManagedArguments.Count() - 1; i++) { if (Signature.ManagedArguments[i].ArgumentType.IsIn) { b.AppendLine("bool {0}Fetched;", Signature.ManagedArguments[i].PublicPropertyName); b.AppendLine("{0} m_{1};", Signature.ManagedArguments[i].ArgumentType.RemoteSymbol, Signature.ManagedArguments[i].PublicPropertyName); } } b.AppendLine(); if (!Signature.PublicReturnType.IsVoid) { b.AppendLine("private bool returnValueSet;"); b.AppendLine(); } b.AppendLine("internal {0}(ulong eventArgsId) : base(eventArgsId) {{}}", RemoteEventArgsClassName); b.AppendLine(); for (var i = 1; i <= Signature.ManagedArguments.Count() - 1; i++) { var arg = Signature.ManagedArguments[i]; var cd = new CommentData(); if (arg.ArgumentType.IsIn && arg.ArgumentType.IsOut) { cd.Lines = new string[] { string.Format("Get or set the {0} parameter for the <see cref=\"{1}.{2}\"/> render process callback.", arg.PublicPropertyName, Parent.RemoteSymbol, PublicFunctionName) }; } else if (arg.ArgumentType.IsIn) { cd.Lines = new string[] { string.Format("Get the {0} parameter for the <see cref=\"{1}.{2}\"/> render process callback.", arg.PublicPropertyName, Parent.RemoteSymbol, PublicFunctionName) }; } else { cd.Lines = new string[] { string.Format("Set the {0} out parameter for the <see cref=\"{1}.{2}\"/> render process callback.", arg.PublicPropertyName, Parent.RemoteSymbol, PublicFunctionName) }; } b.AppendSummary(cd); b.BeginBlock("public {0} {1}", arg.ArgumentType.RemoteSymbol, arg.PublicPropertyName); if (arg.ArgumentType.IsIn) { b.BeginBlock("get"); b.AppendLine("CheckAccess();"); b.BeginBlock("if(!{0}Fetched)", arg.PublicPropertyName); b.AppendLine("{0}Fetched = true;", arg.PublicPropertyName); b.AppendLine("var call = new {0}Get{1}RenderProcessCall();", EventName, arg.PublicPropertyName); b.AppendLine("call.eventArgsId = eventArgsId;"); b.AppendLine("call.RequestExecution(CfxRemoteCallContext.CurrentContext.connection);"); b.AppendLine("m_{0} = {1};", arg.PublicPropertyName, arg.ArgumentType.RemoteWrapExpression("call.value")); b.EndBlock(); b.AppendLine("return m_{0};", arg.PublicPropertyName); b.EndBlock(); } if (arg.ArgumentType.IsOut) { b.BeginBlock("set"); b.AppendLine("CheckAccess();"); if (arg.ArgumentType.IsIn) { b.AppendLine("m_{0} = value;", arg.PublicPropertyName); b.AppendLine("{0}Fetched = true;", arg.PublicPropertyName); } b.AppendLine("var call = new {0}Set{1}RenderProcessCall();", EventName, arg.PublicPropertyName); b.AppendLine("call.eventArgsId = eventArgsId;"); b.AppendLine("call.value = {0};", arg.ArgumentType.RemoteUnwrapExpression("value")); b.AppendLine("call.RequestExecution(CfxRemoteCallContext.CurrentContext.connection);"); b.EndBlock(); } b.EndBlock(); } if (!Signature.PublicReturnType.IsVoid) { var cd = new CommentData(); cd.Lines = new string[] { string.Format("Set the return value for the <see cref=\"{0}.{1}\"/> render process callback.", Parent.RemoteClassName, PublicFunctionName), "Calling SetReturnValue() more then once per callback or from different event handlers will cause an exception to be thrown." }; b.AppendSummary(cd); b.BeginBlock("public void SetReturnValue({0} returnValue)", Signature.PublicReturnType.RemoteSymbol); b.BeginIf("returnValueSet"); b.AppendLine("throw new CfxException(\"The return value has already been set\");"); b.EndBlock(); b.AppendLine("var call = new {0}SetReturnValueRenderProcessCall();", EventName); b.AppendLine("call.eventArgsId = eventArgsId;"); b.AppendLine("call.value = {0};", Signature.PublicReturnType.RemoteUnwrapExpression("returnValue")); b.AppendLine("call.RequestExecution(CfxRemoteCallContext.CurrentContext.connection);"); b.AppendLine("returnValueSet = true;"); b.EndBlock(); } if (Signature.ManagedArguments.Count() > 1) { b.AppendLine(); EmitEventToString(b); } b.EndBlock(); }
protected override bool read(BinaryReader source, MetaDataIO.ReadTagParams readTagParams) { bool result = false; long position; resetData(); source.BaseStream.Seek(0, SeekOrigin.Begin); if (AIFF_CONTAINER_ID.Equals(Utils.Latin1Encoding.GetString(source.ReadBytes(4)))) { // Container chunk size long containerChunkPos = source.BaseStream.Position; int containerChunkSize = StreamUtils.DecodeBEInt32(source.ReadBytes(4)); if (containerChunkPos + containerChunkSize + 4 != source.BaseStream.Length) { LogDelegator.GetLogDelegate()(Log.LV_WARNING, "Header size is incoherent with file size"); } // Form type format = Utils.Latin1Encoding.GetString(source.ReadBytes(4)); if (format.Equals(FORMTYPE_AIFF) || format.Equals(FORMTYPE_AIFC)) { isValid = true; StringBuilder commentStr = new StringBuilder(""); long soundChunkPosition = 0; long soundChunkSize = 0; // Header size included bool nameFound = false; bool authorFound = false; bool copyrightFound = false; bool commentsFound = false; long limit = Math.Min(containerChunkPos + containerChunkSize + 4, source.BaseStream.Length); int annotationIndex = 0; int commentIndex = 0; while (source.BaseStream.Position < limit) { ChunkHeader header = seekNextChunkHeader(source, limit); position = source.BaseStream.Position; if (header.ID.Equals(CHUNKTYPE_COMMON)) { short channels = StreamUtils.DecodeBEInt16(source.ReadBytes(2)); switch (channels) { case 1: channelsArrangement = MONO; break; case 2: channelsArrangement = STEREO; break; case 3: channelsArrangement = ISO_3_0_0; break; case 4: channelsArrangement = ISO_2_2_0; break; // Specs actually allow both 2/2.0 and LRCS case 6: channelsArrangement = LRLcRcCS; break; default: channelsArrangement = UNKNOWN; break; } numSampleFrames = StreamUtils.DecodeBEUInt32(source.ReadBytes(4)); sampleSize = (uint)StreamUtils.DecodeBEInt16(source.ReadBytes(2)); // This sample size is for uncompressed data only byte[] byteArray = source.ReadBytes(10); Array.Reverse(byteArray); double aSampleRate = StreamUtils.ExtendedToDouble(byteArray); if (format.Equals(FORMTYPE_AIFC)) { compression = Utils.Latin1Encoding.GetString(source.ReadBytes(4)); } else // AIFF <=> no compression { compression = COMPRESSION_NONE; } if (aSampleRate > 0) { sampleRate = (int)Math.Round(aSampleRate); duration = (double)numSampleFrames * 1000.0 / sampleRate; if (!compression.Equals(COMPRESSION_NONE)) // Sample size is specific to selected compression method { if (compression.ToLower().Equals("fl32")) { sampleSize = 32; } else if (compression.ToLower().Equals("fl64")) { sampleSize = 64; } else if (compression.ToLower().Equals("alaw")) { sampleSize = 8; } else if (compression.ToLower().Equals("ulaw")) { sampleSize = 8; } } if (duration > 0) { bitrate = sampleSize * numSampleFrames * channelsArrangement.NbChannels / duration; } } } else if (header.ID.Equals(CHUNKTYPE_SOUND)) { soundChunkPosition = source.BaseStream.Position - 8; soundChunkSize = header.Size + 8; } else if (header.ID.Equals(CHUNKTYPE_NAME) || header.ID.Equals(CHUNKTYPE_AUTHOR) || header.ID.Equals(CHUNKTYPE_COPYRIGHT)) { structureHelper.AddZone(source.BaseStream.Position - 8, header.Size + 8, header.ID); structureHelper.AddSize(containerChunkPos, containerChunkSize, header.ID); tagExists = true; if (header.ID.Equals(CHUNKTYPE_NAME)) { nameFound = true; } if (header.ID.Equals(CHUNKTYPE_AUTHOR)) { authorFound = true; } if (header.ID.Equals(CHUNKTYPE_COPYRIGHT)) { copyrightFound = true; } SetMetaField(header.ID, Utils.Latin1Encoding.GetString(source.ReadBytes(header.Size)), readTagParams.ReadAllMetaFrames); } else if (header.ID.Equals(CHUNKTYPE_ANNOTATION)) { annotationIndex++; structureHelper.AddZone(source.BaseStream.Position - 8, header.Size + 8, header.ID + annotationIndex); structureHelper.AddSize(containerChunkPos, containerChunkSize, header.ID + annotationIndex); if (commentStr.Length > 0) { commentStr.Append(Settings.InternalValueSeparator); } commentStr.Append(Utils.Latin1Encoding.GetString(source.ReadBytes(header.Size))); tagExists = true; } else if (header.ID.Equals(CHUNKTYPE_COMMENTS)) { commentIndex++; structureHelper.AddZone(source.BaseStream.Position - 8, header.Size + 8, header.ID + commentIndex); structureHelper.AddSize(containerChunkPos, containerChunkSize, header.ID + commentIndex); tagExists = true; commentsFound = true; ushort numComs = StreamUtils.DecodeBEUInt16(source.ReadBytes(2)); for (int i = 0; i < numComs; i++) { CommentData cmtData = new CommentData(); cmtData.Timestamp = StreamUtils.DecodeBEUInt32(source.ReadBytes(4)); cmtData.MarkerId = StreamUtils.DecodeBEInt16(source.ReadBytes(2)); // Comments length ushort comLength = StreamUtils.DecodeBEUInt16(source.ReadBytes(2)); MetaFieldInfo comment = new MetaFieldInfo(getImplementedTagType(), header.ID + commentIndex); comment.Value = Utils.Latin1Encoding.GetString(source.ReadBytes(comLength)); comment.SpecificData = cmtData; tagData.AdditionalFields.Add(comment); // Only read general purpose comments, not those linked to a marker if (0 == cmtData.MarkerId) { if (commentStr.Length > 0) { commentStr.Append(Settings.InternalValueSeparator); } commentStr.Append(comment.Value); } } } else if (header.ID.Equals(CHUNKTYPE_ID3TAG)) { id3v2Offset = source.BaseStream.Position; // Zone is already added by Id3v2.Read id3v2StructureHelper.AddZone(id3v2Offset - 8, header.Size + 8, CHUNKTYPE_ID3TAG); id3v2StructureHelper.AddSize(containerChunkPos, containerChunkSize, CHUNKTYPE_ID3TAG); } source.BaseStream.Position = position + header.Size; if (header.ID.Equals(CHUNKTYPE_SOUND) && header.Size % 2 > 0) { source.BaseStream.Position += 1; // Sound chunk size must be even } } tagData.IntegrateValue(TagData.TAG_FIELD_COMMENT, commentStr.ToString().Replace("\0", " ").Trim()); if (-1 == id3v2Offset) { id3v2Offset = 0; // Switch status to "tried to read, but nothing found" if (readTagParams.PrepareForWriting) { id3v2StructureHelper.AddZone(soundChunkPosition + soundChunkSize, 0, CHUNKTYPE_ID3TAG); id3v2StructureHelper.AddSize(containerChunkPos, containerChunkSize, CHUNKTYPE_ID3TAG); } } // Add zone placeholders for future tag writing if (readTagParams.PrepareForWriting) { if (!nameFound) { structureHelper.AddZone(soundChunkPosition, 0, CHUNKTYPE_NAME); structureHelper.AddSize(containerChunkPos, containerChunkSize, CHUNKTYPE_NAME); } if (!authorFound) { structureHelper.AddZone(soundChunkPosition, 0, CHUNKTYPE_AUTHOR); structureHelper.AddSize(containerChunkPos, containerChunkSize, CHUNKTYPE_AUTHOR); } if (!copyrightFound) { structureHelper.AddZone(soundChunkPosition, 0, CHUNKTYPE_COPYRIGHT); structureHelper.AddSize(containerChunkPos, containerChunkSize, CHUNKTYPE_COPYRIGHT); } if (!commentsFound) { structureHelper.AddZone(soundChunkPosition, 0, CHUNKTYPE_COMMENTS); structureHelper.AddSize(containerChunkPos, containerChunkSize, CHUNKTYPE_COMMENTS); } } result = true; } } return(result); }
public CefPlatformStructType(string name, CommentData comments, CefPlatform platform) : base(name + "_" + platform.ToString().ToLowerInvariant(), comments) { this.Platform = platform; baseTypeName = name; }
public void SetUp() { Data = new CommentData(); }