Commit 50bf6987 authored by Tristan Smith's avatar Tristan Smith
Browse files

Cleanup from experimentation

parent 11c703be
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelUserStore">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.ContentStream/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.ContentStream/riderModule.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="vcsConfiguration" value="2" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../.." />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
DiscordUpdates
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.*" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DiscordUpdates.Common\DiscordUpdates.Common.csproj" />
</ItemGroup>
</Project>
using System;
using System.Threading;
using System.Threading.Tasks;
using DiscordUpdates.Common;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.Logging;
namespace ClientTest
{
static class Program
{
private static async Task Main(string[] args)
{
var connection = new NotificationHubClient("http://localhost:5000/notifications");
connection.RegisterOnPublish((payload) =>
{
Console.WriteLine($"[{payload.Title}] -- {payload.Message}");
});
await connection.Hub.StartAsync();
while (connection.Hub.State == HubConnectionState.Connected ||
connection.Hub.State == HubConnectionState.Connecting)
{
}
}
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.*" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DiscordUpdates.Common\DiscordUpdates.Common.csproj" />
</ItemGroup>
</Project>
using System;
using System.Threading.Tasks;
using DiscordUpdates.Common;
using Microsoft.AspNetCore.SignalR.Client;
namespace ClientWriteTest
{
class Program
{
static async Task Main(string[] args)
{
var connection = new NotificationHubClient("http://localhost:5000/notifications");
await connection.Hub.StartAsync();
connection.RegisterOnPublish((payload) => { });
while (true)
{
var message = Console.ReadLine();
if (message != null)
await connection.Publish(new NotificationResponse
{Title = DateTimeOffset.Now.ToUnixTimeSeconds().ToString(), Message = message});
}
}
}
}
\ No newline at end of file
......@@ -2,12 +2,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{2DC7599E-0F49-4AD4-8AA3-A1023D0201D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientTest", "ClientTest\ClientTest.csproj", "{1DB4F748-4EED-4E3C-9BF6-4B837FB39D78}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientWriteTest", "ClientWriteTest\ClientWriteTest.csproj", "{9CE8B486-78FA-4BEC-81CD-820ACE7B1CA8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscordUpdates.Common", "DiscordUpdates.Common\DiscordUpdates.Common.csproj", "{7669ADF8-C100-44C0-BACA-6B5D9A9A5195}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Website", "Website\Website.csproj", "{2F4A2E34-3094-431C-9477-C06EB2A3D92F}"
EndProject
Global
......@@ -20,18 +14,6 @@ Global
{2DC7599E-0F49-4AD4-8AA3-A1023D0201D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DC7599E-0F49-4AD4-8AA3-A1023D0201D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2DC7599E-0F49-4AD4-8AA3-A1023D0201D2}.Release|Any CPU.Build.0 = Release|Any CPU
{1DB4F748-4EED-4E3C-9BF6-4B837FB39D78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DB4F748-4EED-4E3C-9BF6-4B837FB39D78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DB4F748-4EED-4E3C-9BF6-4B837FB39D78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DB4F748-4EED-4E3C-9BF6-4B837FB39D78}.Release|Any CPU.Build.0 = Release|Any CPU
{9CE8B486-78FA-4BEC-81CD-820ACE7B1CA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9CE8B486-78FA-4BEC-81CD-820ACE7B1CA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9CE8B486-78FA-4BEC-81CD-820ACE7B1CA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9CE8B486-78FA-4BEC-81CD-820ACE7B1CA8}.Release|Any CPU.Build.0 = Release|Any CPU
{7669ADF8-C100-44C0-BACA-6B5D9A9A5195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7669ADF8-C100-44C0-BACA-6B5D9A9A5195}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7669ADF8-C100-44C0-BACA-6B5D9A9A5195}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7669ADF8-C100-44C0-BACA-6B5D9A9A5195}.Release|Any CPU.Build.0 = Release|Any CPU
{2F4A2E34-3094-431C-9477-C06EB2A3D92F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F4A2E34-3094-431C-9477-C06EB2A3D92F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F4A2E34-3094-431C-9477-C06EB2A3D92F}.Release|Any CPU.ActiveCfg = Release|Any CPU
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.*" />
</ItemGroup>
</Project>
using System.Threading.Tasks;
namespace DiscordUpdates.Common
{
public interface INotificationHub
{
Task Publish(NotificationResponse notificationResponse);
Task OnPublish(NotificationResponse notificationResponse);
}
}
\ No newline at end of file
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.Logging;
namespace DiscordUpdates.Common
{
public class NotificationHubClient : INotificationHub
{
public HubConnection Hub { get; private set; }
public NotificationHubClient(string endpoint)
{
Hub = new HubConnectionBuilder()
.WithUrl(endpoint)
.ConfigureLogging(_ =>
{
_.SetMinimumLevel(LogLevel.Debug);
_.AddConsole();
})
.Build();
}
public IDisposable RegisterOnPublish(Action<NotificationResponse> onPublish)
{
return Hub.On("OnPublish", onPublish);
}
public async Task Publish(NotificationResponse notificationResponse)
{
await Hub.InvokeAsync(nameof(INotificationHub.Publish), notificationResponse);
}
public async Task OnPublish(NotificationResponse notificationResponse)
{
await Hub.InvokeAsync(nameof(INotificationHub.OnPublish), notificationResponse);
}
}
}
\ No newline at end of file
namespace DiscordUpdates.Common
{
public struct NotificationResponse
{
public string Title;
public string Message;
}
}
\ No newline at end of file
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Website
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment