Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1308 from StephenHodgson/MRTK-APIChecker
Added Windows API Contract Checker
- Loading branch information
Showing
12 changed files
with
1,322 additions
and
59 deletions.
There are no files selected for viewing
1,180 changes: 1,180 additions & 0 deletions
1,180
Assets/HoloToolkit-Examples/Utilities/Scenes/CheckAPI.unity
Large diffs are not rendered by default.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
...t/Input/Scripts/Utilities/Extensions.meta → ...ples/Utilities/Scenes/CheckAPI.unity.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
Assets/HoloToolkit-Examples/Utilities/Scripts/CheckApiTest.cs
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,29 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
public class CheckApiTest : MonoBehaviour | ||
{ | ||
[SerializeField] | ||
private Text text; | ||
|
||
public void CheckV5Api() | ||
{ | ||
text.text = "UniversalApiContract\nVersion 5 available? " + HoloToolkit.WindowsApiChecker.UniversalApiContractV5_IsAvailable; | ||
Debug.Log(text.text); | ||
} | ||
|
||
public void CheckV4Api() | ||
{ | ||
text.text = "UniversalApiContract\nVersion 4 available? " + HoloToolkit.WindowsApiChecker.UniversalApiContractV4_IsAvailable; | ||
Debug.Log(text.text); | ||
} | ||
|
||
public void CheckV3Api() | ||
{ | ||
text.text = "UniversalApiContract\nVersion 3 available? " + HoloToolkit.WindowsApiChecker.UniversalApiContractV3_IsAvailable; | ||
Debug.Log(text.text); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Assets/HoloToolkit-Examples/Utilities/Scripts/CheckApiTest.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
File renamed without changes.
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,41 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
namespace HoloToolkit | ||
{ | ||
/// <summary> | ||
/// Helper class for determining if a Windows API contract is available. | ||
/// <remarks> See https://docs.microsoft.com/en-us/uwp/extension-sdks/windows-universal-sdk | ||
/// for a full list of contracts.</remarks> | ||
/// </summary> | ||
public static class WindowsApiChecker | ||
{ | ||
static WindowsApiChecker() | ||
{ | ||
#if !UNITY_EDITOR && UNITY_WSA | ||
UniversalApiContractV5_IsAvailable = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5); | ||
UniversalApiContractV4_IsAvailable = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4); | ||
UniversalApiContractV3_IsAvailable = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3); | ||
#else | ||
UniversalApiContractV5_IsAvailable = false; | ||
UniversalApiContractV4_IsAvailable = false; | ||
UniversalApiContractV3_IsAvailable = false; | ||
#endif | ||
} | ||
|
||
/// <summary> | ||
/// Is the Universal API Contract v5.0 Available? | ||
/// </summary> | ||
public static bool UniversalApiContractV5_IsAvailable { get; private set; } | ||
|
||
/// <summary> | ||
/// Is the Universal API Contract v4.0 Available? | ||
/// </summary> | ||
public static bool UniversalApiContractV4_IsAvailable { get; private set; } | ||
|
||
/// <summary> | ||
/// Is the Universal API Contract v3.0 Available? | ||
/// </summary> | ||
public static bool UniversalApiContractV3_IsAvailable { get; private set; } | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Assets/HoloToolkit/Utilities/Scripts/WindowsApiChecker.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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