File tree Expand file tree Collapse file tree 2 files changed +2
-33
lines changed Expand file tree Collapse file tree 2 files changed +2
-33
lines changed Original file line number Diff line number Diff line change 1
- using System . Reflection ;
2
- using System . Runtime . InteropServices ;
3
- using System . Text ;
4
-
5
1
using Windows . ApplicationModel ;
6
2
7
3
namespace DotVast . HashTool . WinUI . Helpers ;
8
4
9
5
public sealed class RuntimeHelper
10
6
{
11
- [ DllImport ( "kernel32.dll" , CharSet = CharSet . Unicode , SetLastError = true ) ]
12
- private static extern int GetCurrentPackageFullName ( ref int packageFullNameLength , StringBuilder ? packageFullName ) ;
13
-
14
- #region IsMSIX
15
-
16
- private static bool ? s_isMSIX ;
17
- public static bool IsMSIX => s_isMSIX ??= GetIsMSIX ( ) ;
18
- private static bool GetIsMSIX ( )
19
- {
20
- var length = 0 ;
21
- return GetCurrentPackageFullName ( ref length , null ) != 15700L ;
22
- }
23
-
24
- #endregion IsMSIX
25
-
26
7
#region AppVersion
27
8
28
9
private static Version ? s_appVersion ;
29
10
public static Version AppVersion => s_appVersion ??= GetAppVersion ( ) ;
30
11
private static Version GetAppVersion ( )
31
12
{
32
- if ( IsMSIX )
33
- {
34
- var packageVersion = Package . Current . Id . Version ;
35
- // 使用语义化版本
36
- s_appVersion = new ( packageVersion . Major , packageVersion . Minor , packageVersion . Build ) ;
37
- }
38
- else
39
- {
40
- s_appVersion = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version ! ;
41
- }
42
-
43
- return s_appVersion ;
13
+ var packageVersion = Package . Current . Id . Version ;
14
+ return new ( packageVersion . Major , packageVersion . Minor , packageVersion . Build ) ; // 使用语义化版本
44
15
}
45
16
46
17
#endregion AppVersion
Original file line number Diff line number Diff line change 8
8
9
9
using Microsoft . Extensions . Logging ;
10
10
11
- using Windows . ApplicationModel ;
12
-
13
11
namespace DotVast . HashTool . WinUI . Services ;
14
12
15
13
internal partial class CheckUpdateService : ICheckUpdateService
You can’t perform that action at this time.
0 commit comments