Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
alastairlundy committed Feb 23, 2025
1 parent be4fdcc commit 463ba5a
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions PlatformKit.Windows/WinRegistrySearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ namespace PlatformKit.Windows;

public class WinRegistrySearcher : IWinRegistrySearcher
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;

public WinRegistrySearcher(ICommandRunner commandRunner)
public WinRegistrySearcher(ICliCommandRunner commandRunner)
{
_commandRunner = commandRunner;
}
Expand Down
6 changes: 3 additions & 3 deletions PlatformKit.Windows/WindowsSystemInfoProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ namespace PlatformKit.Windows;

public class WindowsSystemInfoProvider : IWindowsSystemInfoProvider
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;

public WindowsSystemInfoProvider(ICommandRunner commandRunner)
public WindowsSystemInfoProvider(ICliCommandRunner commandRunner)
{
_commandRunner = commandRunner;
}
Expand Down Expand Up @@ -64,7 +64,7 @@ public async Task<WindowsSystemInfo> GetWindowsSystemInfoAsync()

NetworkCardModel lastNetworkCard = null;

ICommandBuilder commandBuilder = new CommandBuilder(new CmdCommandConfiguration())
ICliCommandRunner commandBuilder = new CliCommandRunner(new CmdCommandConfiguration())
.WithArguments("systeminfo")
.WithWorkingDirectory(Environment.SystemDirectory);

Expand Down
6 changes: 3 additions & 3 deletions PlatformKit/Platforms/DefaultPlatformProviderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ namespace PlatformKit
{
public class DefaultPlatformProviderFactory : IPlatformProviderFactory
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;
private readonly ILinuxOsReleaseProvider _linuxOsReleaseSearcher;
private readonly IWindowsSystemInfoProvider _windowsSystemInfoProvider;

public DefaultPlatformProviderFactory(ICommandRunner commandRunner,
public DefaultPlatformProviderFactory(ICliCommandRunner commandRunner,
ILinuxOsReleaseProvider linuxOsReleaseSearcher,
IWindowsSystemInfoProvider windowsSystemInfoProvider)
{
Expand All @@ -41,7 +41,7 @@ public DefaultPlatformProviderFactory(ICommandRunner commandRunner,
_windowsSystemInfoProvider = windowsSystemInfoProvider;
}

public static DefaultPlatformProviderFactory CreateFactory(ICommandRunner commandRunner,
public static DefaultPlatformProviderFactory CreateFactory(ICliCommandRunner commandRunner,
ILinuxOsReleaseProvider linuxOsReleaseSearcher, IWindowsSystemInfoProvider windowsSystemInfoProvider)
{
return new DefaultPlatformProviderFactory(commandRunner, linuxOsReleaseSearcher, windowsSystemInfoProvider);
Expand Down
22 changes: 11 additions & 11 deletions PlatformKit/Platforms/Providers/AndroidPlatformProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This Source Code Form is subject to the terms of the Mozilla Public
using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

using AlastairLundy.Extensions.Processes;
using CliRunner;
using CliRunner.Abstractions;
using CliRunner.Builders;
Expand All @@ -29,9 +29,9 @@ namespace PlatformKit.Providers
{
public class AndroidPlatformProvider : IAndroidPlatformProvider
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;

public AndroidPlatformProvider(ICommandRunner commandRunner)
public AndroidPlatformProvider(ICliCommandRunner commandRunner)
{
_commandRunner = commandRunner;
}
Expand Down Expand Up @@ -80,10 +80,10 @@ await GetDeviceNameAsync(),
#endif
private async Task<Architecture> GetProcessorArchitectureAsync()
{
ICommandBuilder commandBuilder = new CommandBuilder("uname")
ICliCommandBuilder commandBuilder = new CliCommandBuilder("uname")
.WithArguments("-m");

Command command = commandBuilder.Build();
CliCommand command = commandBuilder.Build();

BufferedProcessResult result = await _commandRunner.ExecuteBufferedAsync(command);

Expand Down Expand Up @@ -122,10 +122,10 @@ private async Task<string> GetDeviceNameAsync()
#endif
private async Task<string> GetPlatformNameAsync()
{
ICommandBuilder commandBuilder = new CommandBuilder("uname")
ICliCommandBuilder commandBuilder = new CliCommandBuilder("uname")
.WithArguments("-o");

Command command = commandBuilder.Build();
CliCommand command = commandBuilder.Build();

BufferedProcessResult result = await _commandRunner.ExecuteBufferedAsync(command);

Expand All @@ -147,10 +147,10 @@ private async Task<Version> GetPlatformVersionAsync()
#endif
private async Task<Version> GetPlatformKernelVersionAsync()
{
ICommandBuilder commandBuilder = new CommandBuilder("uname")
ICliCommandBuilder commandBuilder = new CliCommandBuilder("uname")
.WithArguments("-r");

Command command = commandBuilder.Build();
CliCommand command = commandBuilder.Build();

BufferedProcessResult result = await _commandRunner.ExecuteBufferedAsync(command);

Expand Down Expand Up @@ -185,10 +185,10 @@ private async Task<int> GetSdkLevelAsync()
#endif
private async Task<string> GetPropValueAsync(string value)
{
ICommandBuilder commandBuilder = new CommandBuilder("getprop")
ICliCommandBuilder commandBuilder = new CliCommandBuilder("getprop")
.WithArguments($"ro.build.version.{value}");

Command command = commandBuilder.Build();
CliCommand command = commandBuilder.Build();

BufferedProcessResult result = await _commandRunner.ExecuteBufferedAsync(command);

Expand Down
8 changes: 6 additions & 2 deletions PlatformKit/Platforms/Providers/BSDPlatformProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ namespace PlatformKit.Providers
{
public class BSDPlatformProvider : UnixPlatformProvider
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;

public BSDPlatformProvider(ICommandRunner commandRunner) : base(commandRunner)
public BSDPlatformProvider(ICliCommandRunner commandRunner) : base(commandRunner)
{
_commandRunner = commandRunner;
}
Expand Down Expand Up @@ -74,7 +74,11 @@ private async Task<string> GetOsNameAsync()
{
try
{
#if NET6_0_OR_GREATER
string[] lines = await File.ReadAllLinesAsync("/etc/freebsd-release");
#else
string[] lines = await FilePolyfill.ReadAllLinesAsync("/etc/freebsd-release");
#endif

string result = lines.First(x =>
x.Contains("name=", StringComparison.CurrentCultureIgnoreCase))
Expand Down
16 changes: 8 additions & 8 deletions PlatformKit/Platforms/Providers/DarwinPlatformProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This Source Code Form is subject to the terms of the Mozilla Public
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

using AlastairLundy.Extensions.Processes;
using CliRunner;
using CliRunner.Abstractions;
using CliRunner.Builders;
Expand All @@ -39,9 +39,9 @@ namespace PlatformKit.Providers
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
public class DarwinPlatformProvider : UnixPlatformProvider, IDarwinPlatformProvider
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;

public DarwinPlatformProvider(ICommandRunner commandRunner) : base(commandRunner)
public DarwinPlatformProvider(ICliCommandRunner commandRunner) : base(commandRunner)
{
_commandRunner = commandRunner;
}
Expand Down Expand Up @@ -104,10 +104,10 @@ private async Task<Version> GetDarwinVersionAsync()
{
if (OperatingSystem.IsMacOS() == true || OperatingSystem.IsMacCatalyst() == true)
{
ICommandBuilder commandBuilder = new CommandBuilder("/usr/bin/uname")
ICliCommandBuilder commandBuilder = new CliCommandBuilder("/usr/bin/uname")
.WithArguments($"-m");

Command command = commandBuilder.Build();
CliCommand command = commandBuilder.Build();

BufferedProcessResult result = await _commandRunner.ExecuteBufferedAsync(command);

Expand Down Expand Up @@ -176,9 +176,9 @@ private string GetOsName()
#endif
private async Task<string> GetSwVersInfoAsync()
{
ICommandBuilder commandBuilder = new CommandBuilder("/usr/bin/sw_vers");
ICliCommandBuilder commandBuilder = new CliCommandBuilder("/usr/bin/sw_vers");

Command command = commandBuilder.Build();
CliCommand command = commandBuilder.Build();

BufferedProcessResult result = await _commandRunner.ExecuteBufferedAsync(command);

Expand Down Expand Up @@ -219,7 +219,7 @@ private async Task<Version> GetOsVersionAsync()
{
if (OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst())
{
ICommandBuilder commandBuilder = new CommandBuilder("/usr/bin/uname")
ICliCommandRunner commandBuilder = new CliCommandBuilder("/usr/bin/uname")
.WithArguments($"-v");

Command command = commandBuilder.Build();
Expand Down
4 changes: 2 additions & 2 deletions PlatformKit/Platforms/Providers/LinuxPlatformProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ namespace PlatformKit.Providers
{
public class LinuxPlatformProvider : UnixPlatformProvider, ILinuxPlatformProvider
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;
private readonly ILinuxOsReleaseProvider _linuxOsReleaseSearcher;

public LinuxPlatformProvider(ICommandRunner commandRunner,
public LinuxPlatformProvider(ICliCommandRunner commandRunner,
ILinuxOsReleaseProvider linuxOsReleaseSearcher)
: base(commandRunner)
{
Expand Down
10 changes: 5 additions & 5 deletions PlatformKit/Platforms/Providers/UnixPlatformProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This Source Code Form is subject to the terms of the Mozilla Public
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

using AlastairLundy.Extensions.Processes;
using CliRunner;
using CliRunner.Abstractions;
using CliRunner.Builders;
Expand All @@ -31,9 +31,9 @@ namespace PlatformKit.Providers
{
public class UnixPlatformProvider : IUnixPlatformProvider
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;

public UnixPlatformProvider(ICommandRunner commandRunner)
public UnixPlatformProvider(ICliCommandRunner commandRunner)
{
_commandRunner = commandRunner;
}
Expand Down Expand Up @@ -70,11 +70,11 @@ protected async Task<string> GetUnameValueAsync(string argument)
throw new PlatformNotSupportedException(Resources.Exceptions_PlatformNotSupported_FreeBsdOnly);
}

ICommandBuilder commandBuilder = new CommandBuilder("uname")
ICliCommandBuilder commandBuilder = new CliCommandBuilder("uname")
.WithArguments(argument)
.WithWorkingDirectory(Environment.CurrentDirectory);

Command command = commandBuilder.Build();
CliCommand command = commandBuilder.Build();

BufferedProcessResult result = await _commandRunner.ExecuteBufferedAsync(command);

Expand Down
10 changes: 4 additions & 6 deletions PlatformKit/Platforms/Providers/WindowsPlatformProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ This Source Code Form is subject to the terms of the Mozilla Public
using CliRunner.Builders;
using CliRunner.Builders.Abstractions;
using PlatformKit.Internal.Localizations;
using PlatformKit.Specializations.Windows;
using PlatformKit.Specializations.Windows.Abstractions;

using PlatformKit.Specifics;
using PlatformKit.Specifics.Abstractions;
Expand All @@ -33,10 +31,10 @@ namespace PlatformKit.Providers
{
public class WindowsPlatformProvider : IWindowsPlatformProvider
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;
private readonly IWindowsSystemInfoProvider _windowsSystemInfoProvider;

public WindowsPlatformProvider(ICommandRunner commandRunner, IWindowsSystemInfoProvider windowsSystemInfoProvider)
public WindowsPlatformProvider(ICliCommandRunner commandRunner, IWindowsSystemInfoProvider windowsSystemInfoProvider)
{
_commandRunner = commandRunner;
_windowsSystemInfoProvider = windowsSystemInfoProvider;
Expand Down Expand Up @@ -96,10 +94,10 @@ private async Task<Architecture> GetProcessorArchitectureAsync()
throw new PlatformNotSupportedException(Resources.Exceptions_PlatformNotSupported_WindowsOnly);
}

ICommandBuilder commandBuilder = new CommandBuilder("echo")
ICliCommandBuilder commandBuilder = new CliCommandBuilder("echo")
.WithArguments("%PROCESSOR_ARCHITECTURE%");

Command command = commandBuilder.Build();
CliCommand command = commandBuilder.Build();

var result = await _commandRunner.ExecuteBufferedAsync(command);

Expand Down
2 changes: 0 additions & 2 deletions PlatformKit/Platforms/Specifics/WindowsPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ This Source Code Form is subject to the terms of the Mozilla Public
using System;
using System.Runtime.InteropServices;

using PlatformKit.Specializations.Windows;

// ReSharper disable ConvertToPrimaryConstructor

namespace PlatformKit.Specifics;
Expand Down
10 changes: 5 additions & 5 deletions PlatformKit/Specializations/Mac/MacSystemProfilerInfoProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This Source Code Form is subject to the terms of the Mozilla Public
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;

using AlastairLundy.Extensions.Processes;
using CliRunner;
using CliRunner.Abstractions;
using CliRunner.Builders;
Expand All @@ -30,9 +30,9 @@ namespace PlatformKit.Specializations.Mac;

public class MacSystemProfilerInfoProvider : IMacSystemProfilerInfoProvider
{
private readonly ICommandRunner _commandRunner;
private readonly ICliCommandRunner _commandRunner;

public MacSystemProfilerInfoProvider(ICommandRunner commandRunner)
public MacSystemProfilerInfoProvider(ICliCommandRunner commandRunner)
{
_commandRunner = commandRunner;
}
Expand Down Expand Up @@ -124,12 +124,12 @@ public async Task<string> GetMacSystemProfilerValue(MacSystemProfilerDataType ma
throw new PlatformNotSupportedException(Resources.Exceptions_PlatformNotSupported_MacOnly);
}

ICommandBuilder commandBuilder = new CommandBuilder("/usr/bin/system_profiler")
ICliCommandBuilder commandBuilder = new CliCommandBuilder("/usr/bin/system_profiler")
.WithArguments("SP" + macSystemProfilerDataType)
.WithWorkingDirectory("/usr/bin/")
.WithValidation(ProcessResultValidation.None);

Command command = commandBuilder.Build();
CliCommand command = commandBuilder.Build();

BufferedProcessResult result = await _commandRunner.ExecuteBufferedAsync(command);

Expand Down

0 comments on commit 463ba5a

Please sign in to comment.