Runnable launcher using new client
This commit is contained in:
parent
9050722890
commit
aaf65fcf09
10 changed files with 43 additions and 36 deletions
|
|
@ -85,7 +85,7 @@ namespace LANCommander.Launcher.Services
|
|||
FileId = Guid.NewGuid(),
|
||||
Type = SDK.Enums.MediaType.Avatar,
|
||||
MimeType = MediaTypeNames.Image.Png,
|
||||
Crc32 = await SDK.Services.MediaService.CalculateChecksumAsync(tempAvatarPath),
|
||||
Crc32 = await SDK.Services.MediaClient.CalculateChecksumAsync(tempAvatarPath),
|
||||
UserId = remoteProfile.Id,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
@using System.Management.Automation.Remoting
|
||||
@using LANCommander.Launcher.Models
|
||||
@using LANCommander.SDK
|
||||
@using LANCommander.SDK.Rpc.Client
|
||||
@using Photino.Blazor.CustomWindow.Components
|
||||
@using ConnectionState = LANCommander.Launcher.Models.ConnectionState
|
||||
@inherits LayoutComponentBase
|
||||
|
|
@ -16,6 +17,7 @@
|
|||
@inject ILogger<MainLayout> Logger
|
||||
@inject ImportManagerService ImportManagerService
|
||||
@inject LocalizationService LocalizationService
|
||||
@inject IRpcClient RpcClient
|
||||
|
||||
<CustomWindow HeaderHeight="37">
|
||||
<HeaderExtraControlsLayout>
|
||||
|
|
@ -141,6 +143,8 @@
|
|||
await ImportManagerService.RequestImport();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
await RpcClient.ConnectAsync();
|
||||
|
||||
_crashQuips = new[]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@
|
|||
</div>
|
||||
|
||||
<script src="/_content/AntDesign/js/ant-design-blazor.js"></script>
|
||||
<script src="/_framework/blazor.webview.js"></script>
|
||||
<script src="/_content/XtermBlazor/XtermBlazor.min.js"></script>
|
||||
<script src="/_content/Photino.Blazor.CustomWindow/js/js-extensions.js"></script>
|
||||
<script src="/_content/Photino.Blazor.CustomWindow/js/pb-custom-window.js"></script>
|
||||
<script src="/_content/LANCommander.UI/bundle.js"></script>
|
||||
<script src="/_content/PSC.Blazor.Components.MarkdownEditor/js/easymde.min.js"></script>
|
||||
<script src="/_content/PSC.Blazor.Components.MarkdownEditor/js/markdownEditor.js"></script>
|
||||
<script src="/_framework/blazor.webview.js"></script>
|
||||
|
||||
<script>
|
||||
XtermBlazor.registerAddons({
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class Client(
|
|||
LauncherClient launcherClient,
|
||||
LibraryClient libraryClient,
|
||||
LobbyClient lobbyClient,
|
||||
MediaService mediaClient,
|
||||
MediaClient mediaClient,
|
||||
PlaySessionClient playSessionClient,
|
||||
ProfileClient profileClient,
|
||||
RedistributableClient redistributableClient,
|
||||
|
|
@ -32,7 +32,7 @@ public class Client(
|
|||
public LauncherClient Launcher = launcherClient;
|
||||
public LibraryClient Library = libraryClient;
|
||||
public LobbyClient Lobbies = lobbyClient;
|
||||
public MediaService Media = mediaClient;
|
||||
public MediaClient Media = mediaClient;
|
||||
public PlaySessionClient PlaySessions = playSessionClient;
|
||||
public ProfileClient Profile = profileClient;
|
||||
public RedistributableClient Redistributables = redistributableClient;
|
||||
|
|
|
|||
|
|
@ -15,29 +15,29 @@ public static class IServiceCollectionExtensions
|
|||
services.AddSingleton<ITokenProvider, TokenProvider>();
|
||||
services.AddSingleton<INetworkInformationProvider, NetworkInformationProvider>();
|
||||
services.AddSingleton<IRpcClient, RpcClient>();
|
||||
services.AddScoped<ApiRequestFactory>();
|
||||
services.AddScoped<ProcessExecutionContextFactory>();
|
||||
services.AddSingleton<ApiRequestFactory>();
|
||||
services.AddSingleton<ProcessExecutionContextFactory>();
|
||||
|
||||
services.AddScoped<AuthenticationClient>();
|
||||
services.AddSingleton<AuthenticationClient>();
|
||||
services.AddSingleton<BeaconClient>();
|
||||
services.AddScoped<ChatClient>();
|
||||
services.AddSingleton<ChatClient>();
|
||||
services.AddSingleton<IConnectionClient, ConnectionClient>();
|
||||
services.AddScoped<DepotClient>();
|
||||
services.AddScoped<GameClient>();
|
||||
services.AddScoped<IssueClient>();
|
||||
services.AddScoped<LauncherClient>();
|
||||
services.AddScoped<LibraryClient>();
|
||||
services.AddScoped<LobbyClient>();
|
||||
services.AddScoped<MediaService>();
|
||||
services.AddScoped<PlaySessionClient>();
|
||||
services.AddScoped<ProfileClient>();
|
||||
services.AddScoped<RedistributableClient>();
|
||||
services.AddScoped<SaveClient>();
|
||||
services.AddScoped<ScriptClient>();
|
||||
services.AddScoped<ServerClient>();
|
||||
services.AddScoped<TagClient>();
|
||||
services.AddSingleton<DepotClient>();
|
||||
services.AddSingleton<GameClient>();
|
||||
services.AddSingleton<IssueClient>();
|
||||
services.AddSingleton<LauncherClient>();
|
||||
services.AddSingleton<LibraryClient>();
|
||||
services.AddSingleton<LobbyClient>();
|
||||
services.AddSingleton<MediaClient>();
|
||||
services.AddSingleton<PlaySessionClient>();
|
||||
services.AddSingleton<ProfileClient>();
|
||||
services.AddSingleton<RedistributableClient>();
|
||||
services.AddSingleton<SaveClient>();
|
||||
services.AddSingleton<ScriptClient>();
|
||||
services.AddSingleton<ServerClient>();
|
||||
services.AddSingleton<TagClient>();
|
||||
|
||||
services.AddScoped<Client>();
|
||||
services.AddSingleton<Client>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using LANCommander.SDK.Rpc.Client;
|
|||
|
||||
namespace LANCommander.SDK.Services;
|
||||
|
||||
public class ChatClient(IRpcClient rpc)
|
||||
public class ChatClient
|
||||
{
|
||||
private readonly Dictionary<Guid, ChatThread> _threads = new();
|
||||
public ChatThread GetThread(Guid threadId)
|
||||
|
|
|
|||
|
|
@ -6,21 +6,24 @@ using System.Threading.Tasks;
|
|||
using LANCommander.SDK.Exceptions;
|
||||
using LANCommander.SDK.Extensions;
|
||||
using LANCommander.SDK.Factories;
|
||||
using LANCommander.SDK.Models;
|
||||
using LANCommander.SDK.Rpc;
|
||||
using LANCommander.SDK.Rpc.Client;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace LANCommander.SDK.Services;
|
||||
|
||||
public class ConnectionClient(
|
||||
ILogger<ConnectionClient> logger,
|
||||
IRpcClient rpc) : IConnectionClient
|
||||
IOptions<Settings> settings) : IConnectionClient
|
||||
{
|
||||
private Uri _serverAddress;
|
||||
private Uri _serverAddress = settings.Value.Authentication.ServerAddress;
|
||||
|
||||
public bool IsConnected()
|
||||
{
|
||||
return rpc.IsConnected();
|
||||
return true;
|
||||
//return rpc.IsConnected();
|
||||
}
|
||||
|
||||
public Uri GetServerAddress() => _serverAddress;
|
||||
|
|
@ -54,7 +57,7 @@ public class ConnectionClient(
|
|||
|
||||
logger?.LogInformation("Successfully discovered server at {ServerAddress}", uri.ToString());
|
||||
|
||||
await rpc.ConnectAsync();
|
||||
//await rpc.ConnectAsync();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -63,14 +66,14 @@ public class ConnectionClient(
|
|||
{
|
||||
logger?.LogError("Failed to discover server at {ServerAddress}", uri.ToString());
|
||||
}
|
||||
|
||||
throw new InvalidAddressException("Could not find a server at that address");
|
||||
}
|
||||
|
||||
throw new InvalidAddressException("Could not find a server at that address");
|
||||
}
|
||||
|
||||
public async Task<bool> DisconnectAsync()
|
||||
{
|
||||
return await rpc.DisconnectAsync();
|
||||
return true;//return await rpc.DisconnectAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> PingAsync(Uri serverAddress = null)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using LANCommander.SDK.Factories;
|
|||
|
||||
namespace LANCommander.SDK.Services
|
||||
{
|
||||
public class MediaService(
|
||||
public class MediaClient(
|
||||
ApiRequestFactory apiRequestFactory,
|
||||
IConnectionClient connectionClient)
|
||||
{
|
||||
|
|
@ -19,7 +19,7 @@ using SixLabors.ImageSharp.PixelFormats;
|
|||
namespace LANCommander.Server.Services
|
||||
{
|
||||
public sealed class MediaService(
|
||||
ILogger<SDK.Services.MediaService> logger,
|
||||
ILogger<SDK.Services.MediaClient> logger,
|
||||
IFusionCache cache,
|
||||
IMapper mapper,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
|
|
@ -153,7 +153,7 @@ namespace LANCommander.Server.Services
|
|||
await stream.CopyToAsync(fs);
|
||||
}
|
||||
|
||||
media.Crc32 = await SDK.Services.MediaService.CalculateChecksumAsync(path);
|
||||
media.Crc32 = await SDK.Services.MediaClient.CalculateChecksumAsync(path);
|
||||
|
||||
await GenerateThumbnailAsync(media);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
@using LANCommander.SDK.Models
|
||||
@using LANCommander.SDK.Services
|
||||
@inject MediaService MediaService
|
||||
@inject MediaClient MediaClient
|
||||
@namespace LANCommander.UI.Components
|
||||
|
||||
<Spin Spinning="_loading" WrapperClassName="@_class">
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
}
|
||||
else if (Media != null)
|
||||
{
|
||||
<img src="@(MediaService.GetAbsoluteThumbnailUrl(Media))" @onload="OnLoad" @onerror="OnError" style="@Style" />
|
||||
<img src="@(MediaClient.GetAbsoluteThumbnailUrl(Media))" @onload="OnLoad" @onerror="OnError" style="@Style" />
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue