Skip to content

Commit

Permalink
Support RC proxy XMPP presence (#29)
Browse files Browse the repository at this point in the history
* Prompts user to elevate if LCU is running as admin
Doesn't crash to access denied exception
Bumped version to v1.4.1

* fixed path when registry entry is not found, added new registry location

* fix if RiotClientInstalls.json exists, but no Riot Client or corrupted

* use List instead of Array for RC paths

* Target .NET 4.8; support .NET 4.6+

(.NET 4.6 is included since first Win10 release)

* use WebSocket to monitor chat status changes

more reliable reflection of masked status in client
does not break after leaving/joining lobbies or exiting games
changed IsValidLCUPath to check for system.yaml instead of Logs folder

* add reference to netstandard, just in case...

* use TLS 1.2 to handle random WebExceptions

* fix _ws assignment and check for null, remove redundant code

* Update LCU status only on gameflow phase change

* fix status on startup, as gameflow isn't changing now

* fix not being able to change status when disabled

* support RC proxy XMPP presence
  • Loading branch information
aPinat authored and molenzwiebel committed Dec 7, 2019
1 parent 41d5b3e commit aa2d42b
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions Deceive/MainController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,35 @@ private void PossiblyRewriteAndResendPresence(string content, string targetStatu

if (targetStatus != "chat")
{
var status = new XmlDocument();
status.LoadXml(presence["status"].InnerText);
status["body"]["statusMsg"].InnerText = "";
status["body"]["gameStatus"].InnerText = "outOfGame";
if (status["body"].InnerXml.Contains("pty")) status["body"].RemoveChild(status["body"]["pty"]);
//Without RC chat proxy
if (presence["status"] != null && presence["status"].InnerText != "")
{
var statusXml = new XmlDocument();
statusXml.LoadXml(presence["status"].InnerText);
statusXml["body"]["statusMsg"].InnerText = "";
statusXml["body"]["gameStatus"].InnerText = "outOfGame";
if (statusXml["body"]["pty"] != null) statusXml["body"].RemoveChild(statusXml["body"]["pty"]);
presence["status"].InnerText = statusXml.OuterXml;
}

presence["status"].InnerText = status.OuterXml;
//With RC chat proxy
if (presence["games"] != null)
{
//Just keeping this here in case we need it later...
/*
presence["games"]["league_of_legends"]["st"].InnerText = targetStatus;
if (presence["games"]["league_of_legends"]["p"] != null)
{
var p = (JsonObject)SimpleJson.DeserializeObject(presence["games"]["league_of_legends"]["p"].InnerText);
if (p.ContainsKey("gameStatus")) p["gameStatus"] = "outOfGame";
presence["games"]["league_of_legends"]["p"].InnerText = SimpleJson.SerializeObject(p);
}
*/

//Don't need to bother changing game specific presence, just remove it altogether.
if (presence["games"]["league_of_legends"] != null) presence["games"].RemoveChild(presence["games"]["league_of_legends"]);
}
}

content = presence.OuterXml;
Expand Down

0 comments on commit aa2d42b

Please sign in to comment.