User:JayJeckel

Some random stuff I'm working on. Not sure what will come of it.

= banlist.txt File Format =

The banlist.txt is a normal text file and uses a flat-file format.

Each entry is composed of one or two lines: the banned IP and, optionally, the name of the banned user.

When a player is banned from the game, the player's name is prefixed with two slash (/) characters and is then added as a line to the file. Then, the player's IP is added as another new line. However, when checking if a player is banned from a server, each line of the banlist file is checked against the player's connecting IP and no additional checks are made against the name lines.

= servers.dat File Format =

The servers.dat file uses a simple binary format and is composed of two sections: the header and the server data.

Type Formats
The types used in the servers.dat file are below, all are stored little-endian.

Header
The header stores a single value, the integer representation of the Terraria version that wrote the servers.dat file.

Server List Data
The server list is composed of ten (10) entries, each entry being comprised of three (3) values.

C#
First, define a struct to hold the server entries.

Next, define a class to store, load, and save a servers.dat file.