Compare commits
2 Commits
c55592cd90
...
385dba1cf3
Author | SHA1 | Date | |
---|---|---|---|
385dba1cf3 | |||
1ff67a5b8b |
@ -6,7 +6,7 @@
|
|||||||
<Authors>Glax</Authors>
|
<Authors>Glax</Authors>
|
||||||
<RepositoryUrl>https://github.com/C9Glax/CShocker</RepositoryUrl>
|
<RepositoryUrl>https://github.com/C9Glax/CShocker</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<Version>3.0.1</Version>
|
<Version>3.0.2</Version>
|
||||||
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
|
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
|
||||||
<LangVersion>latestmajor</LangVersion>
|
<LangVersion>latestmajor</LangVersion>
|
||||||
<PackageProjectUrl>https://github.com/C9Glax/CShocker</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/C9Glax/CShocker</PackageProjectUrl>
|
||||||
|
@ -13,15 +13,19 @@ public static class ApiHttpClient
|
|||||||
private static ProductInfoHeaderValue GetUserAgent()
|
private static ProductInfoHeaderValue GetUserAgent()
|
||||||
{
|
{
|
||||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||||
|
FileVersionInfo fvi;
|
||||||
if (assembly.Location == String.Empty)
|
if (assembly.Location == String.Empty)
|
||||||
{
|
{
|
||||||
DirectoryInfo dir = new (AppContext.BaseDirectory);
|
DirectoryInfo dir = new (AppContext.BaseDirectory);
|
||||||
FileInfo? f = dir.GetFiles("*.exe").FirstOrDefault();
|
FileInfo? f = dir.GetFiles("*.exe").FirstOrDefault();
|
||||||
if (f is null)
|
if (f is null)
|
||||||
return new("CShocker", "Release");
|
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);
|
return new (fvi.ProductName ?? fvi.FileName, fvi.ProductVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user