mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Rebranding.
This commit is contained in:
parent
8ea983372b
commit
b320e5e3d0
Binary file not shown.
@ -19,18 +19,11 @@ namespace Remotely_ScreenCast.Capture
|
||||
public class BitBltCapture : ICapturer
|
||||
{
|
||||
public Bitmap CurrentFrame { get; set; }
|
||||
public Size CurrentScreenSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return CurrentBounds.Size;
|
||||
}
|
||||
}
|
||||
public Bitmap PreviousFrame { get; set; }
|
||||
public bool IsCapturing { get; set; }
|
||||
public bool CaptureFullscreen { get; set; } = true;
|
||||
public int PauseForMilliseconds { get; set; }
|
||||
public EventHandler<Size> ScreenChanged { get; set; }
|
||||
public EventHandler<Rectangle> ScreenChanged { get; set; }
|
||||
public int SelectedScreen
|
||||
{
|
||||
get
|
||||
@ -51,38 +44,27 @@ namespace Remotely_ScreenCast.Capture
|
||||
{
|
||||
selectedScreen = 0;
|
||||
}
|
||||
CurrentBounds = Screen.AllScreens[selectedScreen].Bounds;
|
||||
ScreenChanged?.Invoke(this, CurrentBounds.Size);
|
||||
CurrentScreenBounds = Screen.AllScreens[selectedScreen].Bounds;
|
||||
ScreenChanged?.Invoke(this, CurrentScreenBounds);
|
||||
}
|
||||
}
|
||||
public Rectangle CurrentBounds { get; set; } = Screen.PrimaryScreen.Bounds;
|
||||
public Rectangle CurrentScreenBounds { get; set; } = Screen.PrimaryScreen.Bounds;
|
||||
private int selectedScreen = 0;
|
||||
|
||||
// Offsets are the left and top edge of the screen, in case multiple monitor setups
|
||||
// create a situation where the edge of a monitor is in the negative. This must
|
||||
// be converted to a 0-based max left/top to render images on the canvas properly.
|
||||
private Graphics graphic;
|
||||
private string desktopName;
|
||||
|
||||
|
||||
public BitBltCapture()
|
||||
{
|
||||
CurrentFrame = new Bitmap(CurrentBounds.Width, CurrentBounds.Height, PixelFormat.Format32bppArgb);
|
||||
PreviousFrame = new Bitmap(CurrentBounds.Width, CurrentBounds.Height, PixelFormat.Format32bppArgb);
|
||||
CurrentFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb);
|
||||
PreviousFrame = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height, PixelFormat.Format32bppArgb);
|
||||
graphic = Graphics.FromImage(CurrentFrame);
|
||||
desktopName = Win32Interop.GetCurrentDesktop();
|
||||
}
|
||||
|
||||
private void CursorIcon_OnChange(object sender, int e)
|
||||
{
|
||||
//AditClient.SocketMessageHandler.SendIconUpdate(e);
|
||||
}
|
||||
|
||||
public void Capture()
|
||||
{
|
||||
Console.WriteLine($"Using BitBlt Capturer.");
|
||||
var currentDesktop = Win32Interop.GetCurrentDesktop();
|
||||
Console.WriteLine($"Current Desktop: {currentDesktop}");
|
||||
if (currentDesktop != desktopName)
|
||||
{
|
||||
desktopName = currentDesktop;
|
||||
@ -97,7 +79,7 @@ namespace Remotely_ScreenCast.Capture
|
||||
|
||||
try
|
||||
{
|
||||
graphic.CopyFromScreen(0 + CurrentBounds.Left, 0 + CurrentBounds.Top, 0, 0, new Size(CurrentBounds.Width, CurrentBounds.Height));
|
||||
graphic.CopyFromScreen(0 + CurrentScreenBounds.Left, 0 + CurrentScreenBounds.Top, 0, 0, new Size(CurrentScreenBounds.Width, CurrentScreenBounds.Height));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -105,5 +87,11 @@ namespace Remotely_ScreenCast.Capture
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public Point GetAbsoluteScreenCoordinatesFromPercentages(decimal percentX, decimal percentY)
|
||||
{
|
||||
var absoluteX = (CurrentScreenBounds.Width * percentX) + CurrentScreenBounds.Left;
|
||||
var absoluteY = (CurrentScreenBounds.Height * percentY) + CurrentScreenBounds.Top;
|
||||
return new Point((int)absoluteX, (int)absoluteY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,15 +21,9 @@ namespace Remotely_ScreenCast.Capture
|
||||
{
|
||||
public Bitmap PreviousFrame { get; set; }
|
||||
public Bitmap CurrentFrame { get; set; }
|
||||
public Size CurrentScreenSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Size(width, height);
|
||||
}
|
||||
}
|
||||
public Rectangle CurrentScreenBounds { get; private set; }
|
||||
public bool CaptureFullscreen { get; set; } = true;
|
||||
public EventHandler<Size> ScreenChanged { get; set; }
|
||||
public EventHandler<Rectangle> ScreenChanged { get; set; }
|
||||
public int SelectedScreen
|
||||
{
|
||||
get
|
||||
@ -93,12 +87,14 @@ namespace Remotely_ScreenCast.Capture
|
||||
output = adapter.GetOutput(selectedScreen);
|
||||
output1 = output.QueryInterface<Output1>();
|
||||
|
||||
// Width/Height of desktop to capture
|
||||
var newWidth = output.Description.DesktopBounds.Right - output.Description.DesktopBounds.Left;
|
||||
var newHeight = output.Description.DesktopBounds.Bottom - output.Description.DesktopBounds.Top;
|
||||
// Width/Height of desktop to capture
|
||||
var bounds = output.Description.DesktopBounds;
|
||||
var newWidth = bounds.Right - bounds.Left;
|
||||
var newHeight = bounds.Bottom - bounds.Top;
|
||||
CurrentScreenBounds = new Rectangle(bounds.Left, bounds.Top, newWidth, newHeight);
|
||||
if (newWidth != width || newHeight != height)
|
||||
{
|
||||
ScreenChanged?.Invoke(this, new Size(newWidth, newHeight));
|
||||
ScreenChanged?.Invoke(this, CurrentScreenBounds);
|
||||
}
|
||||
width = newWidth;
|
||||
height = newHeight;
|
||||
@ -212,5 +208,11 @@ namespace Remotely_ScreenCast.Capture
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public Point GetAbsoluteScreenCoordinatesFromPercentages(decimal percentX, decimal percentY)
|
||||
{
|
||||
var absoluteX = (CurrentScreenBounds.Width * percentX) + CurrentScreenBounds.Left;
|
||||
var absoluteY = (CurrentScreenBounds.Height * percentY) + CurrentScreenBounds.Top;
|
||||
return new Point((int)absoluteX, (int)absoluteY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,12 +10,13 @@ namespace Remotely_ScreenCast.Capture
|
||||
public interface ICapturer
|
||||
{
|
||||
Bitmap CurrentFrame { get; set; }
|
||||
Size CurrentScreenSize { get; }
|
||||
|
||||
Rectangle CurrentScreenBounds { get; }
|
||||
Bitmap PreviousFrame { get; set; }
|
||||
bool CaptureFullscreen { get; set; }
|
||||
void Capture();
|
||||
EventHandler<Size> ScreenChanged { get; set; }
|
||||
EventHandler<Rectangle> ScreenChanged { get; set; }
|
||||
int SelectedScreen { get; set; }
|
||||
|
||||
Point GetAbsoluteScreenCoordinatesFromPercentages(decimal percentX, decimal percentY);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,5 +14,6 @@ namespace Remotely_ScreenCapture.Models
|
||||
public ICapturer Capturer { get; set; }
|
||||
public int CurrentScreenIndex { get; set; }
|
||||
public bool DisconnectRequested { get; set; }
|
||||
public bool HasControl { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,20 +29,56 @@ namespace Remotely_ScreenCapture.Sockets
|
||||
BeginScreenCasting(hubConnection, viewerID, requesterName, outgoingMessages);
|
||||
});
|
||||
|
||||
hubConnection.On("KeyDown", (int keyCode) =>
|
||||
hubConnection.On("KeyDown", (int keyCode, string viewerID) =>
|
||||
{
|
||||
Win32Interop.SendKeyDown((User32.VirtualKeyShort)keyCode);
|
||||
var viewer = Program.Viewers[viewerID];
|
||||
if (viewer.HasControl)
|
||||
{
|
||||
Win32Interop.SendKeyDown((User32.VirtualKeyShort)keyCode);
|
||||
}
|
||||
});
|
||||
|
||||
hubConnection.On("KeyUp", (int keyCode) =>
|
||||
hubConnection.On("KeyUp", (int keyCode, string viewerID) =>
|
||||
{
|
||||
Win32Interop.SendKeyUp((User32.VirtualKeyShort)keyCode);
|
||||
var viewer = Program.Viewers[viewerID];
|
||||
if (viewer.HasControl)
|
||||
{
|
||||
Win32Interop.SendKeyUp((User32.VirtualKeyShort)keyCode);
|
||||
}
|
||||
});
|
||||
|
||||
hubConnection.On("KeyPress", (int keyCode) =>
|
||||
hubConnection.On("KeyPress", (int keyCode, string viewerID) =>
|
||||
{
|
||||
Win32Interop.SendKeyDown((User32.VirtualKeyShort)keyCode);
|
||||
Win32Interop.SendKeyUp((User32.VirtualKeyShort)keyCode);
|
||||
var viewer = Program.Viewers[viewerID];
|
||||
if (viewer.HasControl)
|
||||
{
|
||||
Win32Interop.SendKeyDown((User32.VirtualKeyShort)keyCode);
|
||||
Win32Interop.SendKeyUp((User32.VirtualKeyShort)keyCode);
|
||||
}
|
||||
});
|
||||
|
||||
hubConnection.On("MouseMove", (decimal percentX, decimal percentY, string viewerID) =>
|
||||
{
|
||||
var viewer = Program.Viewers[viewerID];
|
||||
if (viewer.HasControl)
|
||||
{
|
||||
var mousePoint = viewer.Capturer.GetAbsoluteScreenCoordinatesFromPercentages(percentX, percentY);
|
||||
Win32Interop.SendMouseMove(mousePoint.X, mousePoint.Y);
|
||||
}
|
||||
});
|
||||
|
||||
hubConnection.On("ViewerDisconnected", (string viewerID) =>
|
||||
{
|
||||
if (Program.Viewers.ContainsKey(viewerID))
|
||||
{
|
||||
var viewer = Program.Viewers[viewerID];
|
||||
viewer.DisconnectRequested = true;
|
||||
var success = false;
|
||||
while (!success)
|
||||
{
|
||||
success = Program.Viewers.TryRemove(viewerID, out _);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -74,7 +110,8 @@ namespace Remotely_ScreenCapture.Sockets
|
||||
CurrentScreenIndex = 0,
|
||||
DisconnectRequested = false,
|
||||
Name = requesterName,
|
||||
ViewerConnectionID = viewerID
|
||||
ViewerConnectionID = viewerID,
|
||||
HasControl = Program.Mode == "unattended"
|
||||
};
|
||||
|
||||
|
||||
@ -89,7 +126,7 @@ namespace Remotely_ScreenCapture.Sockets
|
||||
Screen.AllScreens.Length,
|
||||
viewerID);
|
||||
|
||||
await outgoingMessages.SendScreenSize(capturer.CurrentScreenSize.Width, capturer.CurrentScreenSize.Height, viewerID);
|
||||
await outgoingMessages.SendScreenSize(capturer.CurrentScreenBounds.Width, capturer.CurrentScreenBounds.Height, viewerID);
|
||||
|
||||
capturer.ScreenChanged += async (sender, size) =>
|
||||
{
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<div id="dataGridFrame" class="tab-pane fade">
|
||||
<div id="deviceGridWrapper">
|
||||
<div id="gridControlsWrapper">
|
||||
<button id="startRemoteControlButton" class="btn btn-xs btn-secondary">Remote Control</button>
|
||||
<button id="toggleAllDevices" class="btn btn-xs btn-secondary">Select All</button>
|
||||
<button id="startRemoteControlButton" class="btn btn-sm btn-secondary">Remote Control</button>
|
||||
<button id="toggleAllDevices" class="btn btn-sm btn-secondary">Select All</button>
|
||||
<span>Filter:</span>
|
||||
<input id="gridFilter" />
|
||||
</div>
|
||||
|
||||
@ -19,12 +19,7 @@ namespace Remotely_Server.Services
|
||||
this.DeviceHub = deviceHub;
|
||||
}
|
||||
public static ConcurrentDictionary<string, RemotelyUser> OrganizationConnectionList { get; set; } = new ConcurrentDictionary<string, RemotelyUser>();
|
||||
private DataService DataService { get; }
|
||||
private IHubContext<RCDeviceSocketHub> RCDeviceHub { get; }
|
||||
|
||||
private ApplicationConfig AppConfig { get; set; }
|
||||
private IHubContext<DeviceSocketHub> DeviceHub { get; }
|
||||
|
||||
private string ClientID
|
||||
{
|
||||
get
|
||||
@ -32,6 +27,7 @@ namespace Remotely_Server.Services
|
||||
return Context.Items["ClientID"] as string;
|
||||
}
|
||||
}
|
||||
|
||||
private string ClientType
|
||||
{
|
||||
get
|
||||
@ -39,6 +35,10 @@ namespace Remotely_Server.Services
|
||||
return Context.Items["ClientType"] as string;
|
||||
}
|
||||
}
|
||||
|
||||
private DataService DataService { get; }
|
||||
private IHubContext<DeviceSocketHub> DeviceHub { get; }
|
||||
private IHubContext<RCDeviceSocketHub> RCDeviceHub { get; }
|
||||
private string RequesterName
|
||||
{
|
||||
get
|
||||
@ -46,26 +46,79 @@ namespace Remotely_Server.Services
|
||||
return Context.Items["RequesterName"] as string;
|
||||
}
|
||||
}
|
||||
public async Task GetIceConfiguration()
|
||||
|
||||
public async Task CtrlAltDel(string serviceID)
|
||||
{
|
||||
//await Clients.Caller.SendAsync("IceConfiguration", AppConfig.IceConfiguration);
|
||||
await DeviceHub.Clients.Client(serviceID).SendAsync("CtrlAltDel");
|
||||
}
|
||||
public async Task SendRTCSessionToDevice(object offer, string clientType, string clientID)
|
||||
|
||||
public async Task KeyDown(string key)
|
||||
{
|
||||
if (clientType == "Normal")
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("KeyDown", key, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task KeyPress(string key)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("KeyPress", key, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task KeyUp(string key)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("KeyUp", key, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task LongPress()
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("LongPress", Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task MouseDown(string button, double percentX, double percentY)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("MouseDown", button, percentX, percentY, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task MouseMove(double percentX, double percentY)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("MouseMove", percentX, percentY, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task MouseUp(string button, double percentX, double percentY)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("MouseUp", button, percentX, percentY, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task MouseWheel(double deltaX, double deltaY)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("MouseWheel", deltaX, deltaY, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public override Task OnConnectedAsync()
|
||||
{
|
||||
if (Context.User.Identity.IsAuthenticated)
|
||||
{
|
||||
clientID = RCDeviceSocketHub.AttendedSessionList[clientID];
|
||||
var user = DataService.GetUserByName(Context.User.Identity.Name);
|
||||
OrganizationConnectionList.TryAdd(Context.ConnectionId, user);
|
||||
}
|
||||
await RCDeviceHub.Clients.Client(clientID).SendAsync("RTCSession", offer, Context.ConnectionId);
|
||||
return base.OnConnectedAsync();
|
||||
}
|
||||
public async Task SendIceCandidateToDevice(object candidate, string clientType, string clientID)
|
||||
|
||||
public override async Task OnDisconnectedAsync(Exception exception)
|
||||
{
|
||||
if (clientType == "Normal")
|
||||
if (Context.User.Identity.IsAuthenticated)
|
||||
{
|
||||
clientID = RCDeviceSocketHub.AttendedSessionList[clientID];
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("ViewerDisconnected", Context.ConnectionId);
|
||||
while (!OrganizationConnectionList.TryRemove(Context.ConnectionId, out var user))
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
}
|
||||
await RCDeviceHub.Clients.Client(clientID).SendAsync("IceCandidate", candidate, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task SelectScreen(int screenIndex)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("SelectScreen", screenIndex, Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task SendScreenCastRequestToDevice(string clientID, string requesterName, string clientType)
|
||||
{
|
||||
if (clientType == "Normal")
|
||||
@ -92,49 +145,20 @@ namespace Remotely_Server.Services
|
||||
Context.Items["RequesterName"] = requesterName;
|
||||
await RCDeviceHub.Clients.Client(clientID).SendAsync("GetScreenCast", Context.ConnectionId, requesterName);
|
||||
}
|
||||
public async Task SelectScreen(int screenIndex)
|
||||
public async Task SendSharedFileIDs(List<string> fileIDs)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("SelectScreen", screenIndex, Context.ConnectionId);
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("SharedFileIDs", fileIDs, Context.ConnectionId);
|
||||
}
|
||||
public async Task MouseMove(double percentX, double percentY)
|
||||
|
||||
public async Task Tap()
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("MouseMove", percentX, percentY, Context.ConnectionId);
|
||||
}
|
||||
public async Task MouseDown(string button, double percentX, double percentY)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("MouseDown", button, percentX, percentY, Context.ConnectionId);
|
||||
}
|
||||
public async Task MouseUp(string button, double percentX, double percentY)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("MouseUp", button, percentX, percentY, Context.ConnectionId);
|
||||
}
|
||||
public override Task OnConnectedAsync()
|
||||
{
|
||||
if (Context.User.Identity.IsAuthenticated)
|
||||
{
|
||||
var user = DataService.GetUserByName(Context.User.Identity.Name);
|
||||
OrganizationConnectionList.TryAdd(Context.ConnectionId, user);
|
||||
}
|
||||
return base.OnConnectedAsync();
|
||||
}
|
||||
public override async Task OnDisconnectedAsync(Exception exception)
|
||||
{
|
||||
if (Context.User.Identity.IsAuthenticated)
|
||||
{
|
||||
while (!OrganizationConnectionList.TryRemove(Context.ConnectionId, out var user))
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
}
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("Tap", Context.ConnectionId);
|
||||
}
|
||||
|
||||
public async Task TouchDown()
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("TouchDown", Context.ConnectionId);
|
||||
}
|
||||
public async Task LongPress()
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("LongPress", Context.ConnectionId);
|
||||
}
|
||||
public async Task TouchMove(double moveX, double moveY)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("TouchMove", moveX, moveY, Context.ConnectionId);
|
||||
@ -143,33 +167,5 @@ namespace Remotely_Server.Services
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("TouchUp", Context.ConnectionId);
|
||||
}
|
||||
public async Task Tap()
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("Tap", Context.ConnectionId);
|
||||
}
|
||||
public async Task MouseWheel(double deltaX, double deltaY)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("MouseWheel", deltaX, deltaY, Context.ConnectionId);
|
||||
}
|
||||
public async Task KeyDown(string key)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("KeyDown", key, Context.ConnectionId);
|
||||
}
|
||||
public async Task KeyUp(string key)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("KeyUp", key, Context.ConnectionId);
|
||||
}
|
||||
public async Task KeyPress(string key)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("KeyPress", key, Context.ConnectionId);
|
||||
}
|
||||
public async Task CtrlAltDel(string serviceID)
|
||||
{
|
||||
await DeviceHub.Clients.Client(serviceID).SendAsync("CtrlAltDel");
|
||||
}
|
||||
public async Task SendSharedFileIDs(List<string> fileIDs)
|
||||
{
|
||||
await RCDeviceHub.Clients.Client(ClientID).SendAsync("SharedFileIDs", fileIDs, Context.ConnectionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,22 +105,11 @@ export class RCBrowserSockets {
|
||||
UI.ScreenViewer.height = height;
|
||||
});
|
||||
hubConnection.on("ScreenCapture", (buffer) => {
|
||||
var decodedString = window.atob(buffer);
|
||||
var len = decodedString.length;
|
||||
var bytes = new Uint8ClampedArray(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
bytes[i] = decodedString.charCodeAt(i);
|
||||
}
|
||||
;
|
||||
var imageData = new ImageData(bytes, UI.ScreenViewer.width, UI.ScreenViewer.height);
|
||||
UI.Screen2DContext.putImageData(imageData, 0, 0);
|
||||
//var url = window.URL.createObjectURL(new Blob([buffer]));
|
||||
//var img = document.createElement("img");
|
||||
//img.onload = function () {
|
||||
// UI.Screen2DContext.drawImage(img, 0, 0, UI.ScreenViewer.width, UI.ScreenViewer.height);
|
||||
// window.URL.revokeObjectURL(url);
|
||||
//};
|
||||
//img.src = url;
|
||||
var img = new Image();
|
||||
img.onload = () => {
|
||||
UI.Screen2DContext.drawImage(img, 0, 0);
|
||||
};
|
||||
img.src = "data:image/png;base64," + buffer;
|
||||
});
|
||||
hubConnection.on("ConnectionFailed", () => {
|
||||
UI.ConnectButton.removeAttribute("disabled");
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -114,21 +114,11 @@ export class RCBrowserSockets {
|
||||
UI.ScreenViewer.height = height;
|
||||
});
|
||||
hubConnection.on("ScreenCapture", (buffer) => {
|
||||
var decodedString = window.atob(buffer);
|
||||
var len = decodedString.length;
|
||||
var bytes = new Uint8ClampedArray(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
bytes[i] = decodedString.charCodeAt(i);
|
||||
};
|
||||
var imageData = new ImageData(bytes, UI.ScreenViewer.width, UI.ScreenViewer.height);
|
||||
UI.Screen2DContext.putImageData(imageData, 0, 0);
|
||||
//var url = window.URL.createObjectURL(new Blob([buffer]));
|
||||
//var img = document.createElement("img");
|
||||
//img.onload = function () {
|
||||
// UI.Screen2DContext.drawImage(img, 0, 0, UI.ScreenViewer.width, UI.ScreenViewer.height);
|
||||
// window.URL.revokeObjectURL(url);
|
||||
//};
|
||||
//img.src = url;
|
||||
var img = new Image();
|
||||
img.onload = () => {
|
||||
UI.Screen2DContext.drawImage(img, 0, 0);
|
||||
}
|
||||
img.src = "data:image/png;base64," + buffer;
|
||||
});
|
||||
hubConnection.on("ConnectionFailed", () => {
|
||||
UI.ConnectButton.removeAttribute("disabled");
|
||||
|
||||
@ -11,9 +11,9 @@ export function CreateCommandHarness(context) {
|
||||
Total Devices: <span id="${context.ID}-totaldevices">${context.TargetDeviceIDs.length}</span> |
|
||||
Completed: <span id="${context.ID}-completed">0%</span> |
|
||||
Errors: <span id="${context.ID}-errors">0</span> |
|
||||
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${context.ID}-results">View</button>
|
||||
<a class="btn btn-xs btn-secondary" target="_blank" href="${location.origin}/API/Commands/JSON/${context.ID}">JSON</a>
|
||||
<a class="btn btn-xs btn-secondary" target="_blank" href="${location.origin}/API/Commands/XML/${context.ID}">XML</a>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${context.ID}-results'>View</button>
|
||||
<a class="btn btn-sm btn-secondary" target="_blank" href="${location.origin}/API/Commands/JSON/${context.ID}">JSON</a>
|
||||
<a class="btn btn-sm btn-secondary" target="_blank" href="${location.origin}/API/Commands/XML/${context.ID}">XML</a>
|
||||
</div>
|
||||
<div id="${context.ID}-results" class="${collapseClass}">
|
||||
</div>`;
|
||||
@ -29,9 +29,9 @@ export function AddPSCoreResultsHarness(result) {
|
||||
<div class="result-header">
|
||||
Device: ${deviceName} |
|
||||
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes" : "No"} |
|
||||
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${result.CommandContextID + result.DeviceID}-result'>View</button>
|
||||
</div>
|
||||
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
|
||||
<div id='${result.CommandContextID + result.DeviceID}-result' class="command-result-output ${collapseClass}">
|
||||
<div>Host Output:<br>${result.HostOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
<div>Debug Output:<br>${result.DebugOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
<div>Verbose Output:<br>${result.VerboseOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
@ -57,7 +57,7 @@ export function AddCommandResultsHarness(result) {
|
||||
<div class="result-header">
|
||||
Device: ${deviceName} |
|
||||
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes" : "No"} |
|
||||
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
|
||||
</div>
|
||||
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
|
||||
<div>Standard Output:<br>${result.StandardOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
|
||||
@ -15,9 +15,9 @@ export function CreateCommandHarness(context: CommandContext): HTMLDivElement {
|
||||
Total Devices: <span id="${context.ID}-totaldevices">${context.TargetDeviceIDs.length}</span> |
|
||||
Completed: <span id="${context.ID}-completed">0%</span> |
|
||||
Errors: <span id="${context.ID}-errors">0</span> |
|
||||
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${context.ID}-results">View</button>
|
||||
<a class="btn btn-xs btn-secondary" target="_blank" href="${location.origin}/API/Commands/JSON/${context.ID}">JSON</a>
|
||||
<a class="btn btn-xs btn-secondary" target="_blank" href="${location.origin}/API/Commands/XML/${context.ID}">XML</a>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${context.ID}-results'>View</button>
|
||||
<a class="btn btn-sm btn-secondary" target="_blank" href="${location.origin}/API/Commands/JSON/${context.ID}">JSON</a>
|
||||
<a class="btn btn-sm btn-secondary" target="_blank" href="${location.origin}/API/Commands/XML/${context.ID}">XML</a>
|
||||
</div>
|
||||
<div id="${context.ID}-results" class="${collapseClass}">
|
||||
</div>`;
|
||||
@ -35,9 +35,9 @@ export function AddPSCoreResultsHarness(result: PSCoreCommandResult) {
|
||||
<div class="result-header">
|
||||
Device: ${deviceName} |
|
||||
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes": "No"} |
|
||||
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target='#${result.CommandContextID + result.DeviceID}-result'>View</button>
|
||||
</div>
|
||||
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
|
||||
<div id='${result.CommandContextID + result.DeviceID}-result' class="command-result-output ${collapseClass}">
|
||||
<div>Host Output:<br>${result.HostOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
<div>Debug Output:<br>${result.DebugOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
<div>Verbose Output:<br>${result.VerboseOutput.join("<br>").replace(/ /g, " ")}</div>
|
||||
@ -64,7 +64,7 @@ export function AddCommandResultsHarness(result: GenericCommandResult) {
|
||||
<div class="result-header">
|
||||
Device: ${deviceName} |
|
||||
Had Errors: ${result.ErrorOutput.length > 1 ? "Yes" : "No"} |
|
||||
<button class="btn btn-xs btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="collapse" data-target="#${result.CommandContextID + result.DeviceID}-result">View</button>
|
||||
</div>
|
||||
<div id="${result.CommandContextID + result.DeviceID}-result" class="command-result-output ${collapseClass}">
|
||||
<div>Standard Output:<br>${result.StandardOutput.replace(/\n/g, "<br>").replace(/ /g, " ")}</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user