public static Issue ReportCrash(string infolog, CrashType type, string engine) { try { var client = new GitHubClient(new ProductHeaderValue("chobbyla")); client.Credentials = new Credentials(GlobalConst.CrashReportGithubToken); infolog = Truncate(infolog, MaxInfologSize); var createdIssue = client.Issue.Create("ZeroK-RTS", "CrashReports", new NewIssue($"Spring {(type == CrashType.Desync ? "desync" : type == CrashType.Crash ? "crash" : "Lua error")} [{engine}]") { Body = $"```{infolog}```", }) .Result; return(createdIssue); } catch (Exception ex) { Trace.TraceWarning("Problem reporting a bug: {0}", ex); } return(null); }
public static Issue ReportCrash(string infolog, CrashType type, string engine, string bugReportTitle, string bugReportDescription) { try { var client = new GitHubClient(new ProductHeaderValue("chobbyla")); client.Credentials = new Credentials(GlobalConst.CrashReportGithubToken); infolog = Truncate(infolog, MaxInfologSize); var createdIssue = client.Issue.Create("ZeroK-RTS", "CrashReports", new NewIssue($"Spring {type} [{engine}] {bugReportTitle}") { Body = $"{bugReportDescription}\n\n```{infolog}```", }) .Result; return(createdIssue); } catch (Exception ex) { Trace.TraceWarning("Problem reporting a bug: {0}", ex); } return(null); }
// Test if no crashes are there there is only ever one state in several runs private string CreateCrashReportsFolder(CrashType type) { string crashReportPath = Path.Combine(TemporaryDirectory, type.GetDescription()); Directory.CreateDirectory(crashReportPath); return(crashReportPath); }
internal List <CrashReport> GetCrashReports(CrashType type, DateTime?from = null, DateTime?to = null, string filter = null) { if (from.HasValue) { from = NormalizeDateTime(from.Value); } if (to.HasValue) { to = NormalizeDateTime(to.Value); } var context = m_crashReportTypeContext.FirstOrDefault(f => f.Type == type); if (context.CrashReportFolderPath != null && context.CrashReportExntension != null) { var crashReportsFolder = context.CrashReportFolderPath; var crashReportExtension = context.CrashReportExntension; var filePattern = $"{type.GetDescription()}_*.{crashReportExtension}"; var crashReports = Directory.EnumerateFiles(crashReportsFolder, filePattern, SearchOption.AllDirectories); var reports = crashReports.Where(r => !r.Contains(ScrapedCrashReportFileNameSuffix)).Select(r => new CrashReport() { FileName = r, Type = type, CrashDate = ParseDateTimeFromFileName(Path.GetFileName(r)), Content = File.ReadAllText(r) }); reports = (from.HasValue || to.HasValue) ? reports.Where(report => { if (from.HasValue && to.HasValue) { return(report.CrashDate >= from.Value && report.CrashDate <= to.Value); } else if (!from.HasValue && to.HasValue) { return(report.CrashDate <= to.Value); } else { return(report.CrashDate >= from.Value); } }) : reports; return(string.IsNullOrEmpty(filter) ? reports.ToList() : reports.Where(report => report.Content.Contains(filter)).ToList()); } return(new List <CrashReport>()); }
public override int GetHashCode() { int hash = 1; if (CrashType != 0) { hash ^= CrashType.GetHashCode(); } if (Message.Length != 0) { hash ^= Message.GetHashCode(); } return(hash); }
public IHttpActionResult DeleteCrashType(int id) { CrashType crashType = UnitOfWork.Repository <CrashType>().GetById(id); if (crashType == null) { return(NotFound()); } UnitOfWork.Repository <CrashType>().Delete(crashType); UnitOfWork.Save(); return(Ok(crashType)); }
private void CreateCrashReports(string crashReportPath, CrashType type, int count, DateTime date, string contents) { var extension = type == CrashType.Kernel ? "panic" : "crash"; for (int i = 0; i < count; i++) { var fileName = date.ToString(DateTimeFormatter); var suffix = i < 2 ? $"-{i + 1}" : ""; // Create some test files e.g. BuildXL_2018-11-16-102125-1_SomeHostName.crash var reportPath = Path.Combine(crashReportPath, $"{type.GetDescription()}_{fileName}{suffix}_SomeHostName.{extension}"); File.WriteAllText(reportPath, contents); date = date.AddMinutes(i); } }
private void Crash(CrashType crashType = CrashType.COLLIDE) { crashed = true; EngineLoopAudioSource.Stop(); switch (crashType) { case CrashType.COLLIDE: OneShotAudioSource.PlayOneShot(CrashAudioClip); break; case CrashType.STOP: OneShotAudioSource.PlayOneShot(BrakeAudioClip); break; } }
/// <summary> /// Renames all crash reports of a specific type that are within a specified time range, and adds a suffix to their file name to not be re-uploaded later /// </summary> /// <param name="type">The crash report type <see cref="CrashType"/></param> /// <param name="from">The time stamp used to mark the beginning of the range</param> /// <param name="to">Yhe time stamp used to mark the end of the range</param> internal void RenameCrashReportsWithinRange(CrashType type, DateTime from, DateTime to) { Contract.Requires(from < to); from = NormalizeDateTime(from); to = NormalizeDateTime(to); var context = m_crashReportTypeContext.FirstOrDefault(f => f.Type == type); if (context.FetchFunc != null) { var reports = context.FetchFunc(context.Type, from, to, context.CrashReportFilter); reports.Where(r => r.CrashDate >= from && r.CrashDate <= to).ToList().ForEach(report => { var path = Path.GetDirectoryName(report.FileName); var fileName = Path.GetFileNameWithoutExtension(report.FileName); var extension = Path.GetExtension(report.FileName); File.Move(report.FileName, Path.Combine(path, fileName + ScrapedCrashReportFileNameSuffix + extension)); }); } }
public CrashType Move() { if (this.increaseBy == 0) { Point tail = this.bodyParts.Dequeue(); snakePit.ClearCell(tail); } else { this.increaseBy--; } this.head.X += this.xSpeed; this.head.Y += this.ySpeed; if (this.DoesIntersect(this.head)) { Console.WriteLine("!!!SELF CRASH!!!"); return(CrashType.Self); } this.bodyParts.Enqueue(this.head); snakePit.SetCell(this.head, this.col); CrashType crash = this.snakePit.IsCrash(head); return(crash); }