-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCrashPoster.cs
More file actions
35 lines (31 loc) · 1008 Bytes
/
CrashPoster.cs
File metadata and controls
35 lines (31 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using BugSplatDotNetStandard;
using BugSplatDotNetStandard.Http;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
namespace BugSplatCrashHandler
{
public class CrashPoster
{
private BugSplat bugsplat;
public CrashPoster (BugSplat bugsplat)
{
this.bugsplat = bugsplat;
}
public void PostCrashAndDisplaySupportResponseIfAvailable(FileInfo crashReportFile, BugSplatPostOptions options)
{
var body = Task.Run(async () =>
{
var response = await bugsplat.Post(crashReportFile, options);
var content = await response.Content.ReadAsStringAsync();
return content;
}).Result;
var json = new JsonObject(body);
var infoUrl = json.GetValue(new string[] { "infoUrl" });
if (!string.IsNullOrEmpty(infoUrl))
{
Process.Start(infoUrl);
}
}
}
}