Skip to content

Commit

Permalink
Update to .NET 9 and fix new analyzer inspections
Browse files Browse the repository at this point in the history
  • Loading branch information
Fs00 committed Nov 24, 2024
1 parent f786b59 commit 3f61008
Show file tree
Hide file tree
Showing 23 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.200",
"version": "9.0.100",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion src/AppConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Win10BloatRemover;

public class AppConfiguration
class AppConfiguration
{
public required string[] ServicesToRemove { get; init; }
public required UwpAppGroup[] UWPAppsToRemove { get; init; }
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/AutoUpdatesDisabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Win10BloatRemover.Operations;

public class AutoUpdatesDisabler(IUserInterface ui) : IOperation
class AutoUpdatesDisabler(IUserInterface ui) : IOperation
{
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/BrowserOpener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Win10BloatRemover.Operations;

public class BrowserOpener(string url) : IOperation
class BrowserOpener(string url) : IOperation
{
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/ConsumerFeaturesDisabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Win10BloatRemover.Operations;

public class ConsumerFeaturesDisabler(IUserInterface ui) : IOperation
class ConsumerFeaturesDisabler(IUserInterface ui) : IOperation
{
public bool IsRebootRecommended { get; private set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Operations/DefenderDisabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Win10BloatRemover.Operations;

public class DefenderDisabler(IUserInterface ui, ServiceRemover serviceRemover) : IOperation
class DefenderDisabler(IUserInterface ui, ServiceRemover serviceRemover) : IOperation
{
private static readonly string[] defenderServices = [
"wscsvc",
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/EdgeRemover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Win10BloatRemover.Operations;

public class EdgeRemover(IUserInterface ui, AppxRemover appxRemover) : IOperation
class EdgeRemover(IUserInterface ui, AppxRemover appxRemover) : IOperation
{
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/ErrorReportingDisabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Win10BloatRemover.Operations;

public class ErrorReportingDisabler(IUserInterface ui, ServiceRemover serviceRemover) : IOperation
class ErrorReportingDisabler(IUserInterface ui, ServiceRemover serviceRemover) : IOperation
{
private static readonly string[] errorReportingServices = ["WerSvc", "wercplsupport"];
private static readonly string[] errorReportingScheduledTasks = [
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/FeaturesRemover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Win10BloatRemover.Operations;

public class FeaturesRemover(string[] featuresToRemove, IUserInterface ui) : IOperation
class FeaturesRemover(string[] featuresToRemove, IUserInterface ui) : IOperation
{
public bool IsRebootRecommended { get; private set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Operations/IOperation.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Win10BloatRemover.Operations;

public interface IOperation
interface IOperation
{
void Run();
bool IsRebootRecommended => false;
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/LicensePrinter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Win10BloatRemover.Operations;

public class LicensePrinter(IUserInterface ui) : IOperation
class LicensePrinter(IUserInterface ui) : IOperation
{
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/OneDriveRemover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Win10BloatRemover.Operations;

public class OneDriveRemover(IUserInterface ui) : IOperation
class OneDriveRemover(IUserInterface ui) : IOperation
{
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/PrivacySettingsTweaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Win10BloatRemover.Operations;

public class PrivacySettingsTweaker(IUserInterface ui) : IOperation
class PrivacySettingsTweaker(IUserInterface ui) : IOperation
{
private static readonly string[] appPermissionsToDeny = [
"location",
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/ScheduledTasksDisabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Win10BloatRemover.Operations;

public class ScheduledTasksDisabler(string[] scheduledTasksToDisable, IUserInterface ui) : IOperation
class ScheduledTasksDisabler(string[] scheduledTasksToDisable, IUserInterface ui) : IOperation
{
public void Run()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Operations/ServiceRemover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Win10BloatRemover.Operations;

public class ServiceRemovalOperation(string[] servicesToRemove, IUserInterface ui, ServiceRemover serviceRemover) : IOperation
class ServiceRemovalOperation(string[] servicesToRemove, IUserInterface ui, ServiceRemover serviceRemover) : IOperation
{
public bool IsRebootRecommended => serviceRemover.IsRebootRecommended;

Expand All @@ -26,7 +26,7 @@ public void Run()
* Performs backup (export of registry keys) and removal of those services whose name starts with the given service names.
* This is made in order to include services that end with a random code.
*/
public class ServiceRemover
class ServiceRemover
{
private readonly DirectoryInfo backupDirectory;
private readonly IUserInterface ui;
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/SuggestionsDisabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Win10BloatRemover.Operations;

public class SuggestionsDisabler(IUserInterface ui) : IOperation
class SuggestionsDisabler(IUserInterface ui) : IOperation
{
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Operations/TelemetryDisabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Win10BloatRemover.Operations;

public class TelemetryDisabler(IUserInterface ui, ServiceRemover serviceRemover) : IOperation
class TelemetryDisabler(IUserInterface ui, ServiceRemover serviceRemover) : IOperation
{
private static readonly string[] telemetryServices = [
"DiagTrack",
Expand Down
6 changes: 3 additions & 3 deletions src/Operations/UwpAppGroupRemover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

namespace Win10BloatRemover.Operations;

public enum UwpAppRemovalMode
enum UwpAppRemovalMode
{
CurrentUser,
AllUsers
}

public enum UwpAppGroup
enum UwpAppGroup
{
AlarmsAndClock,
Bing, // Weather, News, Finance and Sports
Expand All @@ -38,7 +38,7 @@ public enum UwpAppGroup
Zune // Groove Music and Movies
}

public class UwpAppGroupRemover : IOperation
class UwpAppGroupRemover : IOperation
{
private static readonly Dictionary<UwpAppGroup, string[]> appNamesForGroup = new() {
{ UwpAppGroup.AlarmsAndClock, new[] { "Microsoft.WindowsAlarms" } },
Expand Down
3 changes: 1 addition & 2 deletions src/Properties/PublishProfiles/Standalone.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PublishTrimmed>True</PublishTrimmed>
<TrimMode>full</TrimMode>
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
<DebuggerSupport>false</DebuggerSupport>
<NullabilityInfoContextSupport>false</NullabilityInfoContextSupport>
<DebuggerSupport>false</DebuggerSupport>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions src/UI/IUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Win10BloatRemover.UI;

public interface IMessagePrinter
interface IMessagePrinter
{
void PrintMessage(string text);
void PrintError(string text);
Expand All @@ -10,13 +10,13 @@ public interface IMessagePrinter
void PrintEmptySpace();
}

public enum UserChoice
enum UserChoice
{
Yes,
No
}

public interface IUserInterface : IMessagePrinter
interface IUserInterface : IMessagePrinter
{
UserChoice AskUserConsent(string text);

Expand Down
4 changes: 2 additions & 2 deletions src/Utils/AppxRemover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace Win10BloatRemover.Utils;

public class AppxRemover(IUserInterface ui)
class AppxRemover(IUserInterface ui)
{
public readonly record struct Result(int RemovedApps, int FailedRemovals);
internal readonly record struct Result(int RemovedApps, int FailedRemovals);

private enum RemovalOutcome
{
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/ExitCode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Win10BloatRemover.Utils;

public readonly struct ExitCode(int code)
readonly struct ExitCode(int code)
{
private readonly int code = code;

Expand Down
4 changes: 2 additions & 2 deletions src/Win10BloatRemover.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net9.0-windows10.0.19041.0</TargetFramework>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<PlatformTarget>x86</PlatformTarget>
Expand All @@ -21,7 +21,7 @@
<Using Include="System.Linq" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Dism" Version="2.5.2" />
<PackageReference Include="Microsoft.Dism" Version="3.1.0" />
</ItemGroup>
<PropertyGroup>
<InvariantGlobalization>true</InvariantGlobalization>
Expand Down

0 comments on commit 3f61008

Please sign in to comment.