Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions Rapr/DSEFormHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
Expand All @@ -22,7 +22,6 @@ public static class DSEFormHelper
{
private const string AppCompatRegistry = @"Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers";
private const string RunAsAdminRegistryValue = "RUNASADMIN";
private static readonly Version Win8Version = new Version(6, 2);
private static readonly Version Win10Version = new Version(10, 0);
private static readonly Version Win11Version = new Version(10, 0, 22000);

Expand Down Expand Up @@ -97,12 +96,8 @@ private static bool IsRunAsAdministrator()
}

public static bool IsOSSupported =>
Environment.OSVersion.Platform == PlatformID.Win32NT
&& (Environment.OSVersion.Version.Major >= 6);

public static bool IsWin8OrNewer =>
Environment.OSVersion.Platform == PlatformID.Win32NT
&& Environment.OSVersion.Version >= Win8Version;
Environment.OSVersion.Platform == PlatformID.Win32NT &&
Environment.OSVersion.Version >= Win10Version;

/// <summary>
/// Gets a value indicating whether the current operating system is Windows 11 or newer.
Expand All @@ -115,12 +110,7 @@ private static bool IsRunAsAdministrator()
/// Gets a value indicating whether the current operating system is 64-bit.
/// </summary>
public static bool Is64BitOperatingSystem => Environment.Is64BitOperatingSystem;

/// <summary>
/// Gets a value indicating whether the native driver store API is supported.
/// The native driver store requires Windows 8 or newer AND a 64-bit operating system.
/// </summary>
public static bool IsNativeDriverStoreSupported => IsWin8OrNewer && Is64BitOperatingSystem;
public static bool IsNativeDriverStoreSupported => Is64BitOperatingSystem;

/// <summary>
/// Gets a value indicating whether the PnPUtil utility is supported.
Expand Down
3 changes: 1 addition & 2 deletions Rapr/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
Expand Down Expand Up @@ -81,7 +81,6 @@ private static void CleanUpOldConfig()
public static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

Trace.AutoFlush = true;
Trace.IndentSize = 4;
Expand Down
8 changes: 3 additions & 5 deletions Rapr/Rapr.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<TargetFramework>net481</TargetFramework>
<OutputType>WinExe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
Expand All @@ -25,7 +25,6 @@
<PackageReference Include="PortableSettingsProvider" Version="0.2.5" GeneratePathProperty="true" />
<PackageReference Include="Resource.Embedder" Version="2.2.0" />
<PackageReference Include="StrongNamer" Version="0.2.5" />
<PackageReference Include="System.ValueTuple" Version="4.6.1" GeneratePathProperty="true" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.configuration" />
Expand Down Expand Up @@ -72,11 +71,10 @@
<EmbeddedResource Include="$(PkgMicrosoft_Dism)\lib\net40\Microsoft.Dism.dll" Visible="false" />
<EmbeddedResource Include="$(PkgNewtonsoft_Json)\lib\net45\Newtonsoft.Json.dll" Visible="false" />
<EmbeddedResource Include="$(PkgObjectListView_Official)\lib\net20\ObjectListView.dll" Visible="false" />
<EmbeddedResource Include="$(PkgSystem_ValueTuple)\lib\net462\System.ValueTuple.dll" Visible="false" />
<EmbeddedResource Include="$(PkgMicrosoft_WindowsAPICodePack_Core)\lib\Microsoft.WindowsAPICodePack.dll" Visible="false" />
<EmbeddedResource Include="$(PkgMicrosoft_WindowsAPICodePack_Shell)\lib\Microsoft.WindowsAPICodePack.Shell.dll" Visible="false" />
<EmbeddedResource Include="$(IntermediateOutputPath)SignedAssemblies\PortableSettingsProvider.dll" Visible="false">
<LogicalName>$(AssemblyName).PortableSettingsProvider.dll</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project>
</Project>
3 changes: 1 addition & 2 deletions Rapr/UpdateManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand All @@ -15,7 +15,6 @@ public class UpdateManager : IUpdateManager, IDisposable

public async Task<VersionInfo> GetLatestVersionInfo()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

this.httpClient.DefaultRequestHeaders
.Accept
Expand Down
6 changes: 3 additions & 3 deletions Rapr/Utils/DriverStoreFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;

using Rapr.Properties;
Expand Down Expand Up @@ -48,7 +48,7 @@ public static void MigrateDriverStoreSettings()

DriverStoreOption newOption = (useNativeDriverStore && DSEFormHelper.IsNativeDriverStoreSupported)
? DriverStoreOption.Native
: (DSEFormHelper.IsWin8OrNewer && DismUtil.IsDismAvailable)
: (DismUtil.IsDismAvailable)
? DriverStoreOption.DISM
: DriverStoreOption.PnpUtil;

Expand All @@ -70,7 +70,7 @@ public static void ValidateDriverStoreOption()
if (driverStoreOption == DriverStoreOption.Native && !DSEFormHelper.IsNativeDriverStoreSupported)
{
// Fall back to DISM if available, otherwise PnpUtil
if (DSEFormHelper.IsWin8OrNewer && DismUtil.IsDismAvailable)
if (DismUtil.IsDismAvailable)
{
driverStoreOption = DriverStoreOption.DISM;
}
Expand Down
2 changes: 1 addition & 1 deletion Rapr/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1"/>
</startup>
<userSettings>
<Rapr.Properties.Settings>
Expand Down
15 changes: 2 additions & 13 deletions Rapr/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,6 @@
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->

<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />

<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />

<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />

<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />

<!-- Windows 10, 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />

Expand All @@ -39,7 +27,8 @@
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</application>

Expand Down
6 changes: 3 additions & 3 deletions RaprTests/RaprTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<TargetFramework>net481</TargetFramework>
<OutputType>Library</OutputType>
<RootNamespace>Rapr.Tests</RootNamespace>
<AssemblyName>Rapr.Tests</AssemblyName>
Expand All @@ -13,4 +13,4 @@
<ItemGroup>
<ProjectReference Include="..\Rapr\Rapr.csproj" />
</ItemGroup>
</Project>
</Project>