From 1c6e874069ff78cd2e8b57d82bd435fdaed6fc70 Mon Sep 17 00:00:00 2001 From: Gitii Date: Sun, 12 Jun 2022 16:04:50 +0200 Subject: [PATCH] Merge namespaces (#12) --- Community.Wsl.Sdk.Tests/CommandTests.cs | 1 - Community.Wsl.Sdk.Tests/DistroInfoTests.cs | 1 - Community.Wsl.Sdk.Tests/StreamDataReaderTests.cs | 1 - Community.Wsl.Sdk.Tests/StreamNullReaderTests.cs | 1 - Community.Wsl.Sdk.Tests/StreamStringReaderTests.cs | 1 - Community.Wsl.Sdk/{Strategies/Commands => }/Command.cs | 2 +- .../{Strategies/Commands => }/CommandStreams.cs | 2 +- Community.Wsl.Sdk/Community.Wsl.Sdk.csproj | 2 +- Community.Wsl.Sdk/{Strategies/Api => }/DistroFlags.cs | 4 ++-- Community.Wsl.Sdk/DistroInfo.cs | 1 - Community.Wsl.Sdk/{Strategies/Commands => }/ICommand.cs | 2 +- .../{Strategies/Commands => }/IStreamReader.cs | 2 +- Community.Wsl.Sdk/{Strategies/Api => }/IWslApi.cs | 2 +- .../{Strategies/Commands => }/StreamDataReader.cs | 7 ++----- .../{Strategies/Commands => }/StreamNullReader.cs | 2 +- .../{Strategies/Commands => }/StreamStringReader.cs | 2 +- Community.Wsl.Sdk/{Strategies/Api => }/WslApi.cs | 4 ++-- README.md | 1 + 18 files changed, 15 insertions(+), 23 deletions(-) rename Community.Wsl.Sdk/{Strategies/Commands => }/Command.cs (99%) rename Community.Wsl.Sdk/{Strategies/Commands => }/CommandStreams.cs (95%) rename Community.Wsl.Sdk/{Strategies/Api => }/DistroFlags.cs (94%) rename Community.Wsl.Sdk/{Strategies/Commands => }/ICommand.cs (89%) rename Community.Wsl.Sdk/{Strategies/Commands => }/IStreamReader.cs (94%) rename Community.Wsl.Sdk/{Strategies/Api => }/IWslApi.cs (98%) rename Community.Wsl.Sdk/{Strategies/Commands => }/StreamDataReader.cs (94%) rename Community.Wsl.Sdk/{Strategies/Commands => }/StreamNullReader.cs (85%) rename Community.Wsl.Sdk/{Strategies/Commands => }/StreamStringReader.cs (93%) rename Community.Wsl.Sdk/{Strategies/Api => }/WslApi.cs (97%) diff --git a/Community.Wsl.Sdk.Tests/CommandTests.cs b/Community.Wsl.Sdk.Tests/CommandTests.cs index 13c01b1..8dae822 100644 --- a/Community.Wsl.Sdk.Tests/CommandTests.cs +++ b/Community.Wsl.Sdk.Tests/CommandTests.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; -using Community.Wsl.Sdk.Strategies.Commands; using Community.Wsx.Shared; using FakeItEasy; using FluentAssertions; diff --git a/Community.Wsl.Sdk.Tests/DistroInfoTests.cs b/Community.Wsl.Sdk.Tests/DistroInfoTests.cs index de69c95..3c0326f 100644 --- a/Community.Wsl.Sdk.Tests/DistroInfoTests.cs +++ b/Community.Wsl.Sdk.Tests/DistroInfoTests.cs @@ -1,5 +1,4 @@ using System; -using Community.Wsl.Sdk.Strategies.Api; using FluentAssertions; using NUnit.Framework; diff --git a/Community.Wsl.Sdk.Tests/StreamDataReaderTests.cs b/Community.Wsl.Sdk.Tests/StreamDataReaderTests.cs index 97ce8e6..565ac1c 100644 --- a/Community.Wsl.Sdk.Tests/StreamDataReaderTests.cs +++ b/Community.Wsl.Sdk.Tests/StreamDataReaderTests.cs @@ -1,7 +1,6 @@ using System; using System.IO; using System.Threading.Tasks; -using Community.Wsl.Sdk.Strategies.Commands; using FluentAssertions; using NUnit.Framework; diff --git a/Community.Wsl.Sdk.Tests/StreamNullReaderTests.cs b/Community.Wsl.Sdk.Tests/StreamNullReaderTests.cs index 05e41a0..cf6b7d7 100644 --- a/Community.Wsl.Sdk.Tests/StreamNullReaderTests.cs +++ b/Community.Wsl.Sdk.Tests/StreamNullReaderTests.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using Community.Wsl.Sdk.Strategies.Commands; using FluentAssertions; using NUnit.Framework; diff --git a/Community.Wsl.Sdk.Tests/StreamStringReaderTests.cs b/Community.Wsl.Sdk.Tests/StreamStringReaderTests.cs index 6502424..dd532e9 100644 --- a/Community.Wsl.Sdk.Tests/StreamStringReaderTests.cs +++ b/Community.Wsl.Sdk.Tests/StreamStringReaderTests.cs @@ -1,5 +1,4 @@ using System.IO; -using Community.Wsl.Sdk.Strategies.Commands; using FluentAssertions; using NUnit.Framework; diff --git a/Community.Wsl.Sdk/Strategies/Commands/Command.cs b/Community.Wsl.Sdk/Command.cs similarity index 99% rename from Community.Wsl.Sdk/Strategies/Commands/Command.cs rename to Community.Wsl.Sdk/Command.cs index 68440c3..ed6cf3f 100644 --- a/Community.Wsl.Sdk/Strategies/Commands/Command.cs +++ b/Community.Wsl.Sdk/Command.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Community.Wsx.Shared; -namespace Community.Wsl.Sdk.Strategies.Commands; +namespace Community.Wsl.Sdk; public class Command : ICommand { diff --git a/Community.Wsl.Sdk/Strategies/Commands/CommandStreams.cs b/Community.Wsl.Sdk/CommandStreams.cs similarity index 95% rename from Community.Wsl.Sdk/Strategies/Commands/CommandStreams.cs rename to Community.Wsl.Sdk/CommandStreams.cs index 0601bc0..880bd04 100644 --- a/Community.Wsl.Sdk/Strategies/Commands/CommandStreams.cs +++ b/Community.Wsl.Sdk/CommandStreams.cs @@ -1,6 +1,6 @@ using System.IO; -namespace Community.Wsl.Sdk.Strategies.Commands; +namespace Community.Wsl.Sdk; /// /// Encapsulates the io stream of a . diff --git a/Community.Wsl.Sdk/Community.Wsl.Sdk.csproj b/Community.Wsl.Sdk/Community.Wsl.Sdk.csproj index f35b313..6f026e9 100644 --- a/Community.Wsl.Sdk/Community.Wsl.Sdk.csproj +++ b/Community.Wsl.Sdk/Community.Wsl.Sdk.csproj @@ -4,7 +4,7 @@ net6.0-windows windows SDK for Windows Subsystem for Linux for .NET 6 - (c) 2022 Gitii + (c) 2021 Gitii https://github.com/Gitii/community.wsl.sdk True true diff --git a/Community.Wsl.Sdk/Strategies/Api/DistroFlags.cs b/Community.Wsl.Sdk/DistroFlags.cs similarity index 94% rename from Community.Wsl.Sdk/Strategies/Api/DistroFlags.cs rename to Community.Wsl.Sdk/DistroFlags.cs index b374f75..8b0d0ba 100644 --- a/Community.Wsl.Sdk/Strategies/Api/DistroFlags.cs +++ b/Community.Wsl.Sdk/DistroFlags.cs @@ -1,6 +1,6 @@ using System; -namespace Community.Wsl.Sdk.Strategies.Api; +namespace Community.Wsl.Sdk; /// /// The enumeration specifies the behavior of a distribution in the Windows Subsystem for Linux (WSL). @@ -27,4 +27,4 @@ public enum DistroFlags /// Automatically mount Windows drives inside of WSL sessions (for example, "C:" will be available under "/mnt/c"). /// EnableDriveMouting = 0x4 -} \ No newline at end of file +} diff --git a/Community.Wsl.Sdk/DistroInfo.cs b/Community.Wsl.Sdk/DistroInfo.cs index 50b1eba..6077e30 100644 --- a/Community.Wsl.Sdk/DistroInfo.cs +++ b/Community.Wsl.Sdk/DistroInfo.cs @@ -1,5 +1,4 @@ using System; -using Community.Wsl.Sdk.Strategies.Api; namespace Community.Wsl.Sdk; diff --git a/Community.Wsl.Sdk/Strategies/Commands/ICommand.cs b/Community.Wsl.Sdk/ICommand.cs similarity index 89% rename from Community.Wsl.Sdk/Strategies/Commands/ICommand.cs rename to Community.Wsl.Sdk/ICommand.cs index b92a44a..e43ad74 100644 --- a/Community.Wsl.Sdk/Strategies/Commands/ICommand.cs +++ b/Community.Wsl.Sdk/ICommand.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; -namespace Community.Wsl.Sdk.Strategies.Commands; +namespace Community.Wsl.Sdk; public interface ICommand : IDisposable { diff --git a/Community.Wsl.Sdk/Strategies/Commands/IStreamReader.cs b/Community.Wsl.Sdk/IStreamReader.cs similarity index 94% rename from Community.Wsl.Sdk/Strategies/Commands/IStreamReader.cs rename to Community.Wsl.Sdk/IStreamReader.cs index 28ab7ae..58d2b9e 100644 --- a/Community.Wsl.Sdk/Strategies/Commands/IStreamReader.cs +++ b/Community.Wsl.Sdk/IStreamReader.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Community.Wsl.Sdk.Strategies.Commands; +namespace Community.Wsl.Sdk; internal interface IStreamReader { diff --git a/Community.Wsl.Sdk/Strategies/Api/IWslApi.cs b/Community.Wsl.Sdk/IWslApi.cs similarity index 98% rename from Community.Wsl.Sdk/Strategies/Api/IWslApi.cs rename to Community.Wsl.Sdk/IWslApi.cs index e549a9d..d4c22cc 100644 --- a/Community.Wsl.Sdk/Strategies/Api/IWslApi.cs +++ b/Community.Wsl.Sdk/IWslApi.cs @@ -3,7 +3,7 @@ using System.IO; using System.Linq; -namespace Community.Wsl.Sdk.Strategies.Api; +namespace Community.Wsl.Sdk; /// /// Provides functionality to help you call WSL from .NET applications. diff --git a/Community.Wsl.Sdk/Strategies/Commands/StreamDataReader.cs b/Community.Wsl.Sdk/StreamDataReader.cs similarity index 94% rename from Community.Wsl.Sdk/Strategies/Commands/StreamDataReader.cs rename to Community.Wsl.Sdk/StreamDataReader.cs index efa1004..67ba9a1 100644 --- a/Community.Wsl.Sdk/Strategies/Commands/StreamDataReader.cs +++ b/Community.Wsl.Sdk/StreamDataReader.cs @@ -3,7 +3,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Community.Wsl.Sdk.Strategies.Commands; +namespace Community.Wsl.Sdk; internal class StreamDataReader : IStreamReader { @@ -45,10 +45,7 @@ public void Fetch() var data = stream.ToArray(); Finished(data); } - ) - { - IsBackground = true - }; + ) { IsBackground = true }; _thread.Start(); } diff --git a/Community.Wsl.Sdk/Strategies/Commands/StreamNullReader.cs b/Community.Wsl.Sdk/StreamNullReader.cs similarity index 85% rename from Community.Wsl.Sdk/Strategies/Commands/StreamNullReader.cs rename to Community.Wsl.Sdk/StreamNullReader.cs index effbd44..7a6160f 100644 --- a/Community.Wsl.Sdk/Strategies/Commands/StreamNullReader.cs +++ b/Community.Wsl.Sdk/StreamNullReader.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Community.Wsl.Sdk.Strategies.Commands; +namespace Community.Wsl.Sdk; internal class StreamNullReader : IStreamReader { diff --git a/Community.Wsl.Sdk/Strategies/Commands/StreamStringReader.cs b/Community.Wsl.Sdk/StreamStringReader.cs similarity index 93% rename from Community.Wsl.Sdk/Strategies/Commands/StreamStringReader.cs rename to Community.Wsl.Sdk/StreamStringReader.cs index b77fe7a..bda7fb4 100644 --- a/Community.Wsl.Sdk/Strategies/Commands/StreamStringReader.cs +++ b/Community.Wsl.Sdk/StreamStringReader.cs @@ -1,6 +1,6 @@ using System.IO; -namespace Community.Wsl.Sdk.Strategies.Commands; +namespace Community.Wsl.Sdk; internal class StreamStringReader : StreamDataReader { diff --git a/Community.Wsl.Sdk/Strategies/Api/WslApi.cs b/Community.Wsl.Sdk/WslApi.cs similarity index 97% rename from Community.Wsl.Sdk/Strategies/Api/WslApi.cs rename to Community.Wsl.Sdk/WslApi.cs index 169f926..b9df1c6 100644 --- a/Community.Wsl.Sdk/Strategies/Api/WslApi.cs +++ b/Community.Wsl.Sdk/WslApi.cs @@ -4,7 +4,7 @@ using System.Linq; using Community.Wsx.Shared; -namespace Community.Wsl.Sdk.Strategies.Api; +namespace Community.Wsl.Sdk; /// /// @@ -96,7 +96,7 @@ public IReadOnlyList GetDistroList() (keyName) => ReadFromRegistryKey( lxssKey.OpenSubKey(keyName)!, - Guid.Parse(keyName), + Guid.Parse((string)keyName), defaultGuid ) ) diff --git a/README.md b/README.md index 6b1b296..ec4e607 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ Breaking changes: * Support for Net. 5 has been removed. Net. 5 is [out of support since May 10, 2022](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core). * Support for .NET Core 3.1 has been removed. .NET Core 3.1 will be [out of support after December 13, 2022](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core). * Migrated to `Community.Wsx.Shared` (replaces most interfaces and implementations for ) +* Moved classes & interfaces in `Strategies.{Api,Commands}.*` to root namespace. Please upgrade to a newer .NET and .NET Core runtime version. The minimum supported Net. version is Net. 6.