mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Misc
This commit is contained in:
@@ -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")]
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user