mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Rebranding.
This commit is contained in:
parent
dc28750c8f
commit
38fac43d37
@ -279,7 +279,7 @@ namespace Remotely_Agent.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = Win32Interop.OpenInteractiveProcess(filePath + $" -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host}", "default", true, out _);
|
||||
var result = Win32Interop.OpenInteractiveProcess(filePath + $" -mode Unattended -requester {requesterID} -serviceid {serviceID} -host {Utilities.GetConnectionInfo().Host} -desktop default", "default", true, out _);
|
||||
if (!result)
|
||||
{
|
||||
await hubConnection.InvokeAsync("DisplayConsoleMessage", "Remote control failed to start on target device.", requesterID);
|
||||
|
||||
@ -53,7 +53,6 @@ namespace Remotely_ScreenCast.Capture
|
||||
}
|
||||
public bool NeedsInit { get; set; } = true;
|
||||
|
||||
private string desktopName;
|
||||
private Factory1 factory;
|
||||
private Adapter1 adapter;
|
||||
private SharpDX.Direct3D11.Device device;
|
||||
@ -73,7 +72,6 @@ namespace Remotely_ScreenCast.Capture
|
||||
{
|
||||
lock (ScreenLock)
|
||||
{
|
||||
desktopName = Win32Interop.GetCurrentDesktop();
|
||||
factory = new Factory1();
|
||||
|
||||
//Get first adapter
|
||||
@ -130,18 +128,6 @@ namespace Remotely_ScreenCast.Capture
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentDesktop = Win32Interop.GetCurrentDesktop();
|
||||
if (currentDesktop != desktopName)
|
||||
{
|
||||
desktopName = currentDesktop;
|
||||
var inputDesktop = Win32Interop.OpenInputDesktop();
|
||||
var success = User32.SetThreadDesktop(inputDesktop);
|
||||
User32.CloseDesktop(inputDesktop);
|
||||
Logger.Write($"Set thread desktop to {currentDesktop}: {success}");
|
||||
NeedsInit = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (NeedsInit)
|
||||
{
|
||||
duplicatedOutput?.Dispose();
|
||||
|
||||
@ -53,9 +53,11 @@ namespace Remotely_ScreenCast
|
||||
|
||||
Connection.StartAsync().Wait();
|
||||
|
||||
if (Win32Interop.GetCurrentDesktop().ToLower() != CurrentDesktopName.ToLower())
|
||||
var desktopName = Win32Interop.GetCurrentDesktop();
|
||||
if (desktopName.ToLower() != CurrentDesktopName.ToLower())
|
||||
{
|
||||
RelaunchInCurrentDesktop().Wait();
|
||||
RelaunchInCurrentDesktop(desktopName).Wait();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
OutgoingMessages = new OutgoingMessages(Connection);
|
||||
@ -68,6 +70,10 @@ namespace Remotely_ScreenCast
|
||||
{
|
||||
var viewersString = argDict["viewers"];
|
||||
var viewerIDs = viewersString.Split(",".ToCharArray());
|
||||
foreach (var id in viewerIDs)
|
||||
{
|
||||
ScreenCaster.BeginScreenCasting(Connection, id, null, OutgoingMessages);
|
||||
}
|
||||
// TODO.
|
||||
}
|
||||
else
|
||||
@ -79,13 +85,20 @@ namespace Remotely_ScreenCast
|
||||
|
||||
while (true)
|
||||
{
|
||||
var desktopName = Win32Interop.GetCurrentDesktop();
|
||||
if (desktopName.ToLower() != CurrentDesktopName.ToLower())
|
||||
if (Mode == AppMode.Unattended)
|
||||
{
|
||||
SwitchDesktops(desktopName).Wait();
|
||||
Environment.Exit(0);
|
||||
desktopName = Win32Interop.GetCurrentDesktop();
|
||||
if (desktopName.ToLower() != CurrentDesktopName.ToLower())
|
||||
{
|
||||
SwitchDesktops(desktopName).Wait();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
System.Threading.Thread.Sleep(100);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Read();
|
||||
}
|
||||
System.Threading.Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -94,9 +107,9 @@ namespace Remotely_ScreenCast
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task RelaunchInCurrentDesktop()
|
||||
private static async Task RelaunchInCurrentDesktop(string desktopName)
|
||||
{
|
||||
var result = Win32Interop.OpenInteractiveProcess(Environment.CommandLine, Win32Interop.GetCurrentDesktop(), true, out _);
|
||||
var result = Win32Interop.OpenInteractiveProcess(Assembly.GetExecutingAssembly().Location + $" -mode {Mode.ToString()} -requester {RequesterID} -serviceid {ServiceID} -host {Host} -desktop {desktopName}", desktopName, true, out _);
|
||||
if (!result)
|
||||
{
|
||||
// TODO.
|
||||
|
||||
@ -33,7 +33,7 @@ namespace Remotely_Server.Services
|
||||
}
|
||||
}
|
||||
|
||||
private string ClientType
|
||||
private string Mode
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -146,7 +146,7 @@ namespace Remotely_Server.Services
|
||||
$"Requester IP Address: " + Context?.GetHttpContext()?.Connection?.RemoteIpAddress?.ToString()
|
||||
});
|
||||
Context.Items["ClientID"] = clientID;
|
||||
Context.Items["ClientType"] = remoteControlMode;
|
||||
Context.Items["Mode"] = remoteControlMode;
|
||||
Context.Items["RequesterName"] = requesterName;
|
||||
await RCDeviceHub.Clients.Client(clientID).SendAsync("GetScreenCast", Context.ConnectionId, requesterName);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user