Skip to content

Commit 7865417

Browse files
committed
tweaked errorlevel return values
1 parent 5c7e2b0 commit 7865417

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Program.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ static private string ReadIPCClassNameMMF()
121121
static void Main(string[] args)
122122
{
123123
string strResult = String.Empty;
124+
string strResultToLower;
125+
124126
bool bWaitResultData = false;
125127
bool bDoSendMsg = true;
126128
IntPtr hWndDS4WindowsForm = IntPtr.Zero;
@@ -150,7 +152,7 @@ static void Main(string[] args)
150152
Console.WriteLine(" ProfileName=Name of the existing DS4Windows profile");
151153
Console.WriteLine(" Example: -command LoadProfile.1.SnakeGame");
152154
Console.WriteLine("");
153-
Console.WriteLine("DS4WindowsCmd.exe -command Query.device#.PropertyName (query the value of a property)");
155+
Console.WriteLine("DS4WindowsCmd.exe -command Query.device#.PropertyName (query the value of a property. Some of the options return both text output and numerical value as errorlevel environment variable)");
154156
Console.WriteLine(" device#=1..8 as controller slot index");
155157
Console.WriteLine(" PropertyName=ProfileName | OutContType | ActiveOutDevType | UseDInputOnly | DeviceVIDPID | DevicePath | MacAddress | DisplayName | ConnType | ExclusiveStatus | Battery | Charging | AppRunning | OutputSlotType | OutputSlotPermanentType | OutputSlotAttachedStatus | OutputSlotInputBound");
156158
Console.WriteLine(" Example: -command Query.1.Battery");
@@ -247,6 +249,8 @@ static void Main(string[] args)
247249
Console.WriteLine(strResult);
248250
}
249251

252+
strResultToLower = strResult.ToLower();
253+
250254
if (bDoSendMsg == false)
251255
Environment.ExitCode = 1000; // Something went wrong with Query.xxx cmd. The cmd was not sent, so return error status 1000
252256
else if (args[1].ToLower().StartsWith("query.") && args[1].ToLower().EndsWith(".battery"))
@@ -256,7 +260,7 @@ static void Main(string[] args)
256260
iBatteryLevel = 1000;
257261
Environment.ExitCode = iBatteryLevel;
258262
}
259-
else if (strResult.ToLower() == "true")
263+
else if (strResultToLower == "true" || strResultToLower == "attached" || strResultToLower == "bound" || strResultToLower == "permanent")
260264
Environment.ExitCode = 1;
261265
else
262266
Environment.ExitCode = 0;

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.2")]
36-
[assembly: AssemblyFileVersion("1.0.0.2")]
35+
[assembly: AssemblyVersion("1.0.0.3")]
36+
[assembly: AssemblyFileVersion("1.0.0.3")]

0 commit comments

Comments
 (0)