diff --git a/Remotely_ScreenCast/Capture/ScreenCaster.cs b/Remotely_ScreenCast/Capture/ScreenCaster.cs index 9ff2e0f3..95d9a018 100644 --- a/Remotely_ScreenCast/Capture/ScreenCaster.cs +++ b/Remotely_ScreenCast/Capture/ScreenCaster.cs @@ -59,7 +59,7 @@ namespace Remotely_ScreenCast.Capture Name = requesterName, ViewerConnectionID = viewerID, HasControl = Program.Mode == Enums.AppMode.Unattended, - ImageQuality = 1 + ImageQuality = 100 }; while (!success) @@ -101,7 +101,6 @@ namespace Remotely_ScreenCast.Capture while (viewer.PendingFrames > 10) { - Logger.Write("Waiting on pending frames."); await Task.Delay(1); } @@ -109,6 +108,11 @@ namespace Remotely_ScreenCast.Capture var diffArea = ImageUtils.GetDiffArea(capturer.CurrentFrame, capturer.PreviousFrame, capturer.CaptureFullscreen); + if (diffArea.IsEmpty) + { + continue; + } + var newImage = capturer.CurrentFrame.Clone(diffArea, System.Drawing.Imaging.PixelFormat.Format32bppArgb); if (capturer.CaptureFullscreen) @@ -116,26 +120,28 @@ namespace Remotely_ScreenCast.Capture capturer.CaptureFullscreen = false; } - long newQuality; - if (viewer.PendingFrames < 5) - { - newQuality = (long)Math.Min(1, viewer.ImageQuality + .1); - } - else - { - newQuality = (long)Math.Max(.1, viewer.ImageQuality - .1); - } - Logger.Write($"New quality: {newQuality}"); - if (newQuality != viewer.ImageQuality) - { - viewer.ImageQuality = newQuality; - viewer.FullScreenRefreshNeeded = true; - } - else - { - capturer.CaptureFullscreen = true; - viewer.FullScreenRefreshNeeded = false; - } + //long newQuality; + //if (viewer.PendingFrames < 8) + //{ + // newQuality = Math.Min(100, viewer.ImageQuality + 10); + //} + //else + //{ + // newQuality = Math.Max(0, viewer.ImageQuality - 10); + //} + + //if (newQuality != viewer.ImageQuality) + //{ + // Logger.Write($"New quality: {newQuality}"); + // viewer.ImageQuality = newQuality; + // viewer.FullScreenRefreshNeeded = true; + //} + //else if (viewer.FullScreenRefreshNeeded) + //{ + // Logger.Write($"Quality stabilized."); + // capturer.CaptureFullscreen = true; + // viewer.FullScreenRefreshNeeded = false; + //} var img = ImageUtils.EncodeBitmap(newImage, viewer.EncoderParams); diff --git a/Remotely_ScreenCast/Models/Viewer.cs b/Remotely_ScreenCast/Models/Viewer.cs index dfb58000..e1a73f86 100644 --- a/Remotely_ScreenCast/Models/Viewer.cs +++ b/Remotely_ScreenCast/Models/Viewer.cs @@ -48,7 +48,7 @@ namespace Remotely_ScreenCast.Models { Param = new EncoderParameter[] { - new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 75L) + new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L) } }; diff --git a/Remotely_ScreenCast/Remotely_ScreenCast.csproj b/Remotely_ScreenCast/Remotely_ScreenCast.csproj index 73d5a227..0c009d1a 100644 --- a/Remotely_ScreenCast/Remotely_ScreenCast.csproj +++ b/Remotely_ScreenCast/Remotely_ScreenCast.csproj @@ -21,7 +21,7 @@ true full false - ..\Remotely_Agent\Resources\ + bin\Debug\ DEBUG;TRACE prompt 4 @@ -30,7 +30,7 @@ AnyCPU pdbonly true - ..\Remotely_Agent\Resources\ + bin\Release\ TRACE prompt 4 diff --git a/Remotely_Server/Services/DeviceSocketHub.cs b/Remotely_Server/Services/DeviceSocketHub.cs index 902be298..f86c5ee0 100644 --- a/Remotely_Server/Services/DeviceSocketHub.cs +++ b/Remotely_Server/Services/DeviceSocketHub.cs @@ -72,7 +72,7 @@ namespace Remotely_Server.Services { EventType = EventTypes.Info, OrganizationID = Device.OrganizationID, - Message = $"Device connection for {device.DeviceName} was denied because it is already connected." + Message = $"Device connection for {device?.DeviceName} was denied because it is already connected." }); Context.Abort(); return; diff --git a/Utilities/Publish.ps1 b/Utilities/Publish.ps1 index 634f3c3a..d7546a62 100644 --- a/Utilities/Publish.ps1 +++ b/Utilities/Publish.ps1 @@ -57,6 +57,13 @@ Set-Location -Path (Get-Item -Path $PSScriptRoot).Parent.FullName if ($ArgList.Contains("c")) { + # Copy .NET Framework ScreenCaster to Agent resources for embedding. + if ((Test-Path -Path ".\Remotely_ScreenCast\bin\Release\Remotely_ScreenCast.exe") -eq $true) { + Move-Item -Path ".\Remotely_ScreenCast\bin\Release\Remotely_ScreenCast.exe" -Destination ".\Remotely_Agent\Resources\Remotely_ScreenCast.exe" -Force + } + elseif ((Test-Path -Path ".\Remotely_ScreenCast\bin\Debug\Remotely_ScreenCast.exe") -eq $true) { + Move-Item -Path ".\Remotely_ScreenCast\bin\Debug\Remotely_ScreenCast.exe" -Destination ".\Remotely_Agent\Resources\Remotely_ScreenCast.exe" -Force + } # Clear publish folders. if ((Test-Path -Path ".\Remotely_Agent\bin\Release\netcoreapp2.2\win10-x64\publish") -eq $true) { Get-ChildItem -Path ".\Remotely_Agent\bin\Release\netcoreapp2.2\win10-x64\publish" | Remove-Item -Force -Recurse