User:JayJeckel/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.

Second, define a static method to load a servers.dat file.

Third, define a static method to save a servers.dat file.

Lastly, examples of how to use the methods.