Important upcoming change

Apr 3, 2012 at 12:13 AM
Edited Apr 3, 2012 at 12:15 AM

Since I assume most people don't use the issue tracker, I'll post this here.

I have decided to implement a breaking change to how certain methods work. For methods that return void or a boolean representing success, such as BanCollection.Add or Player.Kill, a new class will be returned called RconResult.

RconResult will be a class that contains properties for Success and Error. Success will be true if the request doesn't timeout and the first word is OK, and Error will return the first word if Success is false. It will also have implicit conversion operators for bool and string representing those properties.

Here's an example of the upcoming change:


RconClient client;
RconResult result = client.Bans.Add(...);

if (result) Console.WriteLine("Ban successful.");
else Console.WriteLine("Ban Error: {0}", result);

Also, I'll eventually put the errors in an enumeration in order to make it programmatically easier to use.

Apr 19, 2012 at 11:56 PM

I have now implemented this change, except for the implicit conversion to a string. I didn't add that because it could be somewhat confusing using it like that. If you've been using the bool returned by these changed methods, there shouldn't be a noticeable difference due to the implicit conversion to a bool.

Assuming no one finds a bug, I'll put out another release in a few days.