关于企业微信

This commit is contained in:
2025-12-29 11:48:57 +08:00
parent 42e55f334e
commit dff08f1f84
2 changed files with 284 additions and 0 deletions

View File

@@ -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))