Compare commits

...

2 Commits

Author SHA1 Message Date
385dba1cf3 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	CShocker/Devices/Additional/ApiHttpClient.cs
2025-01-16 21:47:48 +01:00
1ff67a5b8b Fix Assembly string empty on Publish 2025-01-16 21:46:13 +01:00
2 changed files with 7 additions and 3 deletions

View File

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

View File

@ -13,15 +13,19 @@ 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");
assembly = Assembly.LoadFrom(f.FullName);
fvi = FileVersionInfo.GetVersionInfo(f.FullName);
}
else
{
fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
}
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
return new (fvi.ProductName ?? fvi.FileName, fvi.ProductVersion);
}