public ReportGen Source_Haste(string report) { HasteAPI haste = new HasteAPI(); string url = haste.Upload(report); return(new ReportGen() { Message = $"Report URL: {url}", ReportURL = url }); }
protected override async Task OnExecuteAsync() { await PrintAsync("Generating report..."); await UniTask.SwitchToThreadPool(); string report; using (MemoryStream stream = new MemoryStream()) { RPCReportGenerator gen = new RPCReportGenerator(stream); gen.WriteReport(RPCDetectorCore.Logger); report = Encoding.UTF8.GetString(stream.ToArray()); } string url; HasteAPI haste = new HasteAPI(); try { url = haste.Upload(report); } catch (Exception ex) { await PrintAsync("Failed to upload report."); Logger.LogError("Failed to upload report: {0}", ex.Message); throw; } await UniTask.SwitchToMainThread(); await PrintAsync($"RPC Report URL: {url}"); if (Context.Actor is UnturnedUser uu) { if (uu.Player != null) { uu.Player?.Player?.sendBrowserRequest("Open RPC Report", url); } } }