internal static void DumpTraceReport() { try { ReportListener reporter = Trace.Listeners.Cast <TraceListener>().Where(tl => tl is ReportListener).FirstOrDefault() as ReportListener; File.WriteAllText(Path.Combine(Configuration.LocalPath, "report.txt"), string.Join("\n", reporter.Messages.Select(m => string.Format("<{0}> {1}: {2}", m.Timestamp, m.Category, m.Message)).ToArray())); } catch (Exception e) { } }
internal static void SubmitCrashReport() { StringBuilder diag = new StringBuilder(); diag.AppendLine("Application:\n" + Application.ProductName); diag.AppendLine("\nVersion:\n" + Application.ProductVersion); diag.AppendLine("\nDate:\n" + DateTime.Now.ToUniversalTime().ToString() + " UTC"); diag.AppendLine("\nOperating System:\n" + Environment.OSVersion.VersionString); diag.AppendLine("\nPlatform:\n" + (IntPtr.Size == 8 ? "64" : "32") + " bit"); diag.AppendLine("\nRunning As:\n" + (isElevated ? "Administrator" : "Standard User")); diag.AppendLine("\nFramework Version:\n" + FrameworkVersion); diag.AppendLine("\nUAC Enabled:\n" + UACEnabled); ReportListener reporter = Trace.Listeners.Cast <TraceListener>().Where(tl => tl is ReportListener).FirstOrDefault() as ReportListener; diag.AppendLine("\nDebug Log:\n" + string.Join("\n", string.Join("\n", reporter.Messages.Select(m => string.Format("<{0}> {1}: {2}", m.Timestamp, m.Category, m.Message)).ToArray()))); UploadReport("http://factormystic.net/prosnap/feedback/report.php", Crash.Gzip(diag.ToString())); }