Map list handling


Now that I've written a method for getting data synchronously, I can now write much more code, such as map list handling.
Since the maplist can change outside of a single RconClient, the data cannot be cached, requiring synchronous reading.
A MapCollection class will be created (to be RconClient.Maps in RconClient) that will handle all interaction with the maplist.
Here are some details that come to mind:
All set operations will automatically save.
Indexers will be read-only.
There will be methods for inserting, appending, and removing maps.
There will be a method for clearing the maplist.
The MapCollection will implement IList<Map>, and therefore be enumerable.
There will be methods for going to the next round, restarting a round, and ending a round.
The Map class will contain the map name and mode (both regular and friendly names), along with the number of rounds per map. The map names and modes will be in an enum.


Timiz0r wrote Nov 13, 2011 at 7:14 PM

Actually, I decided to simply use human-readable names in the enums because, since they're enums, using MP_* doesn't have any benefit.
A method to get a friendlier name, such as converting MapName.GrandBazaar to "Grand Bazaar" will still be provided.

RickardP wrote Nov 14, 2011 at 6:21 AM

Nice, this going to be really good!

Going to implement it to my mobile web admin tool ;-) when you are done ;-)

Timiz0r wrote Nov 14, 2011 at 8:01 PM

I have finished writing the MapCollection class. It can be accessed through RconClient.Maps.

The only part I've tested is enumeration through the MapCollection, but everything else will hopefully work. At the very least, there hopefully won't be any weird exceptions being thrown.

RickardP wrote Nov 14, 2011 at 8:46 PM

Nice work, have taked one fast look, but how do i see what current level runnings of the map collection?

RickardP wrote Nov 14, 2011 at 9:09 PM

Here is first GUI test to list maps on the server: http://bfadmin.mobi/Media/maplist_alpha1.png ;-)

Timiz0r wrote Nov 15, 2011 at 12:29 AM

Nice work :D

I forgot to add a CurrentMap property, but I also forgot to increment CurrentRound by 1 (as seen in your screenshot). While I'm at it, 0 would look better for CurrentRound for non-active maps.

Timiz0r wrote Nov 15, 2011 at 1:14 AM

I've update to add CurrentMap, along with other changes.

RickardP wrote Nov 15, 2011 at 6:38 AM

nice, thanks for the updates, going to test it later.

RickardP wrote Nov 15, 2011 at 1:55 PM

I do this:

MapCollection mapCollextion = Program.rconClient.Maps;
Map currentMap = mapCollextion.CurrentMap;

And currentMap is null... looks like something didnt work, but when i loop throw the map collection i seing one map current round = 1 so something you chekcing with current map is not working.

Timiz0r wrote Nov 15, 2011 at 2:34 PM

What happened was, in that set of changes, I added a method to check for nullity and if the packet starts with "OK". I fixed that method, so everything that used that method (pretty much the whole MapCollection) now works.

RickardP wrote Nov 15, 2011 at 3:22 PM

Thanks, going to test, comming back later.

RickardP wrote Nov 16, 2011 at 6:21 AM

Current map works good, see this picture, i have created a server status page as startpage: http://imgur.com/QuD13

wrote Nov 18, 2011 at 11:03 PM

RickardP wrote Dec 1, 2011 at 8:08 AM

I trying to do a funktion that connect to server, get the server info (using code from changeset 7308) and then i try to get the MapCollection and CurrentMap but CurrentMap is null, something not working whell.

I have tried the same changeset 7308 in my old windows application and there its works so not the library (i think) so can you see what i doing wrong? http://pastebin.com/yGZAt5Ef

RickardP wrote Dec 1, 2011 at 8:49 AM

Sorry my last comment, i forget to login, server info works without login but not MapCollection...

Timiz0r wrote Dec 1, 2011 at 3:39 PM

Although I forgot to mention this in the documentation, MapCollection won't work without being logged in because mapList.* commands only work when logged in. Actually, what I could do is have anything that requires being logged on throw an exception, which would serve as a reminder to ensure the client is logged on.

Also, for Server, only some of the properties work when not logged on. I haven't finished the documentation for them, but you can see which ones work because serverInfo properties are in their own code region.

Timiz0r wrote Dec 1, 2011 at 4:04 PM

Also, the reason why I'm now adding the exception is because I want the library to work for future users such that they don't even need to read the RCON documentation.

RickardP wrote Dec 1, 2011 at 5:24 PM

Yea, good idea about exception if you not logged in, i really like your whay to implamented the server properties!

Timiz0r wrote Dec 9, 2011 at 9:09 PM

Since it's recommended that properties' get accessors not throw exceptions, I won't be adding the NotLoggedInException to them.

wrote Feb 13, 2013 at 6:23 PM

wrote May 15, 2013 at 5:09 AM

wrote May 15, 2013 at 5:09 AM

wrote Jun 12, 2013 at 2:02 AM