Skip to content

Commit

Permalink
Simplify initializing WASDK
Browse files Browse the repository at this point in the history
  • Loading branch information
U-C-S committed Nov 6, 2024
1 parent ce33e70 commit 2fa7025
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions Source/Hurl.Settings/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using Windows.ApplicationModel;
using Windows.Management.Deployment;
using System.Diagnostics;

namespace Hurl.Settings;
namespace Hurl.Settings;

public class Program
{
Expand Down Expand Up @@ -30,21 +26,14 @@ static void Main(string[] args)
public static bool InitializeWASDK()
{
uint minSupportedMinorVersion = global::Microsoft.WindowsAppSDK.Release.MajorMinor; // 0x00010005
uint maxSupportedMinorVersion = 0x00010006;
bool isSuccessful = false;
for (uint i = minSupportedMinorVersion;
i <= maxSupportedMinorVersion && !isSuccessful;
i++)
uint maxSupportedMinorVersion = 0x00010007;
for (uint version = minSupportedMinorVersion; version <= maxSupportedMinorVersion; version++)
{
isSuccessful = global::Microsoft.Windows.ApplicationModel.DynamicDependency.Bootstrap.TryInitialize(i, out _);
//Debug.WriteLine(isSuccessful, i.ToString());
if (global::Microsoft.Windows.ApplicationModel.DynamicDependency.Bootstrap.TryInitialize(version, out _))
return true;
}

if (!isSuccessful)
{
System.Environment.Exit(-1);
}

return isSuccessful;
System.Environment.Exit(-1);
return false;
}
}

0 comments on commit 2fa7025

Please sign in to comment.