-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathInfoHelper.cs
More file actions
40 lines (33 loc) · 1.37 KB
/
InfoHelper.cs
File metadata and controls
40 lines (33 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#if WINAPPSDK
using Windows.ApplicationModel;
using Windows.Storage;
using Windows.System.Profile;
namespace CommunityToolkit.WinUI.Controls;
internal static class InfoHelper
{
public static Version AppVersion { get; } = new Version(
Package.Current.Id.Version.Major,
Package.Current.Id.Version.Minor,
Package.Current.Id.Version.Build,
Package.Current.Id.Version.Revision
);
public static Version SystemVersion { get; }
public static SystemDataPaths SystemDataPath { get; } = SystemDataPaths.GetDefault();
public static UserDataPaths UserDataPath { get; } = UserDataPaths.GetDefault();
public static string AppInstalledLocation { get; } = Package.Current.InstalledLocation.Path;
static InfoHelper()
{
string systemVersion = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
ulong version = ulong.Parse(systemVersion);
SystemVersion = new Version(
(int)((version & 0xFFFF000000000000L) >> 48),
(int)((version & 0x0000FFFF00000000L) >> 32),
(int)((version & 0x00000000FFFF0000L) >> 16),
(int)(version & 0x000000000000FFFFL)
);
}
}
#endif