mirror of
https://github.com/yaakov-h/Shamir.git
synced 2025-01-18 16:56:33 +00:00
Move code to new projects
This commit is contained in:
parent
d2281dc1ca
commit
81681c35e7
21 changed files with 48 additions and 54 deletions
|
@ -1,8 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace abstractions
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
||||||
{
|
{
|
|
@ -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
|
||||||
{
|
{
|
|
@ -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
|
||||||
{
|
{
|
|
@ -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
|
||||||
{
|
{
|
|
@ -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
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Shamir.Console
|
namespace Shamir.Abstractions
|
||||||
{
|
{
|
||||||
public interface IOperationsNode
|
public interface IOperationsNode
|
||||||
{
|
{
|
|
@ -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
|
||||||
{
|
{
|
|
@ -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>
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace azure
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
@ -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;
|
||||||
}
|
}
|
|
@ -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
|
||||||
{
|
{
|
|
@ -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>
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace radio
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
||||||
{
|
{
|
|
@ -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>
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue