Skip to content

Commit

Permalink
Get latest submodule changes working.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Aug 16, 2023
1 parent 933c0af commit ac6c961
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 201 deletions.
8 changes: 4 additions & 4 deletions Agent/Agent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="7.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.10" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.3.6" />
<PackageReference Include="Microsoft.WSMan.Management" Version="7.3.6" />
<PackageReference Include="Microsoft.WSMan.Runtime" Version="7.3.6" />
Expand All @@ -41,7 +41,7 @@

<ItemGroup>
<ProjectReference Include="..\Shared\Shared.csproj" />
<ProjectReference Include="..\submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.Native\Immense.RemoteControl.Desktop.Native.csproj" />
<ProjectReference Include="..\submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.Shared\Immense.RemoteControl.Desktop.Shared.csproj" />
</ItemGroup>


Expand Down
3 changes: 1 addition & 2 deletions Agent/Services/AgentHubConnection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Immense.RemoteControl.Desktop.Native.Windows;
using Immense.RemoteControl.Desktop.Shared.Native.Windows;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Expand All @@ -11,7 +11,6 @@
using Remotely.Shared.Models;
using Remotely.Shared.Services;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
Expand Down
4 changes: 1 addition & 3 deletions Agent/Services/Windows/AppLauncherWin.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
using Immense.RemoteControl.Desktop.Native.Windows;
using Immense.RemoteControl.Desktop.Shared.Native.Windows;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.Logging;
using Remotely.Agent.Interfaces;
using Remotely.Shared.Models;
using Remotely.Shared.Utilities;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Security.Principal;
using System.Threading.Tasks;

Expand Down
3 changes: 1 addition & 2 deletions Agent/Services/Windows/DeviceInfoGeneratorWin.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Immense.RemoteControl.Desktop.Native.Windows;
using Immense.RemoteControl.Desktop.Shared.Native.Windows;
using Microsoft.Extensions.Logging;
using Remotely.Agent.Interfaces;
using Remotely.Shared.Dtos;
using Remotely.Shared.Models;
using System;
using System.Linq;
using System.Threading.Tasks;
Expand Down
3 changes: 2 additions & 1 deletion Desktop.Linux/Desktop.Linux.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Desktop.Shared\Desktop.Shared.csproj" />
<ProjectReference Include="..\submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.Linux\Immense.RemoteControl.Desktop.Linux.csproj" />
<ProjectReference Include="..\submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.Shared\Immense.RemoteControl.Desktop.Shared.csproj" />
<ProjectReference Include="..\submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop\Immense.RemoteControl.Desktop.csproj" />
<ProjectReference Include="..\submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.UI\Immense.RemoteControl.Desktop.UI.csproj" />
</ItemGroup>
</Project>
141 changes: 78 additions & 63 deletions Desktop.Linux/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,87 +7,102 @@
using Microsoft.Extensions.Logging;
using Remotely.Shared.Services;
using Immense.RemoteControl.Desktop.Shared.Services;
using Immense.RemoteControl.Desktop.Services;
using System.Diagnostics;
using Immense.RemoteControl.Desktop.Startup;
using Remotely.Shared.Utilities;
using Immense.RemoteControl.Desktop.Shared.Startup;
using System.Linq;
using Immense.RemoteControl.Desktop.Linux.Startup;
using Immense.RemoteControl.Desktop.UI.Services;
using Avalonia;
using Immense.RemoteControl.Desktop.UI;

var version = AppVersionHelper.GetAppVersion();
var logger = new FileLogger("Remotely_Desktop", version, "Program.cs");
var filePath = Environment.ProcessPath ?? Environment.GetCommandLineArgs().First();
var serverUrl = Debugger.IsAttached ? "http://localhost:5000" : string.Empty;
var getEmbeddedResult = await EmbeddedServerDataSearcher.Instance.TryGetEmbeddedData(filePath);
if (getEmbeddedResult.IsSuccess)
public class Program
{
serverUrl = getEmbeddedResult.Value.ServerUrl.AbsoluteUri;
}
else
{
logger.LogWarning(getEmbeddedResult.Exception, "Failed to extract embedded server data.");
}
// This is needed for the visual designer to work.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();

var services = new ServiceCollection();
public static async Task Main(string[] args)
{
var version = AppVersionHelper.GetAppVersion();
var logger = new FileLogger("Remotely_Desktop", version, "Program.cs");
var filePath = Environment.ProcessPath ?? Environment.GetCommandLineArgs().First();
var serverUrl = Debugger.IsAttached ? "http://localhost:5000" : string.Empty;
var getEmbeddedResult = await EmbeddedServerDataSearcher.Instance.TryGetEmbeddedData(filePath);
if (getEmbeddedResult.IsSuccess)
{
serverUrl = getEmbeddedResult.Value.ServerUrl.AbsoluteUri;
}
else
{
logger.LogWarning(getEmbeddedResult.Exception, "Failed to extract embedded server data.");
}

services.AddSingleton<IOrganizationIdProvider, OrganizationIdProvider>();
services.AddSingleton<IEmbeddedServerDataSearcher, EmbeddedServerDataSearcher>();
var services = new ServiceCollection();

services.AddRemoteControlLinux(
config =>
{
config.AddBrandingProvider<BrandingProvider>();
});
services.AddSingleton<IOrganizationIdProvider, OrganizationIdProvider>();
services.AddSingleton<IEmbeddedServerDataSearcher, EmbeddedServerDataSearcher>();

services.AddLogging(builder =>
{
if (EnvironmentHelper.IsDebug)
{
builder.SetMinimumLevel(LogLevel.Debug);
}
builder.AddProvider(new FileLoggerProvider("Remotely_Desktop", version));
});
services.AddRemoteControlLinux(
config =>
{
config.AddBrandingProvider<BrandingProvider>();
});

var provider = services.BuildServiceProvider();
services.AddLogging(builder =>
{
if (EnvironmentHelper.IsDebug)
{
builder.SetMinimumLevel(LogLevel.Debug);
}
builder.AddProvider(new FileLoggerProvider("Remotely_Desktop", version));
});

var appState = provider.GetRequiredService<IAppState>();
var orgIdProvider = provider.GetRequiredService<IOrganizationIdProvider>();
var provider = services.BuildServiceProvider();

if (getEmbeddedResult.IsSuccess)
{
orgIdProvider.OrganizationId = getEmbeddedResult.Value.OrganizationId;
appState.Host = getEmbeddedResult.Value.ServerUrl.AbsoluteUri;
}
var appState = provider.GetRequiredService<IAppState>();
var orgIdProvider = provider.GetRequiredService<IOrganizationIdProvider>();

if (appState.ArgDict.TryGetValue("org-id", out var orgId))
{
orgIdProvider.OrganizationId = orgId;
}
if (getEmbeddedResult.IsSuccess)
{
orgIdProvider.OrganizationId = getEmbeddedResult.Value.OrganizationId;
appState.Host = getEmbeddedResult.Value.ServerUrl.AbsoluteUri;
}

var result = await provider.UseRemoteControlClient(
args,
"The remote control client for Remotely.",
serverUrl,
false);
if (appState.ArgDict.TryGetValue("org-id", out var orgId))
{
orgIdProvider.OrganizationId = orgId;
}

if (!result.IsSuccess)
{
logger.LogError(result.Exception, "Failed to start remote control client.");
Environment.Exit(1);
}
var result = await provider.UseRemoteControlClient(
args,
"The remote control client for Remotely.",
serverUrl,
false);

if (!result.IsSuccess)
{
logger.LogError(result.Exception, "Failed to start remote control client.");
Environment.Exit(1);
}

Console.WriteLine("Press Ctrl + C to exit.");

var shutdownService = provider.GetRequiredService<IShutdownService>();
Console.CancelKeyPress += async (s, e) =>
{
await shutdownService.Shutdown();
};
Console.WriteLine("Press Ctrl + C to exit.");

var dispatcher = provider.GetRequiredService<IAvaloniaDispatcher>();
try
{
await Task.Delay(Timeout.InfiniteTimeSpan, dispatcher.AppCancellationToken);
var shutdownService = provider.GetRequiredService<IShutdownService>();
Console.CancelKeyPress += async (s, e) =>
{
await shutdownService.Shutdown();
};

var dispatcher = provider.GetRequiredService<IUiDispatcher>();
try
{
await Task.Delay(Timeout.InfiniteTimeSpan, dispatcher.ApplicationExitingToken);
}
catch (TaskCanceledException) { }
}
}
catch (TaskCanceledException) { }
1 change: 1 addition & 0 deletions Desktop.Win/Desktop.Win.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<ItemGroup>
<ProjectReference Include="..\Desktop.Shared\Desktop.Shared.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
<ProjectReference Include="..\submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.UI\Immense.RemoteControl.Desktop.UI.csproj" />
<ProjectReference Include="..\submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.Windows\Immense.RemoteControl.Desktop.Windows.csproj" />
</ItemGroup>

Expand Down
Loading

0 comments on commit ac6c961

Please sign in to comment.