Skip to content

Commit 0d93255

Browse files
committed
Merge master.
2 parents d594527 + d0f4afd commit 0d93255

Some content is hidden

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

55 files changed

+972
-977
lines changed

Agent/Services/AgentSocket.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Microsoft.Extensions.DependencyInjection;
33
using Remotely.Agent.Extensions;
44
using Remotely.Agent.Interfaces;
5-
using Remotely.Agent.Utilities;
65
using Remotely.Shared.Enums;
76
using Remotely.Shared.Models;
87
using Remotely.Shared.Utilities;

Agent/Services/UpdaterWin.cs

-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Remotely.Agent.Interfaces;
2-
using Remotely.Agent.Utilities;
32
using Remotely.Shared.Utilities;
43
using System;
54
using System.Diagnostics;
@@ -34,11 +33,6 @@ public async Task BeginChecking()
3433
return;
3534
}
3635

37-
if (!RegistryHelper.CheckNetFrameworkVersion())
38-
{
39-
return;
40-
}
41-
4236
await CheckForUpdates();
4337
_updateTimer.Elapsed += UpdateTimer_Elapsed;
4438
_updateTimer.Start();

Agent/Utilities/RegistryHelper.cs

-39
This file was deleted.

Agent/makefile

-18
This file was deleted.

Desktop.Core/Models/CaptureFrame.cs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Remotely.Desktop.Core.Models
99
public class CaptureFrame
1010
{
1111
public byte[] EncodedImageBytes { get; init; }
12+
public Guid Id { get; } = Guid.NewGuid();
1213
public int Top { get; init; }
1314
public int Left { get; init; }
1415
public int Height { get; init; }

Desktop.Core/Services/DtoMessageHandler.cs

+17
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,24 @@ private void HandleFrameReceived(Viewer viewer)
175175
private void KeyDown(byte[] message)
176176
{
177177
var dto = MessagePackSerializer.Deserialize<KeyDownDto>(message);
178+
if (dto?.Key is null)
179+
{
180+
Logger.Write("Key input is empty.", EventType.Warning);
181+
return;
182+
}
178183
KeyboardMouseInput.SendKeyDown(dto.Key);
179184
}
180185

181186
private async Task KeyPress(byte[] message)
182187
{
183188
var dto = MessagePackSerializer.Deserialize<KeyPressDto>(message);
189+
190+
if (dto?.Key is null)
191+
{
192+
Logger.Write("Key input is empty.", EventType.Warning);
193+
return;
194+
}
195+
184196
KeyboardMouseInput.SendKeyDown(dto.Key);
185197
await Task.Delay(1);
186198
KeyboardMouseInput.SendKeyUp(dto.Key);
@@ -189,6 +201,11 @@ private async Task KeyPress(byte[] message)
189201
private void KeyUp(byte[] message)
190202
{
191203
var dto = MessagePackSerializer.Deserialize<KeyUpDto>(message);
204+
if (dto?.Key is null)
205+
{
206+
Logger.Write("Key input is empty.", EventType.Warning);
207+
return;
208+
}
192209
KeyboardMouseInput.SendKeyUp(dto.Key);
193210
}
194211

Desktop.Core/Services/ScreenCaster.cs

+7-4
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,18 @@ await viewer.SendScreenCapture(new CaptureFrame()
167167
refreshNeeded = false;
168168
}
169169

170-
using var clone = currentFrame.Clone(diffArea, currentFrame.PixelFormat);
171-
172170
byte[] encodedImageBytes;
173171
if (viewer.Capturer.CaptureFullscreen)
174172
{
175173
// Recalculate Bps.
176174
viewer.AverageBytesPerSecond = 0;
177-
encodedImageBytes = ImageUtils.EncodeJpeg(clone, _maxQuality);
175+
encodedImageBytes = ImageUtils.EncodeJpeg(currentFrame, _maxQuality);
178176
}
179177
else
180178
{
181179
if (viewer.AverageBytesPerSecond > 0)
182180
{
183-
var expectedSize = clone.Height * clone.Width * 4 * .1;
181+
var expectedSize = diffArea.Height * diffArea.Width * 4 * .1;
184182
var timeToSend = expectedSize / viewer.AverageBytesPerSecond;
185183
currentQuality = Math.Max(_minQuality, Math.Min(_maxQuality, (int)(.1 / timeToSend * _maxQuality)));
186184
if (currentQuality < _maxQuality - 10)
@@ -189,6 +187,11 @@ await viewer.SendScreenCapture(new CaptureFrame()
189187
Debug.WriteLine($"Quality Reduced: {currentQuality}");
190188
}
191189
}
190+
191+
using var clone = currentFrame.Clone(diffArea, currentFrame.PixelFormat);
192+
//var resizeW = diffArea.Width * currentQuality / _maxQuality;
193+
//var resizeH = diffArea.Height * currentQuality / _maxQuality;
194+
//using var resized = new Bitmap(clone, new Size(resizeW, resizeH));
192195
encodedImageBytes = ImageUtils.EncodeJpeg(clone, currentQuality);
193196
}
194197

Desktop.Core/Services/Viewer.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ public bool IsUsingWebRtcVideo
8787
public void Dispose()
8888
{
8989
DisconnectRequested = true;
90-
Disposer.TryDisposeAll(new IDisposable[]
91-
{
92-
RtcSession,
93-
Capturer
94-
});
90+
Disposer.TryDisposeAll(RtcSession, Capturer);
9591
GC.SuppressFinalize(this);
9692
}
9793

@@ -236,6 +232,7 @@ public async Task SendScreenCapture(CaptureFrame screenFrame)
236232
{
237233
var dto = new CaptureFrameDto()
238234
{
235+
Id = screenFrame.Id,
239236
Left = left,
240237
Top = top,
241238
Width = width,
@@ -250,6 +247,7 @@ await SendToViewer(() => RtcSession.SendDto(dto),
250247

251248
var endOfFrameDto = new CaptureFrameDto()
252249
{
250+
Id = screenFrame.Id,
253251
Left = left,
254252
Top = top,
255253
Width = width,

Desktop.Core/Services/WebRtcSession.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ public void Dispose()
6161
}
6262
catch { }
6363
PeerSession.Transceivers.RemoveAll(x => true);
64-
Disposer.TryDisposeAll(new IDisposable[]
65-
{
66-
Transceiver?.LocalVideoTrack,
67-
VideoSource,
68-
PeerSession
69-
});
64+
Disposer.TryDisposeAll(Transceiver?.LocalVideoTrack, VideoSource, PeerSession);
7065
GC.SuppressFinalize(this);
7166
}
7267

@@ -111,7 +106,7 @@ public async Task Init(IceServerModel[] iceServers)
111106
public Task SendDto<T>(T dto) where T : BaseDto
112107
{
113108
CaptureChannel.SendMessage(MessagePackSerializer.Serialize(dto));
114-
TaskHelper.DelayUntil(() => CurrentBuffer < 64_000, TimeSpan.FromSeconds(5));
109+
TaskHelper.DelayUntil(() => CurrentBuffer < 128_000, TimeSpan.FromSeconds(5));
115110
return Task.CompletedTask;
116111
}
117112

Desktop.Win/Desktop.Win.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
</ItemGroup>
8484

8585
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
86-
<Exec Command="if $(SolutionDir) == *Undefined* (&#xD;&#xA; exit 0&#xD;&#xA;)&#xD;&#xA;if $(ConfigurationName) == Debug (&#xD;&#xA; if $(PlatformName) == Any CPU (&#xD;&#xA; md &quot;$(SolutionDir)Agent\bin\Debug\net5.0\Desktop\&quot;&#xD;&#xA; xcopy &quot;$(TargetDir)*&quot; &quot;$(SolutionDir)Agent\bin\Debug\net5.0\Desktop\&quot; /y /e /i&#xD;&#xA; )&#xD;&#xA; if $(PlatformName) == x64 (&#xD;&#xA; md &quot;$(SolutionDir)Agent\bin\x64\Debug\net5.0\Desktop\&quot;&#xD;&#xA; xcopy &quot;$(TargetDir)*&quot; &quot;$(SolutionDir)Agent\bin\x64\Debug\net5.0\Desktop\&quot; /y /e /i&#xD;&#xA; )&#xD;&#xA; if $(PlatformName) == x86 (&#xD;&#xA; md &quot;$(SolutionDir)Agent\bin\x86\Debug\net5.0\Desktop\&quot;&#xD;&#xA; xcopy &quot;$(TargetDir)*&quot; &quot;$(SolutionDir)Agent\bin\x86\Debug\net5.0\Desktop\&quot; /y /e /i&#xD;&#xA; )&#xD;&#xA;)" />
86+
<Exec Command="if $(SolutionDir) == *Undefined* (&#xD;&#xA; exit 0&#xD;&#xA;)&#xD;&#xA;if $(ConfigurationName) == Debug (&#xD;&#xA; if $(PlatformName) == AnyCPU (&#xD;&#xA; md &quot;$(SolutionDir)Agent\bin\Debug\net5.0\Desktop\&quot;&#xD;&#xA; xcopy &quot;$(TargetDir)*&quot; &quot;$(SolutionDir)Agent\bin\Debug\net5.0\Desktop\&quot; /y /e /i&#xD;&#xA; )&#xD;&#xA; if $(PlatformName) == x64 (&#xD;&#xA; md &quot;$(SolutionDir)Agent\bin\x64\Debug\net5.0\Desktop\&quot;&#xD;&#xA; xcopy &quot;$(TargetDir)*&quot; &quot;$(SolutionDir)Agent\bin\x64\Debug\net5.0\Desktop\&quot; /y /e /i&#xD;&#xA; )&#xD;&#xA; if $(PlatformName) == x86 (&#xD;&#xA; md &quot;$(SolutionDir)Agent\bin\x86\Debug\net5.0\Desktop\&quot;&#xD;&#xA; xcopy &quot;$(TargetDir)*&quot; &quot;$(SolutionDir)Agent\bin\x86\Debug\net5.0\Desktop\&quot; /y /e /i&#xD;&#xA; )&#xD;&#xA;)" />
8787
</Target>
8888

8989
</Project>

Desktop.Win/Models/DirectXOutput.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@ public DirectXOutput(Adapter1 adapter,
2525

2626
public void Dispose()
2727
{
28-
Disposer.TryDisposeAll(new IDisposable[]
29-
{
30-
Adapter,
31-
Device,
32-
OutputDuplication,
33-
Texture2D
34-
});
28+
Disposer.TryDisposeAll(Adapter, Device, OutputDuplication, Texture2D);
3529
GC.SuppressFinalize(this);
3630
}
3731
}

Desktop.Win/Services/ClickOnceService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public string GetActivationUri()
4444
var appRoot = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Parent;
4545
if (!Directory.Exists(Path.Combine(appRoot.FullName, "manifests")))
4646
{
47-
Logger.Write($"Manifests folder not found in root folder: {appRoot}", EventType.Warning);
47+
Logger.Write($"Manifests folder not found in root folder: {appRoot}", EventType.Debug);
4848
return _activationUri;
4949
}
5050

0 commit comments

Comments
 (0)