This repository has been archived by the owner on Jan 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to set the screen orientation and allow for the set…
…ting of the primary screen. All thats left is to add the ability to rearrange the screens.
- Loading branch information
Andrew Sampson
committed
Dec 12, 2016
1 parent
a8e32cb
commit 44cfd17
Showing
6 changed files
with
230 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
RemoteTaskServer/Api/Network/PacketHandlers/DisplayPacketHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#region | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Management; | ||
using UlteriusServer.Api.Network.Messages; | ||
using UlteriusServer.Api.Network.Models; | ||
using UlteriusServer.Api.Services.LocalSystem; | ||
using UlteriusServer.Api.Win32; | ||
using UlteriusServer.WebSocketAPI.Authentication; | ||
using vtortola.WebSockets; | ||
|
||
#endregion | ||
|
||
namespace UlteriusServer.Api.Network.PacketHandlers | ||
{ | ||
public class DisplayPacketHandler : PacketHandler | ||
{ | ||
private MessageBuilder _builder; | ||
private AuthClient _authClient; | ||
private Packet _packet; | ||
private WebSocket _client; | ||
|
||
|
||
|
||
public override void HandlePacket(Packet packet) | ||
{ | ||
_client = packet.Client; | ||
_authClient = packet.AuthClient; | ||
_packet = packet; | ||
_builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey); | ||
switch (_packet.PacketType) | ||
{ | ||
case PacketManager.PacketTypes.ChangeDisplayResolution: | ||
ChangeScreenResolution(); | ||
break; | ||
case PacketManager.PacketTypes.RotateDisplay: | ||
RotateDisplay(); | ||
break; | ||
case PacketManager.PacketTypes.SetPrimaryDisplay: | ||
SetPrimaryDisplay(); | ||
break; | ||
case PacketManager.PacketTypes.GetEventLogs: | ||
// GetEventLogs(); | ||
break; | ||
} | ||
} | ||
|
||
private void SetPrimaryDisplay() | ||
{ | ||
var device = _packet.Args[0].ToString(); | ||
var message = Display.SetPrimary(device); | ||
var formThread = new | ||
{ | ||
message | ||
}; | ||
_builder.WriteMessage(formThread); | ||
} | ||
|
||
private void RotateDisplay() | ||
{ | ||
var width = int.Parse(_packet.Args[0].ToString()); | ||
var height = int.Parse(_packet.Args[1].ToString()); | ||
var angle = int.Parse(_packet.Args[2].ToString()); | ||
var device = _packet.Args[3].ToString(); | ||
var message = Display.Rotate(angle, width, height, device); | ||
var formThread = new | ||
{ | ||
message | ||
}; | ||
_builder.WriteMessage(formThread); | ||
} | ||
|
||
private void ChangeScreenResolution() | ||
{ | ||
|
||
var width = int.Parse(_packet.Args[0].ToString()); | ||
var height = int.Parse(_packet.Args[1].ToString()); | ||
var bbp = int.Parse(_packet.Args[2].ToString()); | ||
var freq = int.Parse(_packet.Args[3].ToString()); | ||
var device = _packet.Args[4].ToString(); | ||
var message = Display.ChangeResolution(device, width, height, bbp, freq); | ||
var formThread = new | ||
{ | ||
message | ||
}; | ||
_builder.WriteMessage(formThread); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.