Rebranding

This commit is contained in:
Jared Goodwin 2019-02-27 06:14:53 -08:00
parent 570d4ca40d
commit a8ce8dbf69
7 changed files with 31 additions and 10 deletions

View File

@ -18,11 +18,11 @@
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\Remotely_ScreenCapture.exe" />
<None Remove="Resources\Remotely_ScreenCast.exe" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Remotely_ScreenCapture.exe" />
<EmbeddedResource Include="Resources\Remotely_ScreenCast.exe" />
</ItemGroup>
<ItemGroup>

View File

@ -282,7 +282,7 @@ namespace Remotely_Agent.Services
}
// Extract ScreenCast.
using (var mrs = Assembly.GetExecutingAssembly().GetManifestResourceStream("Remotely_Agent.Resources.Remotely_ScreenCapture.exe"))
using (var mrs = Assembly.GetExecutingAssembly().GetManifestResourceStream("Remotely_Agent.Resources.Remotely_ScreenCast.exe"))
{
using (var fs = new FileStream(filePath, FileMode.Create))
{

View File

@ -13,6 +13,7 @@ using System.Drawing.Drawing2D;
using System.Diagnostics;
using System.Runtime.Serialization.Formatters.Binary;
using Remotely_ScreenCast.Utilities;
using System.Threading;
namespace Remotely_ScreenCast.Capture
{
@ -24,6 +25,7 @@ namespace Remotely_ScreenCast.Capture
public bool CaptureFullscreen { get; set; } = true;
public int PauseForMilliseconds { get; set; }
public EventHandler<Rectangle> ScreenChanged { get; set; }
private Stopwatch FramerateTimer { get; } = Stopwatch.StartNew();
public int SelectedScreen
{
get
@ -60,6 +62,9 @@ namespace Remotely_ScreenCast.Capture
PreviousFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb);
graphic = Graphics.FromImage(CurrentFrame);
desktopName = Win32Interop.GetCurrentDesktop();
Debug.WriteLine($"Starting BitBltCapture.");
Debug.WriteLine($"Current Desktop: {desktopName}");
}
public void Capture()
@ -74,6 +79,12 @@ namespace Remotely_ScreenCast.Capture
Logger.Write($"Set thread desktop: {success}");
}
// Keep framerate below 30 FPS.
if (FramerateTimer.Elapsed.TotalMilliseconds > 33)
{
Thread.Sleep((int)FramerateTimer.Elapsed.TotalMilliseconds);
}
FramerateTimer.Restart();
PreviousFrame = (Bitmap)CurrentFrame.Clone();

View File

@ -24,6 +24,7 @@ namespace Remotely_ScreenCast.Capture
public Rectangle CurrentScreenBounds { get; private set; }
public bool CaptureFullscreen { get; set; } = true;
public EventHandler<Rectangle> ScreenChanged { get; set; }
private Stopwatch FramerateTimer { get; } = Stopwatch.StartNew();
public int SelectedScreen
{
get
@ -71,9 +72,9 @@ namespace Remotely_ScreenCast.Capture
private void Init()
{
desktopName = Win32Interop.GetCurrentDesktop();
desktopName = Win32Interop.GetCurrentDesktop();
factory = new Factory1();
factory = new Factory1();
//Get first adapter
adapter = factory.Adapters1.FirstOrDefault(x => x.Outputs.Length > 0);
@ -119,7 +120,10 @@ namespace Remotely_ScreenCast.Capture
screenTexture = new Texture2D(device, textureDesc);
duplicatedOutput = output1.DuplicateOutput(device);
}
Debug.WriteLine($"Starting DXCapture.");
Debug.WriteLine($"Current Desktop: {desktopName}");
}
public void Capture()
{
try
@ -130,21 +134,26 @@ namespace Remotely_ScreenCast.Capture
NeedsInit = false;
}
var currentDesktop = Win32Interop.GetCurrentDesktop();
Console.WriteLine($"Using DXCapture.");
Console.WriteLine($"Current Desktop: {currentDesktop}");
if (currentDesktop != desktopName)
{
desktopName = currentDesktop;
var inputDesktop = Win32Interop.OpenInputDesktop();
var success = User32.SetThreadDesktop(inputDesktop);
User32.CloseDesktop(inputDesktop);
Logger.Write($"Set thread desktop: {success}");
Logger.Write($"Set thread desktop to {currentDesktop}: {success}");
return;
}
SharpDX.DXGI.Resource screenResource;
OutputDuplicateFrameInformation duplicateFrameInformation;
// Keep framerate below 30 FPS.
if (FramerateTimer.Elapsed.TotalMilliseconds > 33)
{
Thread.Sleep((int)FramerateTimer.Elapsed.TotalMilliseconds);
}
FramerateTimer.Restart();
// Try to get duplicated frame within given time is ms
duplicatedOutput.AcquireNextFrame(50, out duplicateFrameInformation, out screenResource);

View File

@ -27,6 +27,7 @@ namespace Remotely_ScreenCast
public static bool DisconnectRequested { get; set; }
public static string Mode { get; private set; }
public static string RequesterID { get; private set; }
public static string ServiceID { get; private set; }
public static string Host { get; private set; }
public static HubConnection Connection { get; private set; }
public static OutgoingMessages OutgoingMessages { get; private set; }

View File

@ -16,7 +16,7 @@
"UseDomainAuthentication": false,
"ShowMessageOfTheDay": true,
"DataRetentionInDays": 90,
"RemoteControlSessionLimit": 1,
"RemoteControlSessionLimit": 5,
"IceConfiguration": {
"iceServers": [
{ "urls": "stun:" },