Rebranding.

This commit is contained in:
Jared Goodwin 2019-03-01 18:37:10 -08:00
parent 33106672cd
commit d0abc9a2b4
22 changed files with 67 additions and 34 deletions

View File

@ -17,14 +17,6 @@
<RootNamespace>Remotely_Agent</RootNamespace>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\Remotely_ScreenCast.exe" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Remotely_ScreenCast.exe" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Management.Infrastructure" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="1.1.0" />
@ -73,4 +65,8 @@
<ProjectReference Include="..\Remotely_Library\Remotely_Library.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
</Project>

View File

@ -57,7 +57,7 @@ namespace Remotely_ScreenCast.Capture
}
}
public Rectangle CurrentScreenBounds { get; set; } = Screen.PrimaryScreen.Bounds;
private int selectedScreen = 0;
private int selectedScreen = Screen.AllScreens.ToList().IndexOf(Screen.PrimaryScreen);
private Graphics graphic;
private string desktopName;
@ -94,12 +94,12 @@ namespace Remotely_ScreenCast.Capture
}
FramerateTimer.Restart();
PreviousFrame = (Bitmap)CurrentFrame.Clone();
try
{
lock (ScreenLock)
{
PreviousFrame = (Bitmap)CurrentFrame.Clone();
graphic.CopyFromScreen(0 + CurrentScreenBounds.Left, 0 + CurrentScreenBounds.Top, 0, 0, new Size(CurrentScreenBounds.Width, CurrentScreenBounds.Height));
}
}

View File

@ -16,11 +16,11 @@ namespace Remotely_ScreenCast.Capture
/// </summary>
public class CursorIconWatcher
{
public static CursorIconWatcher Current { get; private set; } = new CursorIconWatcher();
public static CursorIconWatcher Current { get; } = new CursorIconWatcher();
public event EventHandler<int> OnChange;
private System.Timers.Timer ChangeTimer { get; set; }
private int PreviousCursorHandle { get; set; }
private User32.CursorInfo CursorInfo;
private User32.CursorInfo cursorInfo;
private CursorIconWatcher()
{
ChangeTimer = new System.Timers.Timer(100);
@ -36,15 +36,15 @@ namespace Remotely_ScreenCast.Capture
}
try
{
CursorInfo = new User32.CursorInfo();
CursorInfo.cbSize = Marshal.SizeOf(CursorInfo);
User32.GetCursorInfo(out CursorInfo);
if (CursorInfo.flags == User32.CURSOR_SHOWING)
cursorInfo = new User32.CursorInfo();
cursorInfo.cbSize = Marshal.SizeOf(cursorInfo);
User32.GetCursorInfo(out cursorInfo);
if (cursorInfo.flags == User32.CURSOR_SHOWING)
{
var currentCursor = CursorInfo.hCursor.ToInt32();
var currentCursor = cursorInfo.hCursor.ToInt32();
if (currentCursor != PreviousCursorHandle)
{
OnChange(this, currentCursor);
OnChange?.Invoke(this, currentCursor);
}
}
}

View File

@ -132,6 +132,7 @@ namespace Remotely_ScreenCast.Capture
{
if (NeedsInit)
{
duplicatedOutput?.Dispose();
Init();
NeedsInit = false;
}

View File

@ -13,6 +13,12 @@ namespace Remotely_ScreenCast.Capture
{
public class ImageDiff
{
private static EncoderParameters EncoderParams { get; } = new EncoderParameters()
{
Param = new EncoderParameter[] { new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 0) }
};
private static ImageCodecInfo CodecInfo { get; } = ImageCodecInfo.GetImageEncoders().FirstOrDefault(x => x.FormatID == ImageFormat.Png.Guid);
public static Bitmap GetImageDiff(Bitmap currentFrame, Bitmap previousFrame, bool captureFullscreen)
{
@ -89,7 +95,8 @@ namespace Remotely_ScreenCast.Capture
{
using (var ms = new MemoryStream())
{
bitmap.Save(ms, ImageFormat.Png);
// Byte array that indicates top left coordinates of the image.
bitmap.Save(ms, CodecInfo, EncoderParams);
// Byte array that indicates top left coordinates of the image.
return ms.ToArray();
}

View File

@ -47,7 +47,7 @@ namespace Remotely_ScreenCast.Capture
var viewer = new Models.Viewer()
{
Capturer = capturer,
CurrentScreenIndex = 0,
CurrentScreenIndex = capturer.SelectedScreen,
DisconnectRequested = false,
Name = requesterName,
ViewerConnectionID = viewerID,
@ -72,7 +72,7 @@ namespace Remotely_ScreenCast.Capture
{
await outgoingMessages.SendScreenSize(size.Width, size.Height, viewerID);
};
while (!viewer.DisconnectRequested)
{
try

View File

@ -50,6 +50,8 @@ namespace Remotely_ScreenCast
MessageHandlers.ApplyConnectionHandlers(Connection, OutgoingMessages);
CursorIconWatcher.Current.OnChange += CursorIconWatcher_OnChange;
OutgoingMessages.NotifyRequesterUnattendedReady(RequesterID).Wait();
StartWaitForViewerTimer();
@ -57,6 +59,11 @@ namespace Remotely_ScreenCast
Console.Read();
}
private static async void CursorIconWatcher_OnChange(object sender, int cursor)
{
await OutgoingMessages.SendCursorChange(cursor, Viewers.Keys.ToList());
}
private static void StartWaitForViewerTimer()
{
var timer = new System.Timers.Timer(5000);

View File

@ -34,5 +34,10 @@ namespace Remotely_ScreenCast.Sockets
{
await Connection.SendAsync("NotifyRequesterUnattendedReady", requesterID);
}
public async Task SendCursorChange(int cursor, List<string> viewerIDs)
{
await Connection.SendAsync("SendCursorChange", cursor, viewerIDs);
}
}
}

View File

@ -138,13 +138,13 @@ namespace Remotely_Server
});
routes.MapHub<RCDeviceSocketHub>("/RCDeviceHub", options =>
{
options.ApplicationMaxBufferSize = 1000000;
options.TransportMaxBufferSize = 1000000;
options.ApplicationMaxBufferSize = 5000000;
options.TransportMaxBufferSize = 5000000;
});
routes.MapHub<RCBrowserSocketHub>("/RCBrowserHub", options =>
{
options.ApplicationMaxBufferSize = 1000000;
options.TransportMaxBufferSize = 1000000;
options.ApplicationMaxBufferSize = 5000000;
options.TransportMaxBufferSize = 5000000;
});
});
app.UseMvcWithDefaultRoute();

View File

@ -72,7 +72,6 @@ var commands = [
UI.AddConsoleOutput(paramDictionary["message"]);
}),
new ConsoleCommand("ExpandResults", [], "Expands the results of the last scripting command.", "expandresults", "", (parameters, paramDictionary) => {
// TODO
$(UI.ConsoleOutputDiv).find(".command-harness").last().find(".collapse")['collapse']('show');
}),
new ConsoleCommand("CollapseResults", [], "Collapses all scripting results.", "collapseresults", "", (parameters, paramDictionary) => {

File diff suppressed because one or more lines are too long

View File

@ -126,7 +126,6 @@ var commands: Array<ConsoleCommand> = [
"expandresults",
"",
(parameters, paramDictionary) => {
// TODO
$(UI.ConsoleOutputDiv).find(".command-harness").last().find(".collapse")['collapse']('show');
}
),

View File

@ -100,6 +100,7 @@ export class RCBrowserSockets {
hubConnection.on("ScreenSize", (width, height) => {
UI.ScreenViewer.width = width;
UI.ScreenViewer.height = height;
UI.Screen2DContext.clearRect(0, 0, width, height);
});
hubConnection.on("ScreenCapture", (buffer, captureTime) => {
var img = new Image();

File diff suppressed because one or more lines are too long

View File

@ -108,8 +108,9 @@ export class RCBrowserSockets {
hubConnection.on("ScreenSize", (width: number, height: number) => {
UI.ScreenViewer.width = width;
UI.ScreenViewer.height = height;
UI.Screen2DContext.clearRect(0, 0, width, height);
});
hubConnection.on("ScreenCapture", (buffer:string, captureTime:string) => {
hubConnection.on("ScreenCapture", (buffer: string, captureTime: string) => {
var img = new Image();
img.onload = () => {
var frameDelay = Date.now() - new Date(captureTime).getTime();

View File

@ -121,7 +121,7 @@ export function ApplyInputHandlers(sockets) {
lastPointerMove = Date.now();
var percentX = e.offsetX / ScreenViewer.clientWidth;
var percentY = e.offsetY / ScreenViewer.clientHeight;
//sockets.SendMouseMove(percentX, percentY);
sockets.SendMouseMove(percentX, percentY);
});
ScreenViewer.addEventListener("mousedown", function (e) {
if (e.button != 0 && e.button != 2) {

File diff suppressed because one or more lines are too long

View File

@ -127,7 +127,7 @@ export function ApplyInputHandlers(sockets: RCBrowserSockets) {
lastPointerMove = Date.now();
var percentX = e.offsetX / ScreenViewer.clientWidth;
var percentY = e.offsetY / ScreenViewer.clientHeight;
//sockets.SendMouseMove(percentX, percentY);
sockets.SendMouseMove(percentX, percentY);
});
ScreenViewer.addEventListener("mousedown", function (e) {
if (e.button != 0 && e.button != 2) {

View File

@ -56,4 +56,12 @@ export async function When(predicate) {
checkCondition();
});
}
export function ConvertBase64ToUInt8Array(base64) {
var binaryString = window.atob(base64);
var bytes = new Uint8ClampedArray(binaryString.length);
for (var i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return bytes;
}
//# sourceMappingURL=Utilities.js.map

View File

@ -1 +1 @@
{"version":3,"file":"Utilities.js","sourceRoot":"","sources":["Utilities.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,cAAqB,EAAE,QAAgB,EAAE,KAAa;IACxE,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI,eAAe,GAAG,cAAc,CAAC;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE;YACzC,MAAM;SACT;QACD,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC9E,eAAe,GAAG,eAAe,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;KAChG;IACD,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClC,OAAO,WAAW,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,UAAU;IACtB,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC;QACtE,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;QACpE,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,a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CAAC,CAAC;IACvC,IAAI,KAAK,GAAG,IAAI,iBAAiB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACzC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}

View File

@ -60,4 +60,13 @@ export async function When(predicate: () => boolean) {
}
checkCondition();
})
}
export function ConvertBase64ToUInt8Array(base64:string) {
var binaryString = window.atob(base64);
var bytes = new Uint8ClampedArray(binaryString.length);
for (var i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return bytes;
}