-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e974a4d
commit 07bb56b
Showing
6 changed files
with
60 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
|
||
namespace Client.Libs; | ||
|
||
public class UWPHelper | ||
{ | ||
public static bool IsRunningAsUwp() | ||
{ | ||
if (IsWindows7OrLower) | ||
{ | ||
return false; | ||
} | ||
else | ||
{ | ||
int length = 0; | ||
StringBuilder sb = new(0); | ||
GetCurrentPackageFullName(ref length, sb); | ||
|
||
sb = new StringBuilder(length); | ||
int result = GetCurrentPackageFullName(ref length, sb); | ||
|
||
return result != APPMODEL_ERROR_NO_PACKAGE; | ||
} | ||
} | ||
|
||
private static bool IsWindows7OrLower | ||
{ | ||
get | ||
{ | ||
int versionMajor = Environment.OSVersion.Version.Major; | ||
int versionMinor = Environment.OSVersion.Version.Minor; | ||
double version = versionMajor + (double)versionMinor / 10; | ||
return version <= 6.1; | ||
} | ||
} | ||
|
||
const long APPMODEL_ERROR_NO_PACKAGE = 15700L; | ||
|
||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] | ||
static extern int GetCurrentPackageFullName(ref int packageFullNameLength, StringBuilder packageFullName); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters