Move code to new projects

This commit is contained in:
Yaakov 2021-09-30 19:52:25 +10:00
parent d2281dc1ca
commit 81681c35e7
21 changed files with 48 additions and 54 deletions

View file

@ -1,8 +0,0 @@
using System;
namespace abstractions
{
public class Class1
{
}
}

View file

@ -3,7 +3,7 @@ using System.Collections.Immutable;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace Shamir.Console namespace Shamir.Abstractions
{ {
public static class CommandTreeExtensions public static class CommandTreeExtensions
{ {

View file

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Immutable; using System.Collections.Immutable;
namespace Shamir.Console namespace Shamir.Abstractions
{ {
public sealed class DefaultCommandTree : ICommandTree public sealed class DefaultCommandTree : ICommandTree
{ {

View file

@ -2,7 +2,7 @@ using System;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Shamir.Console namespace Shamir.Abstractions
{ {
public sealed class DefaultHelpTextCommand : ICommand public sealed class DefaultHelpTextCommand : ICommand
{ {

View file

@ -1,7 +1,7 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Shamir.Console namespace Shamir.Abstractions
{ {
public interface ICommand : IOperationsNode public interface ICommand : IOperationsNode
{ {

View file

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Immutable; using System.Collections.Immutable;
namespace Shamir.Console namespace Shamir.Abstractions
{ {
public interface ICommandTree : IOperationsNode public interface ICommandTree : IOperationsNode
{ {

View file

@ -1,4 +1,4 @@
namespace Shamir.Console namespace Shamir.Abstractions
{ {
public interface IOperationsNode public interface IOperationsNode
{ {

View file

@ -5,7 +5,7 @@ using CommandLine;
using CommandLine.Text; using CommandLine.Text;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Shamir.Console namespace Shamir.Abstractions
{ {
public abstract class ParsedArgumentsCommand<TOptions> : ICommand public abstract class ParsedArgumentsCommand<TOptions> : ICommand
{ {

View file

@ -4,6 +4,12 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<RootNamespace>Shamir.Abstractions</RootNamespace> <RootNamespace>Shamir.Abstractions</RootNamespace>
<AssemblyName>Shamir.Abstractions</AssemblyName> <AssemblyName>Shamir.Abstractions</AssemblyName>
<Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
</ItemGroup>
</Project> </Project>

View file

@ -1,8 +0,0 @@
using System;
namespace azure
{
public class Class1
{
}
}

View file

@ -5,10 +5,11 @@ using System.Threading.Tasks;
using Azure.Storage.Blobs; using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models; using Azure.Storage.Blobs.Models;
using CommandLine; using CommandLine;
using Shamir.Abstractions;
namespace Shamir.Console namespace Shamir.Commands.Azure
{ {
public class StorageCopyOptions public sealed class StorageCopyOptions
{ {
[Option("connection-string", Required = false, HelpText = "Azure Storage connection string for the Storage Account backing the CDN.")] [Option("connection-string", Required = false, HelpText = "Azure Storage connection string for the Storage Account backing the CDN.")]
public string? ConnectionString { get; set; } public string? ConnectionString { get; set; }
@ -53,7 +54,7 @@ namespace Shamir.Console
var client = new BlobContainerClient(connectionString, containerName); var client = new BlobContainerClient(connectionString, containerName);
await client.CreateIfNotExistsAsync(PublicAccessType.Blob); await client.CreateIfNotExistsAsync(PublicAccessType.Blob);
using var blobStream = inputIsStdInputStream ? System.Console.OpenStandardInput() : File.OpenRead(options.LocalPath); using var blobStream = inputIsStdInputStream ? Console.OpenStandardInput() : File.OpenRead(options.LocalPath);
var response = await client.UploadBlobAsync(path, blobStream); var response = await client.UploadBlobAsync(path, blobStream);
return 0; return 0;

View file

@ -7,10 +7,11 @@ using Azure.Storage.Blobs.Models;
using Azure.Storage.Sas; using Azure.Storage.Sas;
using CommandLine; using CommandLine;
using Microsoft.Azure.Storage; using Microsoft.Azure.Storage;
using Shamir.Abstractions;
namespace Shamir.Console namespace Shamir.Commands.Azure
{ {
public class StorageGetUrlOptions public sealed class StorageGetUrlOptions
{ {
[Option("connection-string", Required = false, HelpText = "Azure Storage connection string for the Storage Account backing the CDN.")] [Option("connection-string", Required = false, HelpText = "Azure Storage connection string for the Storage Account backing the CDN.")]
public string? ConnectionString { get; set; } public string? ConnectionString { get; set; }
@ -66,7 +67,7 @@ namespace Shamir.Console
uri.Query = parameters.ToString(); uri.Query = parameters.ToString();
} }
System.Console.WriteLine(uri.Uri.AbsoluteUri); Console.WriteLine(uri.Uri.AbsoluteUri);
return 0; return 0;
} }

View file

@ -2,10 +2,11 @@ using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Azure.Storage.Blobs; using Azure.Storage.Blobs;
using CommandLine; using CommandLine;
using Shamir.Abstractions;
namespace Shamir.Console namespace Shamir.Commands.Azure
{ {
public class StorageLsOptions public sealed class StorageLsOptions
{ {
[Option("connection-string", Required = false, HelpText = "Azure Storage connection string for the Storage Account backing the CDN.")] [Option("connection-string", Required = false, HelpText = "Azure Storage connection string for the Storage Account backing the CDN.")]
public string? ConnectionString { get; set; } public string? ConnectionString { get; set; }
@ -38,9 +39,9 @@ namespace Shamir.Console
await foreach (var blob in containerClient.GetBlobsAsync()) await foreach (var blob in containerClient.GetBlobsAsync())
{ {
System.Console.Write(container.Name); Console.Write(container.Name);
System.Console.Write('/'); Console.Write('/');
System.Console.WriteLine(blob.Name); Console.WriteLine(blob.Name);
} }
} }
} }
@ -49,7 +50,7 @@ namespace Shamir.Console
var client = new BlobServiceClient(connectionString); var client = new BlobServiceClient(connectionString);
await foreach (var container in client.GetBlobContainersAsync()) await foreach (var container in client.GetBlobContainersAsync())
{ {
System.Console.WriteLine(container.Name); Console.WriteLine(container.Name);
} }
} }
} }
@ -60,9 +61,9 @@ namespace Shamir.Console
await foreach (var blob in client.GetBlobsAsync()) await foreach (var blob in client.GetBlobsAsync())
{ {
System.Console.Write(containerName); Console.Write(containerName);
System.Console.Write('/'); Console.Write('/');
System.Console.WriteLine(blob.Name); Console.WriteLine(blob.Name);
} }
} }
else else
@ -75,16 +76,16 @@ namespace Shamir.Console
var client = new BlobContainerClient(connectionString, containerName); var client = new BlobContainerClient(connectionString, containerName);
await foreach (var blob in client.GetBlobsByHierarchyAsync(default, default, delimiter: "/", prefix)) await foreach (var blob in client.GetBlobsByHierarchyAsync(default, default, delimiter: "/", prefix))
{ {
System.Console.Write(containerName); Console.Write(containerName);
System.Console.Write('/'); Console.Write('/');
if (blob.IsPrefix) if (blob.IsPrefix)
{ {
System.Console.WriteLine(blob.Prefix); Console.WriteLine(blob.Prefix);
} }
else if (blob.IsBlob) else if (blob.IsBlob)
{ {
System.Console.WriteLine(blob.Blob.Name); Console.WriteLine(blob.Blob.Name);
} }
else else
{ {

View file

@ -4,8 +4,14 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<RootNamespace>Shamir.Commands.Azure</RootNamespace> <RootNamespace>Shamir.Commands.Azure</RootNamespace>
<AssemblyName>Shamir.Commands.Azure</AssemblyName> <AssemblyName>Shamir.Commands.Azure</AssemblyName>
<Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.10.0" />
<PackageReference Include="Microsoft.Azure.Storage.Common" Version="11.2.3" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\abstractions\abstractions.csproj" /> <ProjectReference Include="..\..\abstractions\abstractions.csproj" />
</ItemGroup> </ItemGroup>

View file

@ -1,8 +0,0 @@
using System;
namespace radio
{
public class Class1
{
}
}

View file

@ -5,8 +5,9 @@ using System.Net.Http;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommandLine; using CommandLine;
using Shamir.Abstractions;
namespace Shamir.Console namespace Shamir.Commands.Radio
{ {
public class VKLookupOptions public class VKLookupOptions
{ {

View file

@ -4,6 +4,7 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<RootNamespace>Shamir.Commands.Radio</RootNamespace> <RootNamespace>Shamir.Commands.Radio</RootNamespace>
<AssemblyName>Shamir.Commands.Radio</AssemblyName> <AssemblyName>Shamir.Commands.Radio</AssemblyName>
<Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -2,6 +2,9 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using CommandLine; using CommandLine;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Shamir.Abstractions;
using Shamir.Commands.Azure;
using Shamir.Commands.Radio;
namespace Shamir.Console namespace Shamir.Console
{ {

View file

@ -9,9 +9,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.10.0" />
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.Azure.Storage.Common" Version="11.2.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
</ItemGroup> </ItemGroup>

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Threading.Tasks; using System.Threading.Tasks;
using NUnit.Framework; using NUnit.Framework;
using Shamir.Abstractions; // TODO: Restructure test project(s)
namespace Shamir.Console.Tests namespace Shamir.Console.Tests
{ {