Skip to content

Commit

Permalink
Better 2017 IPC (ASF.json) support
Browse files Browse the repository at this point in the history
  • Loading branch information
Luckz committed May 28, 2019
1 parent d620db9 commit 38ed4e7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ASFui/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ public static string GetEndpointAddress() {

var hostname = "127.0.0.1";
var port = "1242";
//ancient legacy config:
if (null != json["IPCHostname"])
// ancient legacy config:
if (null != json["IPCHostname"]) // don't think this was ever an ASF feature
hostname = json["IPCHostname"].ToString();
if (null != json["IPCPort"])
if (null != json["IPCHost"]) // 2017 format
hostname = json["IPCHost"].ToString();
if (null != json["IPCPort"]) // 2017 format
port = json["IPCPort"].ToString();
if (null == json["IPCPassword"] || string.IsNullOrEmpty(json["IPCPassword"].ToString()))
return "http://" + hostname + ":" + port + "/Api/Command/";
Expand All @@ -73,12 +75,12 @@ public static string GetEndpointAddress() {
public static bool CheckIfAsfIsRunning() {
foreach (Process PPath in Process.GetProcessesByName("ArchiSteamFarm")) {
string fullpath = PPath.MainModule.FileName;
if (fullpath == Settings.Default.ASFBinary) //only match exact ASF
if (fullpath == Settings.Default.ASFBinary) // only match exact ASF
return true;
}
return false;

//old code matching any ASFs:
// old code matching any ASFs:
/*return Process.GetProcessesByName("ASF").Length > 0 ||
Process.GetProcessesByName("ArchiSteamFarm").Length > 0 ||
Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Settings.Default.ASFBinary)).Length > 0;*/
Expand Down

0 comments on commit 38ed4e7

Please sign in to comment.