fCraft.PlayerDB.IdentifyFormatVersion C# (CSharp) Method

IdentifyFormatVersion() static private method

static private IdentifyFormatVersion ( string header ) : int
header string
return int
        static int IdentifyFormatVersion( string header ) {
            string[] headerParts = header.Split( ' ' );
            if( headerParts.Length < 2 ) throw new FormatException( "Invalid PlayerDB file format." );
            int maxIDField;
            if( Int32.TryParse( headerParts[0], out maxIDField ) ) {
                if( maxIDField >= 255 ) {// IDs start at 256
                    maxID = maxIDField;
                }
            }
            int version;
            if( Int32.TryParse( headerParts[1], out version ) ) {
                return version;
            } else {
                return 0;
            }
        }