Skip to content

Commit

Permalink
project reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean McBeth committed Dec 3, 2023
1 parent ff1a0c5 commit acd4f8a
Show file tree
Hide file tree
Showing 357 changed files with 1,440 additions and 667 deletions.
2 changes: 1 addition & 1 deletion src/Juniper.AppShell/Juniper.AppShell.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Juniper.Root\Juniper.Root.csproj" />
<ProjectReference Include="..\Juniper.Server\Juniper.Server.csproj" />
<ProjectReference Include="..\Juniper.TSBuild.Core\Juniper.TSBuild.Core.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Juniper.Progress;

namespace Juniper.IO;
namespace Juniper.Caching;

public abstract class AbstractStreamSource : ContentReference
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System.Collections;

namespace Juniper.IO;
namespace Juniper.Caching;

/// <summary>
/// A collection of source and destination layers for file content. Files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.Globalization;

namespace Juniper.IO;
namespace Juniper.Caching;

public class ContentReference : IEquatable<ContentReference>
{
public static bool operator ==(ContentReference left, ContentReference right)
{
return (left is null && right is null)
|| (left is not null && left.Equals(right));
return left is null && right is null
|| left is not null && left.Equals(right);
}

public static bool operator !=(ContentReference left, ContentReference right)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Juniper.IO;
using Juniper.Progress;

namespace Juniper.IO;
namespace Juniper.Caching;

public class FileCacheLayer : ICacheDestinationLayer
{
Expand Down Expand Up @@ -100,7 +101,7 @@ public IEnumerable<ContentReference> GetContentReferences(MediaType ofType)
{
var shortName = file.Name;
var cacheID = PathExt.RemoveShortExtension(shortName);
yield return cacheID + ofType;
yield return new ContentReference(cacheID, ofType);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Juniper.IO;
namespace Juniper.Caching;

public interface ICacheDestinationLayer : ICacheSourceLayer
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Juniper.IO;
using Juniper.Progress;

namespace Juniper.IO;
namespace Juniper.Caching;

public static class ICacheDestinationLayerExt
{
Expand Down Expand Up @@ -93,7 +94,7 @@ public static void SaveJson<ResultType>(
}

var serializer = new JsonFactory<ResultType>();
var fileRef = fileName + MediaType.Application_Json;
var fileRef = new ContentReference(fileName, MediaType.Application_Json);
using var stream = layer.Create(fileRef);
_ = serializer.Serialize(stream, value);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Juniper.Progress;

namespace Juniper.IO;
namespace Juniper.Caching;

public interface ICacheSourceLayer
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Juniper.IO;
using Juniper.Progress;

namespace Juniper.IO;
namespace Juniper.Caching;


public static class ICacheSourceLayerExt
Expand Down Expand Up @@ -47,7 +48,7 @@ public static class ICacheSourceLayerExt
var progs = prog.Split("Read", "Decode");
using var stream = await layer
.GetStreamAsync(fileRef, progs[0])
.ConfigureAwait(false)
.ConfigureAwait(false)
?? throw new FileNotFoundException(fileRef.FileName);

using var progStream = new ProgressStream(stream, stream.Length, progs[1], false);
Expand Down Expand Up @@ -84,7 +85,7 @@ public static bool TryLoadJson<ResultT>(
where ResultT : class
{
var deserializer = new JsonFactory<ResultT>();
var fileRef = name + MediaType.Application_Json;
var fileRef = new ContentReference(name, MediaType.Application_Json);

return layer.TryLoad(deserializer, fileRef, out value, prog);
}
Expand Down
40 changes: 40 additions & 0 deletions src/Juniper.Caching/Juniper.Caching.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Juniper.Caching</AssemblyName>
<RootNamespace>Juniper.Caching</RootNamespace>
<PackageId>SeanMcBeth.Juniper.Caching</PackageId>
<OutputType>Library</OutputType>
<TargetFramework>net7.0</TargetFramework>
<Authors>Sean T. McBeth</Authors>
<Copyright>Copyright © Sean T. McBeth 2019</Copyright>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Description>General purpose code</Description>
<PackageProjectUrl>https://github.com/capnmidnight/Juniper</PackageProjectUrl>
<PackageIcon>logo_juniper.min.png</PackageIcon>
<RepositoryUrl>https://github.com/capnmidnight/Juniper</RepositoryUrl>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x64</Platforms>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Juniper.IO\Juniper.IO.csproj" />
<ProjectReference Include="..\Juniper.MediaType\Juniper.MediaType.csproj" />
<ProjectReference Include="..\Juniper.Progress\Juniper.Progress.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Juniper.IO;
using Juniper.Progress;

using System.Collections.Concurrent;

namespace Juniper.IO;
namespace Juniper.Caching;

public class MemoryCacheLayer : ICacheDestinationLayer
{
Expand Down Expand Up @@ -61,7 +62,7 @@ public IEnumerable<ContentReference> GetContentReferences(MediaType ofType)
{
foreach (var cacheID in store[ofType].Keys)
{
yield return cacheID + ofType;
yield return new ContentReference(cacheID, ofType);
}
}
}
Expand All @@ -70,10 +71,10 @@ public bool Delete(ContentReference fileRef)
{
if (fileRef is null)
{
throw new System.ArgumentNullException(nameof(fileRef));
throw new ArgumentNullException(nameof(fileRef));
}

if (fileRef.CacheID is not null
if (fileRef.CacheID is not null
&& IsCached(fileRef))
{
return store[fileRef.ContentType]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Juniper.IO;
using Juniper.Progress;

namespace Juniper.IO;
namespace Juniper.Caching;


public static class StreamSourceExt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Juniper.IO;
using Juniper.Progress;

namespace Juniper.IO;
namespace Juniper.Caching;

public class StreamSourceLayer : ICacheSourceLayer
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Juniper.Collections;
using Juniper.Logic;

namespace Juniper.Collections;

public static class Graph
{
Expand Down
40 changes: 40 additions & 0 deletions src/Juniper.Collections/Juniper.Collections.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Juniper.Collections</AssemblyName>
<RootNamespace>Juniper.Collections</RootNamespace>
<PackageId>SeanMcBeth.Juniper.Collections</PackageId>
<OutputType>Library</OutputType>
<TargetFramework>net7.0</TargetFramework>
<Authors>Sean T. McBeth</Authors>
<Copyright>Copyright © Sean T. McBeth 2019</Copyright>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Description>General purpose code</Description>
<PackageProjectUrl>https://github.com/capnmidnight/Juniper</PackageProjectUrl>
<PackageIcon>logo_juniper.min.png</PackageIcon>
<RepositoryUrl>https://github.com/capnmidnight/Juniper</RepositoryUrl>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x64</Platforms>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Juniper.IO\Juniper.IO.csproj" />
<ProjectReference Include="..\Juniper.Logic\Juniper.Logic.csproj" />
<ProjectReference Include="..\Juniper.MediaType\Juniper.MediaType.csproj" />
</ItemGroup>

</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions src/Juniper.Data/Juniper.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.14" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Juniper.Root\Juniper.Root.csproj" />
</ItemGroup>

</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 66 additions & 0 deletions src/Juniper.HTTP/ISerializerExt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using Juniper.HTTP;

using System.Net.WebSockets;
using System.Text;

namespace Juniper.IO;

public static class ISerializerExt
{
public static void Serialize<T, M>(this ISerializer<T, M> serializer, HttpRequestMessage request, MediaType type, T value)
where M : MediaType
{
if (serializer is null)
{
throw new ArgumentNullException(nameof(serializer));
}

if (request is null)
{
throw new ArgumentNullException(nameof(request));
}

var stream = serializer.GetStream(value);
request.Body(new StreamContent(stream), type);
}

public static Task SerializeAsync<T, M, U>(this ISerializer<T, M> serializer, WebSocketConnection<U> socket, T value)
where M : MediaType
where U : WebSocket
{
if (serializer is null)
{
throw new ArgumentNullException(nameof(serializer));
}

if (socket is null)
{
throw new ArgumentNullException(nameof(socket));
}

var data = serializer.Serialize(value);
return socket.SendAsync(data);
}

public static Task SerializeAsync<T, M, U>(this ISerializer<T, M> serializer, WebSocketConnection<U> socket, string message, T value)
where M : MediaType
where U : WebSocket
{
if (serializer is null)
{
throw new ArgumentNullException(nameof(serializer));
}

if (socket is null)
{
throw new ArgumentNullException(nameof(socket));
}

if (message is null)
{
throw new ArgumentNullException(nameof(message));
}

return socket.SendAsync(message, value, serializer);
}
}
40 changes: 40 additions & 0 deletions src/Juniper.HTTP/Juniper.HTTP.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Juniper.HTTP</AssemblyName>
<RootNamespace>Juniper.HTTP</RootNamespace>
<PackageId>SeanMcBeth.Juniper.HTTP</PackageId>
<OutputType>Library</OutputType>
<TargetFramework>net7.0</TargetFramework>
<Authors>Sean T. McBeth</Authors>
<Copyright>Copyright © Sean T. McBeth 2019</Copyright>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Description>General purpose code</Description>
<PackageProjectUrl>https://github.com/capnmidnight/Juniper</PackageProjectUrl>
<PackageIcon>logo_juniper.min.png</PackageIcon>
<RepositoryUrl>https://github.com/capnmidnight/Juniper</RepositoryUrl>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x64</Platforms>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Juniper.Caching\Juniper.Caching.csproj" />
<ProjectReference Include="..\Juniper.IO\Juniper.IO.csproj" />
<ProjectReference Include="..\Juniper.MediaType\Juniper.MediaType.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Juniper.Caching;
using Juniper.IO;
using Juniper.Progress;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit acd4f8a

Please sign in to comment.