Skip to content

Commit 646412b

Browse files
authored
Merge pull request #814 from immense/feature/update-to-net8
Update to .NET 8.
2 parents e3692c7 + ea78f46 commit 646412b

File tree

254 files changed

+8491
-4141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+8491
-4141
lines changed

.azure-pipelines/Release Build.yml

Lines changed: 5 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5,71 +5,9 @@ pr:
55
- master
66

77
jobs:
8-
- job: Mac_Build
9-
displayName: Mac Build
8+
- job: Build
9+
displayName: Build
1010
timeoutInMinutes: 360
11-
pool:
12-
vmImage: macos-latest
13-
steps:
14-
15-
- task: InstallSSHKey@0
16-
inputs:
17-
knownHostsEntry: |
18-
github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
19-
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
20-
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
21-
sshKeySecureFile: 'pipelines_rsa'
22-
23-
- checkout: self
24-
submodules: recursive
25-
clean: true
26-
fetchTags: false
27-
28-
- task: PowerShell@2
29-
displayName: Add CurrentVersion Variable
30-
inputs:
31-
targetType: inline
32-
script: |
33-
$VersionString = git show -s --format=%ci $(Build.SourceVersion)
34-
$VersionDate = [DateTimeOffset]::Parse($VersionString)
35-
$CurrentVersion = $VersionDate.ToString("yyyy.MM.dd.HHmm")
36-
37-
[System.Console]::WriteLine("##vso[task.setvariable variable=CurrentVersion]$CurrentVersion")
38-
39-
Write-Host "Setting current version to $CurrentVersion."
40-
41-
- task: UseDotNet@2
42-
displayName: Use .NET SDK
43-
inputs:
44-
version: 7.x
45-
46-
- task: DotNetCoreCLI@2
47-
displayName: dotnet publish x64
48-
inputs:
49-
command: publish
50-
publishWebProjects: false
51-
projects: '**/Agent.csproj'
52-
arguments: -c $(BuildConfiguration) -r osx-x64 -o "$(Build.SourcesDirectory)/Agent/bin/publish" /p:Version=$(CurrentVersion) /p:FileVersion=$(CurrentVersion)
53-
zipAfterPublish: false
54-
modifyOutputPath: false
55-
56-
- task: PowerShell@2
57-
displayName: PowerShell Script
58-
inputs:
59-
targetType: inline
60-
script: |
61-
Compress-Archive -Path "$(Build.SourcesDirectory)/Agent/bin/publish/*" -DestinationPath "$(Build.SourcesDirectory)/Agent/bin/Remotely-MacOS-x64.zip" -Force
62-
63-
- task: PublishPipelineArtifact@1
64-
displayName: Publish macOS x64 Agent
65-
inputs:
66-
path: $(Build.SourcesDirectory)/Agent/bin/Remotely-MacOS-x64.zip
67-
artifactName: Mac-x64-Agent
68-
69-
- job: Windows_Build
70-
displayName: Windows Build
71-
timeoutInMinutes: 360
72-
dependsOn: Mac_Build
7311
pool:
7412
vmImage: windows-latest
7513

@@ -89,12 +27,6 @@ jobs:
8927

9028
- task: VisualStudioTestPlatformInstaller@1
9129
displayName: Visual Studio Test Platform Installer
92-
93-
- task: DownloadPipelineArtifact@2
94-
displayName: Download macOS x64 Agent
95-
inputs:
96-
artifact: Mac-x64-Agent
97-
path: $(Build.SourcesDirectory)\Server\wwwroot\Content\
9830

9931
- task: PowerShell@2
10032
displayName: Add CurrentVersion Variable
@@ -121,7 +53,7 @@ jobs:
12153
- task: UseDotNet@2
12254
displayName: Use .NET SDK
12355
inputs:
124-
version: 7.x
56+
version: 8.x
12557

12658
- task: DotNetCoreCLI@2
12759
displayName: dotnet restore
@@ -191,8 +123,8 @@ jobs:
191123
inputs:
192124
targetType: inline
193125
script: |
194-
Copy-Item -Path "$(Build.SourcesDirectory)\Server\Dockerfile" -Destination "$(build.artifactstagingdirectory)\Dockerfile"
195-
Copy-Item -Path "$(Build.SourcesDirectory)\Server\DockerMain.sh" -Destination "$(build.artifactstagingdirectory)\DockerMain.sh"
126+
Copy-Item -Path "$(Build.SourcesDirectory)\Server\Dockerfile.pipelines" -Destination "$(build.artifactstagingdirectory)\Dockerfile"
127+
Copy-Item -Path "$(Build.SourcesDirectory)\docker-compose\docker-compose.yml" -Destination "$(build.artifactstagingdirectory)\docker-compose.yml"
196128
197129
- task: PublishBuildArtifacts@1
198130
displayName: Publish Artifact

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"type": "coreclr",
1010
"request": "launch",
1111
"preLaunchTask": "build",
12-
"program": "${workspaceFolder}/Desktop.Linux/bin/Debug/.net7.0/Remotely_Desktop.dll",
12+
"program": "${workspaceFolder}/Desktop.Linux/bin/Debug/.net8.0/Remotely_Desktop.dll",
1313
"args": [],
1414
"cwd": "${workspaceFolder}/Desktop.Linux",
1515
"console": "internalConsole",

Agent.Installer.Win/Agent.Installer.Win.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
<EmbeddedResource Include="Properties\Resources.resx">
175175
<Generator>ResXFileCodeGenerator</Generator>
176176
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
177+
<SubType>Designer</SubType>
177178
</EmbeddedResource>
178179
<None Include="app.manifest" />
179180
<None Include="Properties\Settings.settings">

Agent.Installer.Win/Models/EmbeddedServerData.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#nullable enable
2+
using System;
23
using System.Runtime.Serialization;
34

45
namespace Remotely.Agent.Installer.Models;
@@ -23,5 +24,5 @@ public EmbeddedServerData(Uri serverUrl, string organizationId)
2324
public string OrganizationId { get; set; } = string.Empty;
2425

2526
[DataMember]
26-
public Uri ServerUrl { get; set; }
27+
public Uri? ServerUrl { get; set; }
2728
}

Agent.Installer.Win/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.IO;
4-
using System.Linq;
5-
using System.Runtime.Serialization.Json;
63
using System.Text;
74
using System.Threading.Tasks;
85
using System.Web.Script.Serialization;
96
using Remotely.Agent.Installer.Models;
107
using Remotely.Agent.Installer.Win.Utilities;
11-
using Remotely.Shared;
128

139
namespace Remotely.Agent.Installer.Win.Services;
1410

1511
internal class EmbeddedServerDataReader
1612
{
1713
private readonly JavaScriptSerializer _serializer = new JavaScriptSerializer();
1814

19-
public Task<EmbeddedServerData> TryGetEmbeddedData(string filePath)
15+
public async Task<EmbeddedServerData> TryGetEmbeddedData(string filePath)
2016
{
2117
try
2218
{
@@ -25,60 +21,35 @@ public Task<EmbeddedServerData> TryGetEmbeddedData(string filePath)
2521
throw new Exception($"File path does not exist: {filePath}");
2622
}
2723

28-
using (var fs = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
29-
{
30-
var result = SearchBuffer(fs, AppConstants.EmbeddedImmySignature);
31-
if (result == -1)
32-
{
33-
throw new Exception("Signature not found in file buffer.");
34-
}
24+
using var fs = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
25+
using var br = new BinaryReader(fs);
26+
using var sr = new StreamReader(fs);
3527

36-
Logger.Write($"Found data signature at index {result}.");
28+
fs.Seek(-4, SeekOrigin.End);
29+
var dataSize = br.ReadInt32();
30+
fs.Seek(-dataSize - 4, SeekOrigin.End);
3731

38-
fs.Seek(result + AppConstants.EmbeddedImmySignature.Length, SeekOrigin.Begin);
39-
using (var reader = new BinaryReader(fs, Encoding.UTF8))
40-
{
41-
var serializedData = reader.ReadString();
32+
if (dataSize == 0)
33+
{
34+
return EmbeddedServerData.Empty;
35+
}
4236

43-
Logger.Write($"Extracted embedded data from EXE: {serializedData}");
37+
var buffer = new byte[dataSize];
38+
await fs.ReadAsync(buffer, 0, dataSize);
39+
var json = Encoding.UTF8.GetString(buffer);
4440

45-
var embeddedData = _serializer.Deserialize<EmbeddedServerData>(serializedData);
46-
if (embeddedData != null)
47-
{
48-
return Task.FromResult(embeddedData);
49-
}
50-
}
41+
Logger.Write($"Extracted embedded data from EXE: {json}");
42+
43+
var embeddedData = _serializer.Deserialize<EmbeddedServerData>(json);
44+
if (embeddedData is not null)
45+
{
46+
return embeddedData;
5147
}
5248
}
5349
catch (Exception ex)
5450
{
5551
Logger.Write(ex);
5652
}
57-
return Task.FromResult(EmbeddedServerData.Empty);
58-
}
59-
60-
private long SearchBuffer(FileStream fileStream, byte[] matchPattern)
61-
{
62-
var matchSize = matchPattern.Length;
63-
var limit = fileStream.Length - matchSize;
64-
65-
for (var i = 0; i <= limit; i++)
66-
{
67-
var k = 0;
68-
69-
for (; k < matchSize; k++)
70-
{
71-
if (matchPattern[k] != fileStream.ReadByte())
72-
{
73-
break;
74-
}
75-
}
76-
77-
if (k == matchSize)
78-
{
79-
return fileStream.Position - matchSize;
80-
}
81-
}
82-
return -1;
53+
return EmbeddedServerData.Empty;
8354
}
8455
}

Agent.Installer.Win/Services/InstallerService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ private void CreateSupportShortcut(string serverUrl, string deviceUuid, bool cre
225225
var shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation);
226226
shortcut.Description = "Get IT support";
227227
shortcut.IconLocation = Path.Combine(_installPath, "Remotely_Agent.exe");
228-
shortcut.TargetPath = serverUrl.TrimEnd('/') + $"/GetSupport?deviceID={deviceUuid}";
228+
shortcut.TargetPath = serverUrl.TrimEnd('/') + $"/get-support?deviceID={deviceUuid}";
229229
shortcut.Save();
230230

231231
if (createSupportShortcut)

Agent/Agent.csproj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
77
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
88
<Copyright>Copyright © 2023 Immense Networks</Copyright>
@@ -24,19 +24,19 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27-
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="7.0.10" />
28-
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.10" />
29-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
30-
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="7.0.0" />
31-
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.1" />
32-
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
33-
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="7.0.0" />
34-
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.10" />
35-
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.3.6" />
36-
<PackageReference Include="Microsoft.WSMan.Management" Version="7.3.6" />
37-
<PackageReference Include="Microsoft.WSMan.Runtime" Version="7.3.6" />
38-
<PackageReference Include="System.Management.Automation" Version="7.3.6" />
39-
<PackageReference Include="System.ServiceProcess.ServiceController" Version="7.0.1" />
27+
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="8.0.2" />
28+
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.2" />
29+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
30+
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="8.0.0" />
31+
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
32+
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
33+
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" />
34+
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.2" />
35+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.1" />
36+
<PackageReference Include="Microsoft.WSMan.Management" Version="7.4.1" />
37+
<PackageReference Include="Microsoft.WSMan.Runtime" Version="7.4.1" />
38+
<PackageReference Include="System.Management.Automation" Version="7.4.1" />
39+
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
4040
</ItemGroup>
4141

4242
<ItemGroup>

Agent/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ private static void RegisterServices(IServiceCollection services)
123123
services.AddSingleton<IAppLauncher, AppLauncherMac>();
124124
services.AddSingleton<IUpdater, UpdaterMac>();
125125
services.AddSingleton<IDeviceInformationService, DeviceInfoGeneratorMac>();
126+
services.AddSingleton<IElevationDetector, ElevationDetectorMac>();
126127
}
127128
else
128129
{

Agent/Services/FileLogsManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public async IAsyncEnumerable<byte[]> ReadAllBytes([EnumeratorCancellation] Canc
9494
{
9595
yield break;
9696
}
97-
yield return File.ReadAllBytes(file);
97+
yield return chunk;
9898
}
9999
}
100100
}

0 commit comments

Comments
 (0)