Added app manifest. ImageDiff tweaks.

This commit is contained in:
Jared Goodwin 2019-03-18 18:34:07 -07:00
parent bd424da533
commit 413f28afad
8 changed files with 156 additions and 62 deletions

View File

@ -6,22 +6,22 @@ Public Server: https://tryremotely.lucency.co
## Build Instructions (Windows 10)
The following steps will configure your Windows 10 machine for building the Remotely server and clients.
* Install .NET Core SDK.
* Install Visual Studio 2019.
* Link: https://visualstudio.microsoft.com/downloads/
* Install the latest .NET Core SDK.
* Link: https://dotnet.microsoft.com/download
* Clone the git repository and open the solution in Visual Studio.
* Build (in Release configuration) the Remotely_Desktop and Remotely_ScreenCast projects.
* Run Publish.ps1 in the Utilities folder.
* Example: powershell -f [path]\Publish.ps1 -outdir C:\inetpub\remotely -rid win10-x86
* The output folder will now contain the server, with the clients in the Downloads folder.
* Change values in appsettings.json for your environment.
* Documentation for hosting in IIS can be found here: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.2
## Build Instructions (Linux)
* Install .NET Core SDK.
* Link: https://dotnet.microsoft.com/download
* Install PowerShell Core.
* Link: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6
* Run Publish.ps1 in the Utilities folder.
* Example: pwsh -f [path]/Publish.ps1 -outdir /var/www/remotely -rid linux-x64
* The output folder will now contain the server, with the clients in the Downloads folder.
## Hosting a Server (Windows)
## Hosting a Server (Linux)
* Download and unzip the Linux server package.
* Run Remotely_Server_Setup.sh (with sudo) in the Utilities folder.
* App root will be the above output folder.
* Change values in appsettings.json for your environment.

View File

@ -41,6 +41,9 @@
<PropertyGroup>
<ApplicationIcon>favicon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Costura, Version=3.3.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.3.3.2\lib\net40\Costura.dll</HintPath>
@ -114,6 +117,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@ -173,7 +173,7 @@ namespace Remotely_ScreenCast.Capture
output1 = output.QueryInterface<Output1>();
// Width/Height of desktop to capture
var bounds = output.Description.DesktopBounds;
var bounds = output1.Description.DesktopBounds;
var newWidth = bounds.Right - bounds.Left;
var newHeight = bounds.Bottom - bounds.Top;
CurrentScreenBounds = new Rectangle(bounds.Left, bounds.Top, newWidth, newHeight);

View File

@ -45,66 +45,78 @@ namespace Remotely_ScreenCast.Capture
int right = int.MinValue;
int bottom = int.MinValue;
var bd1 = previousFrame.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, currentFrame.PixelFormat);
var bd2 = currentFrame.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, previousFrame.PixelFormat);
BitmapData bd1 = null;
BitmapData bd2 = null;
var bytesPerPixel = Bitmap.GetPixelFormatSize(currentFrame.PixelFormat) / 8;
var totalSize = bd1.Height * bd1.Width * bytesPerPixel;
unsafe
try
{
byte* scan1 = (byte*)bd1.Scan0.ToPointer();
byte* scan2 = (byte*)bd2.Scan0.ToPointer();
bd1 = previousFrame.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, currentFrame.PixelFormat);
bd2 = currentFrame.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, previousFrame.PixelFormat);
for (int counter = 0; counter < totalSize - bytesPerPixel; counter += bytesPerPixel)
var bytesPerPixel = Bitmap.GetPixelFormatSize(currentFrame.PixelFormat) / 8;
var totalSize = bd1.Height * bd1.Width * bytesPerPixel;
unsafe
{
byte* data1 = scan1 + counter;
byte* data2 = scan2 + counter;
byte* scan1 = (byte*)bd1.Scan0.ToPointer();
byte* scan2 = (byte*)bd2.Scan0.ToPointer();
if (data1[0] != data2[0] ||
data1[1] != data2[1] ||
data1[2] != data2[2] ||
data1[3] != data2[3])
for (int counter = 0; counter < totalSize - bytesPerPixel; counter += bytesPerPixel)
{
// Change was found.
var pixel = counter / 4;
var row = (int)Math.Floor((double)pixel / bd1.Width);
var column = pixel % bd1.Width;
if (row < top)
byte* data1 = scan1 + counter;
byte* data2 = scan2 + counter;
if (data1[0] != data2[0] ||
data1[1] != data2[1] ||
data1[2] != data2[2] ||
data1[3] != data2[3])
{
top = row;
}
if (row > bottom)
{
bottom = row;
}
if (column < left)
{
left = column;
}
if (column > right)
{
right = column;
// Change was found.
var pixel = counter / 4;
var row = (int)Math.Floor((double)pixel / bd1.Width);
var column = pixel % bd1.Width;
if (row < top)
{
top = row;
}
if (row > bottom)
{
bottom = row;
}
if (column < left)
{
left = column;
}
if (column > right)
{
right = column;
}
}
}
}
if (left < right && top < bottom)
{
// Bounding box is valid.
left = Math.Max(left - 20, 0);
top = Math.Max(top - 20, 0);
right = Math.Min(right + 20, width);
bottom = Math.Min(bottom + 20, height);
currentFrame.UnlockBits(bd1);
previousFrame.UnlockBits(bd2);
return new Rectangle(left, top, right - left, bottom - top);
}
else
{
currentFrame.UnlockBits(bd1);
previousFrame.UnlockBits(bd2);
return Rectangle.Empty;
}
}
if (left < right && top < bottom)
{
// Bounding box is valid.
left = Math.Max(left - 20, 0);
top = Math.Max(top - 20, 0);
right = Math.Min(right + 20, width);
bottom = Math.Min(bottom + 20, height);
currentFrame.UnlockBits(bd1);
previousFrame.UnlockBits(bd2);
return new Rectangle(left, top, right - left, bottom - top);
}
else
catch
{
currentFrame.UnlockBits(bd1);
previousFrame.UnlockBits(bd2);

View File

@ -37,7 +37,7 @@ namespace Remotely_Server.Services
if (!IsProcessing)
{
IsProcessing = true;
Task.Run(StartProcessing);
Task.Run(new Action(StartProcessing));
}
}
}

View File

@ -1 +1 @@
2019.03.17.1951
2019.03.18.1822

View File

@ -113,4 +113,6 @@ systemctl start remotely.service
# Install Certbot and get SSL cert.
apt-get install certbot python-certbot-nginx
certbot --nginx
certbot --nginx
apt-get install ffmpeg