Compare commits

..

No commits in common. "385dba1cf3bfb58135670d6d4a64830b8e251c53" and "c55592cd90d84b1f6cad703b4be15d8d2a05575f" have entirely different histories.

2 changed files with 3 additions and 7 deletions

View File

@ -6,7 +6,7 @@
<Authors>Glax</Authors>
<RepositoryUrl>https://github.com/C9Glax/CShocker</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>3.0.2</Version>
<Version>3.0.1</Version>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<LangVersion>latestmajor</LangVersion>
<PackageProjectUrl>https://github.com/C9Glax/CShocker</PackageProjectUrl>

View File

@ -13,19 +13,15 @@ public static class ApiHttpClient
private static ProductInfoHeaderValue GetUserAgent()
{
Assembly assembly = Assembly.GetExecutingAssembly();
FileVersionInfo fvi;
if (assembly.Location == String.Empty)
{
DirectoryInfo dir = new (AppContext.BaseDirectory);
FileInfo? f = dir.GetFiles("*.exe").FirstOrDefault();
if (f is null)
return new("CShocker", "Release");
fvi = FileVersionInfo.GetVersionInfo(f.FullName);
}
else
{
fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
assembly = Assembly.LoadFrom(f.FullName);
}
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
return new (fvi.ProductName ?? fvi.FileName, fvi.ProductVersion);
}