Skip to content

Commit

Permalink
Optimize a little
Browse files Browse the repository at this point in the history
  • Loading branch information
Sella-GH committed Dec 23, 2024
1 parent f178194 commit 99b889a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/AzzyBot.Core/Utilities/SoftwareStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ namespace AzzyBot.Core.Utilities;

public static class SoftwareStats
{
private static readonly string AppFilePath = $"{Path.Combine(AppContext.BaseDirectory, AppDomain.CurrentDomain.FriendlyName)}.dll";

public static string GetAppAuthors
=> FileVersionInfo.GetVersionInfo(GetAppFilePath).CompanyName ?? "Bot authors not found";
=> FileVersionInfo.GetVersionInfo(AppFilePath).CompanyName ?? "Bot authors not found";

public static string GetAppDotNetVersion
=> Environment.Version.ToString() ?? ".NET version not found";
Expand All @@ -17,10 +19,10 @@ public static string GetAppEnvironment
=> (GetAppName.EndsWith("Dev", StringComparison.OrdinalIgnoreCase)) ? Environments.Development : Environments.Production;

public static string GetAppName
=> FileVersionInfo.GetVersionInfo(GetAppFilePath).ProductName?.Split('.')[0] ?? "Bot name not found";
=> FileVersionInfo.GetVersionInfo(AppFilePath).ProductName?.Split('.')[0] ?? "Bot name not found";

public static string GetAppVersion
=> FileVersionInfo.GetVersionInfo(GetAppFilePath).ProductVersion ?? "Bot version not found";
=> FileVersionInfo.GetVersionInfo(AppFilePath).ProductVersion ?? "Bot version not found";

public static double GetAppMemoryUsage()
{
Expand All @@ -35,7 +37,4 @@ public static DateTimeOffset GetAppUptime()

return app.StartTime;
}

private static string GetAppFilePath
=> $"{Path.Combine(AppContext.BaseDirectory, AppDomain.CurrentDomain.FriendlyName)}.dll";
}

0 comments on commit 99b889a

Please sign in to comment.