using Penumbra.CrashHandler.Buffers;
namespace Penumbra.CrashHandler;
/// A base entry for crash data.
public interface ICrashDataEntry
{
/// The timestamp of the event.
DateTimeOffset Timestamp { get; }
/// The thread invoking the event.
int ThreadId { get; }
/// The age of the event compared to the crash. (Redundantly with the timestamp)
double Age { get; }
}
/// A full set of crash data.
public class CrashData
{
/// The mode this data was obtained - manually or from a crash.
public string Mode { get; set; } = "Unknown";
/// The time this crash data was generated.
public DateTimeOffset CrashTime { get; set; } = DateTimeOffset.UnixEpoch;
/// Penumbra's Version when this crash data was created.
public string Version { get; set; } = string.Empty;
/// The Game's Version when this crash data was created.
public string GameVersion { get; set; } = string.Empty;
/// The FFXIV process ID when this data was generated.
public int ProcessId { get; set; } = 0;
/// The FFXIV Exit Code (if any) when this data was generated.
public int ExitCode { get; set; } = 0;
/// The total amount of characters loaded during this session.
public int TotalCharactersLoaded { get; set; } = 0;
/// The total amount of modded files loaded during this session.
public int TotalModdedFilesLoaded { get; set; } = 0;
/// The total amount of vfx functions invoked during this session.
public int TotalVFXFuncsInvoked { get; set; } = 0;
/// The last character loaded before this crash data was generated.
public CharacterLoadedEntry? LastCharacterLoaded
=> LastCharactersLoaded.Count == 0 ? default : LastCharactersLoaded[0];
/// The last modded file loaded before this crash data was generated.
public ModdedFileLoadedEntry? LastModdedFileLoaded
=> LastModdedFilesLoaded.Count == 0 ? default : LastModdedFilesLoaded[0];
/// The last vfx function invoked before this crash data was generated.
public VfxFuncInvokedEntry? LastVfxFuncInvoked
=> LastVfxFuncsInvoked.Count == 0 ? default : LastVfxFuncsInvoked[0];
/// A collection of the last few characters loaded before this crash data was generated.
public List LastCharactersLoaded { get; set; } = [];
/// A collection of the last few modded files loaded before this crash data was generated.
public List LastModdedFilesLoaded { get; set; } = [];
/// A collection of the last few vfx functions invoked before this crash data was generated.
public List LastVfxFuncsInvoked { get; set; } = [];
}