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.Text;
namespace Shamir.Console
namespace Shamir.Abstractions
{
public static class CommandTreeExtensions
{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,6 +4,12 @@
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Shamir.Abstractions</RootNamespace>
<AssemblyName>Shamir.Abstractions</AssemblyName>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
</ItemGroup>
</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.Models;
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.")]
public string? ConnectionString { get; set; }
@ -53,7 +54,7 @@ namespace Shamir.Console
var client = new BlobContainerClient(connectionString, containerName);
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);
return 0;

View file

@ -7,10 +7,11 @@ using Azure.Storage.Blobs.Models;
using Azure.Storage.Sas;
using CommandLine;
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.")]
public string? ConnectionString { get; set; }
@ -66,7 +67,7 @@ namespace Shamir.Console
uri.Query = parameters.ToString();
}
System.Console.WriteLine(uri.Uri.AbsoluteUri);
Console.WriteLine(uri.Uri.AbsoluteUri);
return 0;
}

View file

@ -2,10 +2,11 @@ using System;
using System.Threading.Tasks;
using Azure.Storage.Blobs;
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.")]
public string? ConnectionString { get; set; }
@ -38,9 +39,9 @@ namespace Shamir.Console
await foreach (var blob in containerClient.GetBlobsAsync())
{
System.Console.Write(container.Name);
System.Console.Write('/');
System.Console.WriteLine(blob.Name);
Console.Write(container.Name);
Console.Write('/');
Console.WriteLine(blob.Name);
}
}
}
@ -49,7 +50,7 @@ namespace Shamir.Console
var client = new BlobServiceClient(connectionString);
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())
{
System.Console.Write(containerName);
System.Console.Write('/');
System.Console.WriteLine(blob.Name);
Console.Write(containerName);
Console.Write('/');
Console.WriteLine(blob.Name);
}
}
else
@ -75,16 +76,16 @@ namespace Shamir.Console
var client = new BlobContainerClient(connectionString, containerName);
await foreach (var blob in client.GetBlobsByHierarchyAsync(default, default, delimiter: "/", prefix))
{
System.Console.Write(containerName);
System.Console.Write('/');
Console.Write(containerName);
Console.Write('/');
if (blob.IsPrefix)
{
System.Console.WriteLine(blob.Prefix);
Console.WriteLine(blob.Prefix);
}
else if (blob.IsBlob)
{
System.Console.WriteLine(blob.Blob.Name);
Console.WriteLine(blob.Blob.Name);
}
else
{

View file

@ -4,8 +4,14 @@
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Shamir.Commands.Azure</RootNamespace>
<AssemblyName>Shamir.Commands.Azure</AssemblyName>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.10.0" />
<PackageReference Include="Microsoft.Azure.Storage.Common" Version="11.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\abstractions\abstractions.csproj" />
</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.Threading.Tasks;
using CommandLine;
using Shamir.Abstractions;
namespace Shamir.Console
namespace Shamir.Commands.Radio
{
public class VKLookupOptions
{

View file

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

View file

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

View file

@ -9,9 +9,6 @@
</PropertyGroup>
<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" />
</ItemGroup>

View file

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