void SendMetadataUpdateUpdateV2(int Change, string Project, string UserName, EventType?Event, string Comment) { UpdateMetadataRequestV2 Update = new UpdateMetadataRequestV2(); Update.Stream = MetadataStream; Update.Project = MetadataProject; Update.Change = Change; Update.UserName = UserName; if (Event != null) { switch (Event) { case EventType.Syncing: Update.Synced = true; break; case EventType.Compiles: Update.Vote = nameof(UgsUserVote.CompileSuccess); break; case EventType.DoesNotCompile: Update.Vote = nameof(UgsUserVote.CompileFailure); break; case EventType.Good: Update.Vote = nameof(UgsUserVote.Good); break; case EventType.Bad: Update.Vote = nameof(UgsUserVote.Bad); break; case EventType.Unknown: Update.Vote = nameof(UgsUserVote.None); break; case EventType.Starred: Update.Starred = true; break; case EventType.Unstarred: Update.Starred = false; break; case EventType.Investigating: Update.Investigating = true; break; case EventType.Resolved: Update.Investigating = false; break; } } Update.Comment = Comment; RESTApi.POST(ApiUrl, "metadata", new JavaScriptSerializer().Serialize(Update)); }
bool SendEventToBackend(EventData Event) { try { Stopwatch Timer = Stopwatch.StartNew(); LogWriter.WriteLine("Posting event... ({0}, {1}, {2})", Event.Change, Event.UserName, Event.Type); RESTApi.POST(ApiUrl, "event", new JavaScriptSerializer().Serialize(Event)); return(true); } catch (Exception Ex) { LogWriter.WriteException(Ex, "Failed with exception."); return(false); } }
bool SendErrorData(TelemetryErrorData Data, string Version, string IpAddress) { try { Stopwatch Timer = Stopwatch.StartNew(); LogWriter.WriteLine("Posting error data... ({0}, {1})", Data.Type, Data.Timestamp); RESTApi.POST(ApiUrl, "error", new JavaScriptSerializer().Serialize(Data), string.Format("Version={0}", Version), string.Format("IpAddress={0}", IpAddress)); LogWriter.WriteLine("Done in {0}ms.", Timer.ElapsedMilliseconds); return(true); } catch (Exception Ex) { LogWriter.WriteException(Ex, "Failed with exception."); return(false); } }
bool SendTimingData(TelemetryTimingData Data, string Version, string IpAddress) { try { Stopwatch Timer = Stopwatch.StartNew(); LogWriter.WriteLine("Posting timing data... ({0}, {1}, {2}, {3}, {4}, {5})", Data.Action, Data.Result, Data.UserName, Data.Project, Data.Timestamp, Data.Duration); RESTApi.POST(ApiUrl, "telemetry", new JavaScriptSerializer().Serialize(Data), string.Format("Version={0}", Version), string.Format("IpAddress={0}", IpAddress)); LogWriter.WriteLine("Done in {0}ms.", Timer.ElapsedMilliseconds); return(true); } catch (Exception Ex) { LogWriter.WriteException(Ex, "Failed with exception."); return(false); } }
bool SendCommentToBackend(CommentData Comment) { try { Stopwatch Timer = Stopwatch.StartNew(); LogWriter.WriteLine("Posting comment... ({0}, {1}, {2}, {3})", Comment.ChangeNumber, Comment.UserName, Comment.Text, Comment.Project); RESTApi.POST(ApiUrl, "comment", new JavaScriptSerializer().Serialize(Comment)); LogWriter.WriteLine("Done in {0}ms.", Timer.ElapsedMilliseconds); return(true); } catch (Exception Ex) { LogWriter.WriteException(Ex, "Failed with exception."); return(false); } }