public ReportGen Source_PasteEE(string report) { PasteResponse paste; try { paste = PasteAPI.Upload(report); } catch (System.Exception ex) { Logger.LogError($"Failed to upload report: {ex.Message}"); throw; } var url = $"https://paste.ee/d/{paste.id}"; return(new ReportGen(url, $"RPC Report URL: {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()); } PasteResponse paste; try { paste = PasteAPI.Upload(report); } catch (Exception ex) { await PrintAsync("Failed to upload report."); Logger.LogError("Failed to upload report: {0}", ex.Message); throw; } string url = $"https://paste.ee/d/{paste.id}"; 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); } } }