1) Asi es como estoy Leyendo El archivo .dat , pero no me lee los datos completos=
Archivo .DAT = https://anonfile.com/Q7NcveB3nc/USERDATA_DAT
Código
Using stream As System.IO.FileStream = File.Open("C:\Users\S4lsalsoft\Documents\GTA San Andreas User Files\SAMP\USERDA.DAT", FileMode.Open, FileAccess.Read) Using reader = New BinaryReader(stream) If stream.Length >= 16 Then Dim samp = New String(reader.ReadChars(4)) If samp = "SAMP" Then If reader.ReadUInt32 = 1UI Then Dim sc = reader.ReadInt32 For i = 0 To sc - 1 Dim ip As String = Encoding.[Default].GetString(reader.ReadBytes(reader.ReadInt32)) Dim port As UShort = (reader.ReadUInt32) ' Dim cn As String = Utils.GuessedStringEncoding(reader.ReadBytes(reader.ReadInt32)) Dim cn As String = Encoding.[Default].GetString(reader.ReadBytes(reader.ReadInt32)) Dim sp As String = Encoding.[Default].GetString(reader.ReadBytes(reader.ReadInt32)) Dim rp As String = Encoding.[Default].GetString(reader.ReadBytes(reader.ReadInt32)) MsgBox(cn & ip & port & sp) Next End If End If End If End Using End Using
Esto Me lee algunos Valores, Pero no me lee todos incluso aveces causo error. asi que necesito ayuda de como leer el archivo.
Mi Segundo Problema es Que no se Como enviar un Query para obtener información. tengo una api que encontré en internet , Funciona. pero el metodo de uso es este :
Esta es la Api : https://github.com/BenBout/SampQueryService
Los Métodos de uso Son :
Código
Private Shared Async Function SimpleQuery() As Task Dim serverIP = IPAddress.Parse("151.80.94.179") Dim port As Integer = 7777 Dim sampQuery = New SampQueryClient() Dim playerList = Await sampQuery.SendQueryAsync(Of PlayerList)(serverIP, port) If playerList.IsCompleted Then Dim filteredPlayerList = playerList.Players.Where(Function(p) p.Level > 5).OrderByDescending(Function(p) p.Level) For Each player In filteredPlayerList Console.WriteLine($"ID: {player.ID} Username: {player.UserName} Ping: {player.ping}") Next End If End Function Private Shared Async Function MultipleQueriesWithSameQueryResultType() As Task Dim ipEndList = New List(Of IPEndPoint)() Dim serverInfoList = Await New SampQueryClient().SendQueryAsync(Of ServerInfo)(ipEndList) For Each server In serverInfoList If server.IsCompleted Then Console.WriteLine($"Server name: {server.HostName}") Next End Function
Como pueden ver son asincronicos y no me deja agregar la informacion obtenida a un ListView , como Podria hacer eso?
Gracias de antemano!