Attribute VB_Name = "ChainExtract"
Public Sub ReadServer(ServerID As Integer)
On Error GoTo ErrHandler1
                With ServerList(ServerID)
                    Open "Zone." + CStr(.ScoreID) For Binary As #1
                        Get #1, 1, Pointer: .TotalLoggedPlayers = GetLong(Pointer)
                        Get #1, 5, Pointer: .TotalLoggedSquads = GetLong(Pointer)
                        Get #1, 9, Pointer: .TotalLoggedBans = GetLong(Pointer)
                        Get #1, 13, Pointer: .TotalLoggedBanfrees = GetLong(Pointer)

                        .VPlayerData = Space(P_Length * .TotalLoggedPlayers)
                        .VSquadData = Space(S_Length * .TotalLoggedSquads)
                        .VBanData = Space(B_Length * .TotalLoggedBans)
                        .VBanfreeData = Space(F_Length * .TotalLoggedBanfrees)

                        Get #1, 17, .VPlayerData
                        Get #1, 17 + Len(.VPlayerData), .VSquadData
                        Get #1, 17 + Len(.VPlayerData) + Len(.VSquadData), .VBanData
                        Get #1, 17 + Len(.VPlayerData) + Len(.VSquadData) + Len(.VBanData), .VBanfreeData

                        .VPlayerData = SHR(.VPlayerData)
                        .VSquadData = SHR(.VSquadData)
                        .VBanData = SHR(.VBanData)
                        .VBanfreeData = SHR(.VBanfreeData)
ErrHandler1:        Close
                End With
End Sub

Public Sub WriteServer(ServerID As Integer)
Dim S As String
On Error GoTo ErrHandler2
                With ServerList(ServerID)
                    Open "Zone." + CStr(.ScoreID) For Output As #3: Close
                    Open "Zone." + CStr(.ScoreID) For Binary As #2
                        S = GetString(.TotalLoggedPlayers) + GetString(.TotalLoggedSquads) + GetString(.TotalLoggedBans) + GetString(.TotalLoggedBanfrees)
                        If .TotalLoggedPlayers > 0 Then S = S + SHL(.VPlayerData)
                        If .TotalLoggedSquads > 0 Then S = S + SHL(.VSquadData)
                        If .TotalLoggedBans > 0 Then S = S + SHL(.VBanData)
                        If .TotalLoggedBanfrees > 0 Then S = S + SHL(.VBanfreeData)
                        Put #2, 1, S
ErrHandler2:        Close
                End With
End Sub
