关于企业微信
This commit is contained in:
@@ -118,6 +118,31 @@ namespace Ramitta.lib
|
||||
#endregion
|
||||
|
||||
#region 文件解析
|
||||
public static string? GetExeVersion(string exePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists(exePath))
|
||||
{
|
||||
return null; // 文件不存在时返回null
|
||||
}
|
||||
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(exePath);
|
||||
string? version = versionInfo.FileVersion;
|
||||
|
||||
// 如果FileVersion为空,尝试使用ProductVersion
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
version = versionInfo.ProductVersion;
|
||||
}
|
||||
|
||||
return string.IsNullOrEmpty(version) ? null : version;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null; // 出现任何异常都返回null
|
||||
}
|
||||
}
|
||||
public static bool IsPathExist(string databasePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(databasePath))
|
||||
|
||||
Reference in New Issue
Block a user