diff --git a/src/Gml.Client/Helpers/SystemIOProcedures.cs b/src/Gml.Client/Helpers/SystemIOProcedures.cs index c89fd78..8b35560 100644 --- a/src/Gml.Client/Helpers/SystemIOProcedures.cs +++ b/src/Gml.Client/Helpers/SystemIOProcedures.cs @@ -62,13 +62,15 @@ public Task RemoveFiles(ProfileReadInfoDto profileInfo) { try { - string[] allowedPaths = + List allowedPaths = [ Path.Combine(_installationDirectory, "clients", profileInfo.ProfileName, "saves"), Path.Combine(_installationDirectory, "clients", profileInfo.ProfileName, "logs"), Path.Combine(_installationDirectory, "clients", profileInfo.ProfileName, "crash-reports") ]; + allowedPaths.AddRange(profileInfo.WhiteListFolders.Select(path => Path.Combine(_installationDirectory, "clients", profileInfo.ProfileName, Path.Combine(path.Path.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries))))); + var profilePath = Path.Combine(_installationDirectory, "clients", profileInfo.ProfileName); var directoryInfo = new DirectoryInfo(profilePath); diff --git a/src/Gml.Client/IGmlClientManager.cs b/src/Gml.Client/IGmlClientManager.cs index db94c28..d44e358 100644 --- a/src/Gml.Client/IGmlClientManager.cs +++ b/src/Gml.Client/IGmlClientManager.cs @@ -28,7 +28,6 @@ public interface IGmlClientManager : IDisposable Task GetActualVersion(OsType osType, Architecture osArch); Task UpdateCurrentLauncher((IVersionFile? ActualVersion, bool IsActuallVersion) versionInfo, OsType osType, string originalFileName); - Task OpenServerConnection(IUser user); void ChangeInstallationFolder(string installationDirectory); } diff --git a/src/Gml.Core.Interfaces/Bootstrap/IBootstrapProgram.cs b/src/Gml.Core.Interfaces/Bootstrap/IBootstrapProgram.cs new file mode 100644 index 0000000..8419367 --- /dev/null +++ b/src/Gml.Core.Interfaces/Bootstrap/IBootstrapProgram.cs @@ -0,0 +1,8 @@ +namespace GmlCore.Interfaces.Bootstrap; + +public interface IBootstrapProgram +{ + string Name { get; set; } + string Version { get; set; } + int MajorVersion { get; set; } +} diff --git a/src/Gml.Core.Interfaces/Enums/AuthType.cs b/src/Gml.Core.Interfaces/Enums/AuthType.cs index 51356bc..c6f9907 100644 --- a/src/Gml.Core.Interfaces/Enums/AuthType.cs +++ b/src/Gml.Core.Interfaces/Enums/AuthType.cs @@ -9,4 +9,5 @@ public enum AuthType EasyCabinet = 4, UnicoreCMS = 5, CustomEndpoint = 6, + NamelessMC = 7, } diff --git a/src/Gml.Core.Interfaces/IGmlManager.cs b/src/Gml.Core.Interfaces/IGmlManager.cs index 1a356c7..ac7f5c6 100644 --- a/src/Gml.Core.Interfaces/IGmlManager.cs +++ b/src/Gml.Core.Interfaces/IGmlManager.cs @@ -7,6 +7,7 @@ namespace GmlCore.Interfaces public interface IGmlManager { public ILauncherInfo LauncherInfo { get; } + public IBugTrackerProcedures BugTracker { get; } public IProfileProcedures Profiles { get; } public IFileStorageProcedures Files { get; } public IServicesIntegrationProcedures Integrations { get; } diff --git a/src/Gml.Core.Interfaces/Launcher/IBugInfo.cs b/src/Gml.Core.Interfaces/Launcher/IBugInfo.cs new file mode 100644 index 0000000..e3f5da4 --- /dev/null +++ b/src/Gml.Core.Interfaces/Launcher/IBugInfo.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using GmlCore.Interfaces.Sentry; + +namespace GmlCore.Interfaces.Launcher; + +public interface IBugInfo +{ + string Id { get; set; } + public string? PcName { get; set; } + public string? Username { get; set; } + public IMemoryInfo? MemoryInfo { get; set; } + public IEnumerable? Exceptions { get; set; } + public DateTime SendAt { get; set; } + public string? IpAddress { get; set; } + public string? OsVeriosn { get; set; } + public string? OsIdentifier { get; set; } +} diff --git a/src/Gml.Core.Interfaces/Launcher/IGameProfile.cs b/src/Gml.Core.Interfaces/Launcher/IGameProfile.cs index 09f3662..009edf2 100644 --- a/src/Gml.Core.Interfaces/Launcher/IGameProfile.cs +++ b/src/Gml.Core.Interfaces/Launcher/IGameProfile.cs @@ -28,9 +28,11 @@ public interface IGameProfile : IDisposable string BackgroundImageKey { get; set; } string Description { get; set; } List? FileWhiteList { get; set; } + List? FolderWhiteList { get; set; } List Servers { get; set; } DateTimeOffset CreateDate { get; set; } string? JvmArguments { get; set; } + string? GameArguments { get; set; } ProfileState State { get; set; } Task ValidateProfile(); @@ -46,6 +48,6 @@ public interface IGameProfile : IDisposable void RemoveServer(IProfileServer server); Task CreateModsFolder(); Task> GetProfileFiles(string osName, string osArchitecture); - Task GetAllProfileFiles(); + Task GetAllProfileFiles(bool needRestoreCache); } } diff --git a/src/Gml.Core.Interfaces/Launcher/IGmlSettings.cs b/src/Gml.Core.Interfaces/Launcher/IGmlSettings.cs index aa75a3d..6ea4aa0 100644 --- a/src/Gml.Core.Interfaces/Launcher/IGmlSettings.cs +++ b/src/Gml.Core.Interfaces/Launcher/IGmlSettings.cs @@ -1,3 +1,4 @@ +using System.Net.Http; using GmlCore.Interfaces.Enums; using GmlCore.Interfaces.Procedures; using GmlCore.Interfaces.Storage; @@ -9,6 +10,7 @@ public interface IGmlSettings public string Name { get; } public string BaseDirectory { get; } public string InstallationDirectory { get; } + public HttpClient HttpClient { get; } IStorageSettings StorageSettings { get; set; } string SecurityKey { get; set; } ISystemProcedures SystemProcedures { get; } diff --git a/src/Gml.Core.Interfaces/Mods/IMod.cs b/src/Gml.Core.Interfaces/Mods/IMod.cs new file mode 100644 index 0000000..6f9e5c5 --- /dev/null +++ b/src/Gml.Core.Interfaces/Mods/IMod.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.IO; + +namespace GmlCore.Interfaces.Mods; + +public interface IMod +{ + string Name { get; set; } + string Url { get; set; } + Stream Icon { get; set; } + IEnumerable Files { get; set; } + IEnumerable Dependencies { get; set; } +} diff --git a/src/Gml.Core.Interfaces/Procedures/IBugTrackerProcedures.cs b/src/Gml.Core.Interfaces/Procedures/IBugTrackerProcedures.cs new file mode 100644 index 0000000..dbfa239 --- /dev/null +++ b/src/Gml.Core.Interfaces/Procedures/IBugTrackerProcedures.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using GmlCore.Interfaces.Launcher; + +namespace GmlCore.Interfaces.Procedures; + +public interface IBugTrackerProcedures +{ + void CaptureException(IBugInfo bugInfo); + Task> GetAllBugs(); + Task GetBugId(string id); +} diff --git a/src/Gml.Core.Interfaces/Procedures/IGameDownloaderProcedures.cs b/src/Gml.Core.Interfaces/Procedures/IGameDownloaderProcedures.cs index 3d2306e..89770d1 100644 --- a/src/Gml.Core.Interfaces/Procedures/IGameDownloaderProcedures.cs +++ b/src/Gml.Core.Interfaces/Procedures/IGameDownloaderProcedures.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Threading.Tasks; +using GmlCore.Interfaces.Bootstrap; using GmlCore.Interfaces.Enums; using GmlCore.Interfaces.Launcher; using GmlCore.Interfaces.System; @@ -17,9 +18,11 @@ public interface IGameDownloaderProcedures IObservable LoadLog { get;} IObservable LoadException { get;} - Task DownloadGame(string version, string? launchVersion, GameLoader loader); - Task CreateProcess(IStartupOptions startupOptions, IUser user, bool needDownload, string[] jvmArguments); - Task GetAllFiles(); + Task DownloadGame(string version, string? launchVersion, GameLoader loader, + IBootstrapProgram? bootstrapProgram); + Task CreateProcess(IStartupOptions startupOptions, IUser user, bool needDownload, + string[] jvmArguments, string[] gameArguments); + Task GetAllFiles(bool needRestoreCache); bool GetLauncher(string launcherKey, out object launcher); Task> GetLauncherFiles(string osName, string osArchitecture); } diff --git a/src/Gml.Core.Interfaces/Procedures/ILauncherProcedures.cs b/src/Gml.Core.Interfaces/Procedures/ILauncherProcedures.cs index a028f25..87ab123 100644 --- a/src/Gml.Core.Interfaces/Procedures/ILauncherProcedures.cs +++ b/src/Gml.Core.Interfaces/Procedures/ILauncherProcedures.cs @@ -10,7 +10,7 @@ namespace GmlCore.Interfaces.Procedures; public interface ILauncherProcedures { Task CreateVersion(IVersionFile version, ILauncherBuild launcherBuild); - Task Build(string version, string[] versions); + Task Build(string version, string[] osNameVersions); IObservable BuildLogs { get; } bool CanCompile(string version, out string message); Task> GetPlatforms(); diff --git a/src/Gml.Core.Interfaces/Procedures/IModsProcedures.cs b/src/Gml.Core.Interfaces/Procedures/IModsProcedures.cs new file mode 100644 index 0000000..df674a0 --- /dev/null +++ b/src/Gml.Core.Interfaces/Procedures/IModsProcedures.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using GmlCore.Interfaces.Launcher; +using GmlCore.Interfaces.Mods; + +namespace GmlCore.Interfaces.Procedures; + +public interface IModsProcedures +{ + Task> GetModsAsync(IGameProfile profile); + Task> GetModsAsync(IGameProfile profile, string name); +} diff --git a/src/Gml.Core.Interfaces/Procedures/INotificationProcedures.cs b/src/Gml.Core.Interfaces/Procedures/INotificationProcedures.cs index a18270a..34a190d 100644 --- a/src/Gml.Core.Interfaces/Procedures/INotificationProcedures.cs +++ b/src/Gml.Core.Interfaces/Procedures/INotificationProcedures.cs @@ -15,4 +15,5 @@ public interface INotificationProcedures Task SendMessage(string message, NotificationType type); Task SendMessage(string message, Exception exception); Task Retore(); + Task Clear(); } diff --git a/src/Gml.Core.Interfaces/Procedures/IProfileProcedures.cs b/src/Gml.Core.Interfaces/Procedures/IProfileProcedures.cs index 2a26935..28a5635 100644 --- a/src/Gml.Core.Interfaces/Procedures/IProfileProcedures.cs +++ b/src/Gml.Core.Interfaces/Procedures/IProfileProcedures.cs @@ -4,6 +4,7 @@ using System.IO; using System.Threading.Tasks; using Gml.Web.Api.Domains.System; +using GmlCore.Interfaces.Bootstrap; using GmlCore.Interfaces.Enums; using GmlCore.Interfaces.Launcher; using GmlCore.Interfaces.System; @@ -16,6 +17,7 @@ public interface IProfileProcedures public delegate void ProgressPackChanged(ProgressChangedEventArgs e); IObservable PackChanged { get; } + IObservable ProfilesChanged { get; } Task AddProfile(IGameProfile? profile); Task AddProfile(string name, string version, string loaderVersion, GameLoader loader, @@ -31,7 +33,7 @@ public interface IProfileProcedures Task ValidateProfileAsync(IGameProfile baseProfile); bool ValidateProfile(); Task SaveProfiles(); - Task DownloadProfileAsync(IGameProfile baseProfile); + Task DownloadProfileAsync(IGameProfile baseProfile, IBootstrapProgram? version = default); Task> GetProfileFiles(IGameProfile baseProfile); Task GetProfile(string profileName); Task> GetProfiles(); @@ -42,13 +44,18 @@ public interface IProfileProcedures Task RemoveFileFromWhiteList(IGameProfile profile, IFileInfo file); Task UpdateProfile(IGameProfile profile, string newProfileName, Stream? icon, Stream? backgroundImage, string updateDtoDescription, bool isEnabled, - string jvmArguments); + string jvmArguments, string gameArguments); Task InstallAuthLib(IGameProfile profile); Task GetCacheProfile(IGameProfile baseProfile); Task SetCacheProfile(IGameProfileInfo profile); Task CreateModsFolder(IGameProfile profile); Task> GetProfileFiles(IGameProfile profile, string osName, string osArchitecture); - Task GetAllProfileFiles(IGameProfile baseProfile); + Task GetAllProfileFiles(IGameProfile baseProfile, bool needRestoreCache); Task> GetAllowVersions(GameLoader result, string? minecraftVersion); + Task ChangeBootstrapProgram(IGameProfile testGameProfile, IBootstrapProgram version); + Task AddFolderToWhiteList(IGameProfile profile, IFolderInfo folder); + Task RemoveFolderFromWhiteList(IGameProfile profile, IFolderInfo folder); + Task RemoveFolderFromWhiteList(IGameProfile profile, IEnumerable folders); + Task AddFolderToWhiteList(IGameProfile profile, IEnumerable folders); } } diff --git a/src/Gml.Core.Interfaces/Procedures/ISystemProcedures.cs b/src/Gml.Core.Interfaces/Procedures/ISystemProcedures.cs index 5759875..e5d1143 100644 --- a/src/Gml.Core.Interfaces/Procedures/ISystemProcedures.cs +++ b/src/Gml.Core.Interfaces/Procedures/ISystemProcedures.cs @@ -1,5 +1,7 @@ +using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; +using GmlCore.Interfaces.Bootstrap; using GmlCore.Interfaces.Launcher; namespace GmlCore.Interfaces.Procedures @@ -17,5 +19,6 @@ public interface ISystemProcedures Task DownloadFileAsync(string url, string destinationFilePath); void ExtractZipFile(string zipFilePath, string extractPath); void SetFileExecutable(string filePath); + Task> GetJavaVersions(); } } diff --git a/src/Gml.Core.Interfaces/Sentry/IExceptionReport.cs b/src/Gml.Core.Interfaces/Sentry/IExceptionReport.cs new file mode 100644 index 0000000..e8d285f --- /dev/null +++ b/src/Gml.Core.Interfaces/Sentry/IExceptionReport.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace GmlCore.Interfaces.Sentry; + +public interface IExceptionReport +{ + public string Type { get; set; } + public string ValueData { get; set; } + public string Module { get; set; } + public int ThreadId { get; set; } + public int Id { get; set; } + public bool Crashed { get; set; } + public bool Current { get; set; } + public IEnumerable StackTrace { get; set; } +} diff --git a/src/Gml.Core.Interfaces/Sentry/IMemoryInfo.cs b/src/Gml.Core.Interfaces/Sentry/IMemoryInfo.cs new file mode 100644 index 0000000..b23824d --- /dev/null +++ b/src/Gml.Core.Interfaces/Sentry/IMemoryInfo.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace GmlCore.Interfaces.Sentry; + +public interface IMemoryInfo +{ + public long AllocatedBytes { get; set; } + public long HighMemoryLoadThresholdBytes { get; set; } + public long TotalAvailableMemoryBytes { get; set; } + public int FinalizationPendingCount { get; set; } + public bool Compacted { get; set; } + public bool Concurrent { get; set; } + public List PauseDurations { get; set; } +} diff --git a/src/Gml.Core.Interfaces/Sentry/IStackTrace.cs b/src/Gml.Core.Interfaces/Sentry/IStackTrace.cs new file mode 100644 index 0000000..46c2c70 --- /dev/null +++ b/src/Gml.Core.Interfaces/Sentry/IStackTrace.cs @@ -0,0 +1,15 @@ +namespace GmlCore.Interfaces.Sentry; + +public interface IStackTrace +{ + public string Filename { get; set; } + public string Function { get; set; } + public int Lineno { get; set; } + public int Colno { get; set; } + public string AbsPath { get; set; } + public bool InApp { get; set; } + public string Package { get; set; } + public string InstructionAddr { get; set; } + public string AddrMode { get; set; } + public string FunctionId { get; set; } +} diff --git a/src/Gml.Core.Interfaces/System/IFolderInfo.cs b/src/Gml.Core.Interfaces/System/IFolderInfo.cs new file mode 100644 index 0000000..a9cd466 --- /dev/null +++ b/src/Gml.Core.Interfaces/System/IFolderInfo.cs @@ -0,0 +1,6 @@ +namespace GmlCore.Interfaces.System; + +public interface IFolderInfo +{ + public string Path { get; set; } +} diff --git a/src/Gml.Web.Api.Domains/Sentry/SentryBugs.cs b/src/Gml.Web.Api.Domains/Sentry/SentryBugs.cs new file mode 100644 index 0000000..7301506 --- /dev/null +++ b/src/Gml.Web.Api.Domains/Sentry/SentryBugs.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using GmlCore.Interfaces.Launcher; + +namespace Gml.Web.Api.Domains.Sentry; + +public class SentryBugs +{ + public string Exception { get; set; } + public long Users { get; set; } + public long Errors { get; set; } + public IEnumerable Bugs { get; set; } +} diff --git a/src/Gml.Web.Api.Dto/Files/FolderWhiteListDto.cs b/src/Gml.Web.Api.Dto/Files/FolderWhiteListDto.cs new file mode 100644 index 0000000..a434ea8 --- /dev/null +++ b/src/Gml.Web.Api.Dto/Files/FolderWhiteListDto.cs @@ -0,0 +1,9 @@ +using GmlCore.Interfaces.System; + +namespace Gml.Web.Api.Dto.Files; + +public class FolderWhiteListDto +{ + public string ProfileName { get; set; } + public string Path { get; set; } +} diff --git a/src/Gml.Web.Api.Dto/Files/ProfileFolderReadDto.cs b/src/Gml.Web.Api.Dto/Files/ProfileFolderReadDto.cs new file mode 100644 index 0000000..f224c07 --- /dev/null +++ b/src/Gml.Web.Api.Dto/Files/ProfileFolderReadDto.cs @@ -0,0 +1,6 @@ +namespace Gml.Web.Api.Dto.Files; + +public class ProfileFolderReadDto +{ + public string Path { get; set; } +} diff --git a/src/Gml.Web.Api.Dto/Gml.Web.Api.Dto.csproj b/src/Gml.Web.Api.Dto/Gml.Web.Api.Dto.csproj index bee82e2..0a4a447 100644 --- a/src/Gml.Web.Api.Dto/Gml.Web.Api.Dto.csproj +++ b/src/Gml.Web.Api.Dto/Gml.Web.Api.Dto.csproj @@ -13,5 +13,4 @@ - diff --git a/src/Gml.Web.Api.Dto/Profile/ProfileReadDto.cs b/src/Gml.Web.Api.Dto/Profile/ProfileReadDto.cs index 634d939..5c6a705 100644 --- a/src/Gml.Web.Api.Dto/Profile/ProfileReadDto.cs +++ b/src/Gml.Web.Api.Dto/Profile/ProfileReadDto.cs @@ -15,6 +15,7 @@ public class ProfileReadDto public string IconBase64 { get; set; } public string Background { get; set; } public string JvmArguments { get; set; } + public string GameArguments { get; set; } public ProfileState State { get; set; } public int Loader { get; set; } public List Servers { get; set; } = []; diff --git a/src/Gml.Web.Api.Dto/Profile/ProfileReadInfoDto.cs b/src/Gml.Web.Api.Dto/Profile/ProfileReadInfoDto.cs index 343693a..9e78159 100644 --- a/src/Gml.Web.Api.Dto/Profile/ProfileReadInfoDto.cs +++ b/src/Gml.Web.Api.Dto/Profile/ProfileReadInfoDto.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Gml.Web.Api.Dto.Files; using GmlCore.Interfaces.Enums; +using GmlCore.Interfaces.System; namespace Gml.Web.Api.Dto.Profile; @@ -15,9 +16,11 @@ public class ProfileReadInfoDto public string Description { get; set; } public string Arguments { get; set; } public string JvmArguments { get; set; } + public string GameArguments { get; set; } public bool HasUpdate { get; set; } public ProfileState State { get; set; } public List Files { get; set; } + public List WhiteListFolders { get; set; } public List WhiteListFiles { get; set; } public string Background { get; set; } } diff --git a/src/Gml.Web.Api.Dto/Profile/ProfileUpdateDto.cs b/src/Gml.Web.Api.Dto/Profile/ProfileUpdateDto.cs index 69c749f..9688331 100644 --- a/src/Gml.Web.Api.Dto/Profile/ProfileUpdateDto.cs +++ b/src/Gml.Web.Api.Dto/Profile/ProfileUpdateDto.cs @@ -9,4 +9,5 @@ public class ProfileUpdateDto public string IconBase64 { get; set; } = null!; public string BackgroundImageKey { get; set; } public string JvmArguments { get; set; } + public string GameArguments { get; set; } } diff --git a/src/Gml.Web.Api.Dto/Sentry/BaseSentryError.cs b/src/Gml.Web.Api.Dto/Sentry/BaseSentryError.cs new file mode 100644 index 0000000..af45605 --- /dev/null +++ b/src/Gml.Web.Api.Dto/Sentry/BaseSentryError.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using Gml.Web.Api.Domains.Sentry; + +namespace Gml.Web.Api.Dto.Sentry; + +public class BaseSentryError +{ + public IEnumerable Bugs { get; set; } + public long CountUsers { get; set; } + public long Count { get; set; } +} diff --git a/src/Gml.Web.Api.Dto/Sentry/SentryEventDto.cs b/src/Gml.Web.Api.Dto/Sentry/SentryEventDto.cs new file mode 100644 index 0000000..974a575 --- /dev/null +++ b/src/Gml.Web.Api.Dto/Sentry/SentryEventDto.cs @@ -0,0 +1,43 @@ +using System; +using Newtonsoft.Json; + +namespace Gml.Web.Api.Dto.Sentry; + +public class SentryEventDto +{ + [JsonProperty("sdk")] + public Sdk Sdk { get; set; } + + [JsonProperty("event_id")] + public string EventId { get; set; } + + [JsonProperty("trace")] + public Trace Trace { get; set; } + + [JsonProperty("sent_at")] + public DateTime SentAt { get; set; } +} + +public class Sdk +{ + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("version")] + public string Version { get; set; } +} + +public class Trace +{ + [JsonProperty("trace_id")] + public string TraceId { get; set; } + + [JsonProperty("public_key")] + public string PublicKey { get; set; } + + [JsonProperty("release")] + public string Release { get; set; } + + [JsonProperty("environment")] + public string Environment { get; set; } +} diff --git a/src/Gml.Web.Api.Dto/Sentry/SentryEventLengthDto.cs b/src/Gml.Web.Api.Dto/Sentry/SentryEventLengthDto.cs new file mode 100644 index 0000000..d718b3c --- /dev/null +++ b/src/Gml.Web.Api.Dto/Sentry/SentryEventLengthDto.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; + +namespace Gml.Web.Api.Dto.Sentry; + +public class SentryEventLengthDto +{ + + [JsonProperty("type")] + public string Type { get; set; } + + [JsonProperty("length")] + public int Length { get; set; } +} diff --git a/src/Gml.Web.Api.Dto/Sentry/SentryModulesDto.cs b/src/Gml.Web.Api.Dto/Sentry/SentryModulesDto.cs new file mode 100644 index 0000000..0b2620e --- /dev/null +++ b/src/Gml.Web.Api.Dto/Sentry/SentryModulesDto.cs @@ -0,0 +1,353 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Gml.Web.Api.Dto.Sentry; + +public class App +{ + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("app_start_time")] public DateTime AppStartTime { get; set; } + + [JsonProperty("in_foreground")] public bool InForeground { get; set; } +} + +public class Contexts +{ + [JsonProperty("Current Culture")] public CurrentCulture CurrentCulture { get; set; } + + [JsonProperty("Current UI Culture")] public CurrentUICulture CurrentUICulture { get; set; } + + [JsonProperty("Dynamic Code")] public DynamicCode DynamicCode { get; set; } + + [JsonProperty("Memory Info")] public MemoryInfo MemoryInfo { get; set; } + + [JsonProperty("ThreadPool Info")] public ThreadPoolInfo ThreadPoolInfo { get; set; } + + [JsonProperty("app")] public App App { get; set; } + + [JsonProperty("device")] public Device Device { get; set; } + + [JsonProperty("os")] public Os Os { get; set; } + + [JsonProperty("runtime")] public Runtime Runtime { get; set; } + + [JsonProperty("trace")] public Trace Trace { get; set; } +} + +public class CurrentCulture +{ + [JsonProperty("name")] public string Name { get; set; } + + [JsonProperty("display_name")] public string DisplayName { get; set; } + + [JsonProperty("calendar")] public string Calendar { get; set; } +} + +public class CurrentUICulture +{ + [JsonProperty("name")] public string Name { get; set; } + + [JsonProperty("display_name")] public string DisplayName { get; set; } + + [JsonProperty("calendar")] public string Calendar { get; set; } +} + +public class DebugMeta +{ + [JsonProperty("images")] public List Images { get; set; } +} + +public class Device +{ + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("timezone")] public string Timezone { get; set; } + + [JsonProperty("timezone_display_name")] + public string TimezoneDisplayName { get; set; } + + [JsonProperty("boot_time")] public DateTime BootTime { get; set; } +} + +public class DynamicCode +{ + [JsonProperty("Compiled")] public bool Compiled { get; set; } + + [JsonProperty("Supported")] public bool Supported { get; set; } +} + +public class Exception +{ + [JsonProperty("values")] public List Values { get; set; } +} + +public class Frame +{ + [JsonProperty("filename")] public string Filename { get; set; } + + [JsonProperty("function")] public string Function { get; set; } + + [JsonProperty("lineno")] public int Lineno { get; set; } + + [JsonProperty("colno")] public int Colno { get; set; } + + [JsonProperty("abs_path")] public string AbsPath { get; set; } + + [JsonProperty("in_app")] public bool InApp { get; set; } + + [JsonProperty("package")] public string Package { get; set; } + + [JsonProperty("instruction_addr")] public string InstructionAddr { get; set; } + + [JsonProperty("addr_mode")] public string AddrMode { get; set; } + + [JsonProperty("function_id")] public string FunctionId { get; set; } +} + +public class Image +{ + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("debug_id")] public string DebugId { get; set; } + + [JsonProperty("debug_checksum")] public string DebugChecksum { get; set; } + + [JsonProperty("debug_file")] public string DebugFile { get; set; } + + [JsonProperty("code_id")] public string CodeId { get; set; } + + [JsonProperty("code_file")] public string CodeFile { get; set; } +} + +public class MemoryInfo +{ + [JsonProperty("allocated_bytes")] public long AllocatedBytes { get; set; } + + [JsonProperty("high_memory_load_threshold_bytes")] + public long HighMemoryLoadThresholdBytes { get; set; } + + [JsonProperty("total_available_memory_bytes")] + public long TotalAvailableMemoryBytes { get; set; } + + [JsonProperty("finalization_pending_count")] + public int FinalizationPendingCount { get; set; } + + [JsonProperty("compacted")] public bool Compacted { get; set; } + + [JsonProperty("concurrent")] public bool Concurrent { get; set; } + + [JsonProperty("pause_durations")] public List PauseDurations { get; set; } +} + +public class Modules +{ + [JsonProperty("System.Private.CoreLib")] + public string SystemPrivateCoreLib { get; set; } + + [JsonProperty("Sentry.Test")] public string SentryTest { get; set; } + + [JsonProperty("System.Runtime")] public string SystemRuntime { get; set; } + + [JsonProperty("Sentry")] public string Sentry { get; set; } + + [JsonProperty("System.Net.Primitives")] + public string SystemNetPrimitives { get; set; } + + [JsonProperty("System.IO.Compression")] + public string SystemIOCompression { get; set; } + + [JsonProperty("System.Text.Json")] public string SystemTextJson { get; set; } + + [JsonProperty("System.Collections")] public string SystemCollections { get; set; } + + [JsonProperty("System.Text.RegularExpressions")] + public string SystemTextRegularExpressions { get; set; } + + [JsonProperty("System.Reflection.Emit.Lightweight")] + public string SystemReflectionEmitLightweight { get; set; } + + [JsonProperty("System.Threading")] public string SystemThreading { get; set; } + + [JsonProperty("System.Reflection.Emit.ILGeneration")] + public string SystemReflectionEmitILGeneration { get; set; } + + [JsonProperty("System.Memory")] public string SystemMemory { get; set; } + + [JsonProperty("System.Reflection.Primitives")] + public string SystemReflectionPrimitives { get; set; } + + [JsonProperty("System.Linq")] public string SystemLinq { get; set; } + + [JsonProperty("System.Console")] public string SystemConsole { get; set; } + + [JsonProperty("System.Text.Encoding.Extensions")] + public string SystemTextEncodingExtensions { get; set; } + + [JsonProperty("System.Runtime.InteropServices")] + public string SystemRuntimeInteropServices { get; set; } + + [JsonProperty("System.Diagnostics.Process")] + public string SystemDiagnosticsProcess { get; set; } + + [JsonProperty("System.Private.Uri")] public string SystemPrivateUri { get; set; } + + [JsonProperty("System.ComponentModel.Primitives")] + public string SystemComponentModelPrimitives { get; set; } + + [JsonProperty("Microsoft.Win32.Primitives")] + public string MicrosoftWin32Primitives { get; set; } + + [JsonProperty("System.Diagnostics.StackTrace")] + public string SystemDiagnosticsStackTrace { get; set; } + + [JsonProperty("System.Net.Http")] public string SystemNetHttp { get; set; } + + [JsonProperty("System.Diagnostics.DiagnosticSource")] + public string SystemDiagnosticsDiagnosticSource { get; set; } + + [JsonProperty("System.Collections.Concurrent")] + public string SystemCollectionsConcurrent { get; set; } + + [JsonProperty("System.Reflection.Metadata")] + public string SystemReflectionMetadata { get; set; } + + [JsonProperty("System.Threading.Thread")] + public string SystemThreadingThread { get; set; } + + [JsonProperty("System.Threading.ThreadPool")] + public string SystemThreadingThreadPool { get; set; } + + [JsonProperty("System.Collections.Immutable")] + public string SystemCollectionsImmutable { get; set; } + + [JsonProperty("System.IO.MemoryMappedFiles")] + public string SystemIOMemoryMappedFiles { get; set; } + + [JsonProperty("System.Linq.Expressions")] + public string SystemLinqExpressions { get; set; } +} + +public class Os +{ + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("raw_description")] public string RawDescription { get; set; } +} + +public class Package +{ + [JsonProperty("name")] public string Name { get; set; } + + [JsonProperty("version")] public string Version { get; set; } +} + +public class Request +{ + [JsonProperty("query_string")] public string QueryString { get; set; } +} + +public class SentryModulesDto +{ + [JsonProperty("modules")] public Modules Modules { get; set; } + + [JsonProperty("event_id")] public string EventId { get; set; } + + [JsonProperty("timestamp")] public DateTime Timestamp { get; set; } + + [JsonProperty("platform")] public string Platform { get; set; } + + [JsonProperty("server_name")] public string ServerName { get; set; } + + [JsonProperty("release")] public string Release { get; set; } + + [JsonProperty("exception")] public Exception Exception { get; set; } + + [JsonProperty("threads")] public Threads Threads { get; set; } + + [JsonProperty("level")] public string Level { get; set; } + + [JsonProperty("request")] public Request Request { get; set; } + + [JsonProperty("contexts")] public Contexts Contexts { get; set; } + + [JsonProperty("user")] public User User { get; set; } + + [JsonProperty("environment")] public string Environment { get; set; } + + [JsonProperty("sdk")] public Sdk Sdk { get; set; } + + [JsonProperty("debug_meta")] public DebugMeta DebugMeta { get; set; } +} + +public class Runtime +{ + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("name")] public string Name { get; set; } + + [JsonProperty("version")] public string Version { get; set; } + + [JsonProperty("raw_description")] public string RawDescription { get; set; } + + [JsonProperty("identifier")] public string Identifier { get; set; } +} + +public class Stacktrace +{ + [JsonProperty("frames")] public List Frames { get; set; } +} + +public class ThreadPoolInfo +{ + [JsonProperty("min_worker_threads")] public int MinWorkerThreads { get; set; } + + [JsonProperty("min_completion_port_threads")] + public int MinCompletionPortThreads { get; set; } + + [JsonProperty("max_worker_threads")] public int MaxWorkerThreads { get; set; } + + [JsonProperty("max_completion_port_threads")] + public int MaxCompletionPortThreads { get; set; } + + [JsonProperty("available_worker_threads")] + public int AvailableWorkerThreads { get; set; } + + [JsonProperty("available_completion_port_threads")] + public int AvailableCompletionPortThreads { get; set; } +} + +public class Threads +{ + [JsonProperty("values")] public List Values { get; set; } +} + +public class User +{ + [JsonProperty("id")] public string Id { get; set; } + + [JsonProperty("username")] public string Username { get; set; } + + [JsonProperty("ip_address")] public string IpAddress { get; set; } +} + +public class Value +{ + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("value")] public string ValueData { get; set; } + + [JsonProperty("module")] public string Module { get; set; } + + [JsonProperty("thread_id")] public int ThreadId { get; set; } + + [JsonProperty("id")] public int Id { get; set; } + + [JsonProperty("crashed")] public bool Crashed { get; set; } + + [JsonProperty("current")] public bool Current { get; set; } + + [JsonProperty("stacktrace")] public Stacktrace Stacktrace { get; set; } +} diff --git a/src/Gml.Web.Api.Dto/Sentry/SentryReadDto.cs b/src/Gml.Web.Api.Dto/Sentry/SentryReadDto.cs new file mode 100644 index 0000000..ddb7dad --- /dev/null +++ b/src/Gml.Web.Api.Dto/Sentry/SentryReadDto.cs @@ -0,0 +1,3 @@ +namespace Gml.Web.Api.Dto.Sentry; + +public class SentryReadDto : BaseSentryError {}