diff --git a/ArchiSteamFarm/Core/OS.cs b/ArchiSteamFarm/Core/OS.cs index 897580260..b85a96fe2 100644 --- a/ArchiSteamFarm/Core/OS.cs +++ b/ArchiSteamFarm/Core/OS.cs @@ -37,23 +37,16 @@ using System.Threading.Tasks; using ArchiSteamFarm.Localization; using ArchiSteamFarm.Storage; using ArchiSteamFarm.Web; -using JetBrains.Annotations; namespace ArchiSteamFarm.Core; internal static class OS { - [PublicAPI] - public static string? Description => TrimAndNullifyEmptyString(RuntimeInformation.OSDescription); - - [PublicAPI] - public static string? Framework => TrimAndNullifyEmptyString(RuntimeInformation.FrameworkDescription); - - [PublicAPI] - public static string? Runtime => TrimAndNullifyEmptyString(RuntimeInformation.RuntimeIdentifier); - // We need to keep this one assigned and not calculated on-demand internal static readonly string ProcessFileName = Environment.ProcessPath ?? throw new InvalidOperationException(nameof(ProcessFileName)); + internal static string? Description => TrimAndNullifyEmptyText(RuntimeInformation.OSDescription); + internal static string? Framework => TrimAndNullifyEmptyText(RuntimeInformation.FrameworkDescription); + internal static DateTime ProcessStartTime { get { using Process process = Process.GetCurrentProcess(); @@ -62,6 +55,8 @@ internal static class OS { } } + internal static string? Runtime => TrimAndNullifyEmptyText(RuntimeInformation.RuntimeIdentifier); + internal static string Version { get { if (!string.IsNullOrEmpty(BackingVersion)) { @@ -288,12 +283,12 @@ internal static class OS { } } - private static string? TrimAndNullifyEmptyString(string s) { - ArgumentNullException.ThrowIfNull(s); + private static string? TrimAndNullifyEmptyText(string text) { + ArgumentNullException.ThrowIfNull(text); - s = s.Trim(); + text = text.Trim(); - return s.Length == 0 ? null : s; + return text.Length > 0 ? text : null; } [SupportedOSPlatform("Windows")] diff --git a/ArchiSteamFarm/SharedInfo.cs b/ArchiSteamFarm/SharedInfo.cs index cab40f8e6..5b8f0550a 100644 --- a/ArchiSteamFarm/SharedInfo.cs +++ b/ArchiSteamFarm/SharedInfo.cs @@ -98,12 +98,11 @@ public static class SharedInfo { } } + internal static Guid ModuleVersion => Assembly.GetExecutingAssembly().ManifestModule.ModuleVersionId; internal static string ProgramIdentifier => $"{PublicIdentifier} V{Version} ({BuildInfo.Variant}/{ModuleVersion:N} | {OS.Version}) in [{Directory.GetCurrentDirectory()}]"; internal static string PublicIdentifier => $"{AssemblyName}{(BuildInfo.IsCustomBuild ? "-custom" : PluginsCore.HasCustomPluginsLoaded ? "-modded" : "")}"; internal static Version Version => Assembly.GetExecutingAssembly().GetName().Version ?? throw new InvalidOperationException(nameof(Version)); - internal static Guid ModuleVersion => Assembly.GetExecutingAssembly().ManifestModule.ModuleVersionId; - private static string? CachedHomeDirectory; internal static class BuildInfo {