Skip to content

Commit

Permalink
Fix it again
Browse files Browse the repository at this point in the history
  • Loading branch information
Sella-GH committed Dec 23, 2024
1 parent f467655 commit f178194
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions src/AzzyBot.Core/Utilities/SoftwareStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace AzzyBot.Core.Utilities;
public static class SoftwareStats
{
public static string GetAppAuthors
=> FileVersionInfo.GetVersionInfo(GetAppFilePath()).CompanyName ?? "Bot authors not found";
=> FileVersionInfo.GetVersionInfo(GetAppFilePath).CompanyName ?? "Bot authors not found";

public static string GetAppDotNetVersion
=> Environment.Version.ToString() ?? ".NET version not found";
Expand All @@ -17,10 +17,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(GetAppFilePath).ProductName?.Split('.')[0] ?? "Bot name not found";

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

public static double GetAppMemoryUsage()
{
Expand All @@ -36,17 +36,6 @@ public static DateTimeOffset GetAppUptime()
return app.StartTime;
}

private static string GetAppFilePath()
{
string fileName = Path.Combine(AppContext.BaseDirectory, AppDomain.CurrentDomain.FriendlyName);
Console.WriteLine(fileName);
if (!HardwareStats.CheckIfLinuxOs)
fileName += ".exe";

Console.WriteLine(fileName);

return (!string.IsNullOrEmpty(fileName))
? fileName
: throw new InvalidOperationException("Bot file path not found");
}
private static string GetAppFilePath
=> $"{Path.Combine(AppContext.BaseDirectory, AppDomain.CurrentDomain.FriendlyName)}.dll";
}

0 comments on commit f178194

Please sign in to comment.