private void SubmitBugReport(string email, Exception exc)
{
try {
const string url = UpdateChecker.UpdateCheckHost + "tool/report_bug";
WebClient wc = new WebClient();
wc.Proxy = null;
var data = new NameValueCollection();
data.Set("renderer_version", typeof(Map).Assembly.GetName().Version.ToString());
data.Set("exception", exc == null ? "" : exc.ToString());
data.Set("input_map", File.ReadAllText(tbInput.Text));
data.Set("input_name", Path.GetFileName(tbInput.Text));
data.Set("commandline", GetCommandLine());
data.Set("log_text", rtbLog.Text);
data.Set("email", email);
wc.OpenWriteCompleted += (o, args) => UpdateStatus("sending bug report.. connected", 15);
wc.UploadProgressChanged += (o, args) => {
double pct = 15 + Math.Round(85.0 * (args.TotalBytesToSend / args.BytesSent) / 100.0, 0);
UpdateStatus("sending bug report.. uploading " + pct + "%", (int)pct);
};
wc.UploadValuesCompleted += (o, args) => {
if (args.Cancelled || args.Error != null)
BugReportFailed();
else
UpdateStatus("bug report sent", 100);
};
wc.UploadValuesAsync(new Uri(url), "POST", data);
UpdateStatus("sending bug report.. ", 5);
}
catch {
BugReportFailed();
}
}