elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  [Ayuda] Manejo de archivo .dat y Enviar Query para Obtener Informacion
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Ayuda] Manejo de archivo .dat y Enviar Query para Obtener Informacion  (Leído 1,901 veces)
**Aincrad**


Desconectado Desconectado

Mensajes: 668



Ver Perfil WWW
[Ayuda] Manejo de archivo .dat y Enviar Query para Obtener Informacion
« en: 21 Noviembre 2019, 17:14 pm »

Hola , Bueno tengo 2 Problemas .


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
  1. Using stream As System.IO.FileStream = File.Open("C:\Users\S4lsalsoft\Documents\GTA San Andreas User Files\SAMP\USERDA.DAT", FileMode.Open, FileAccess.Read)
  2.  
  3.              Using reader = New BinaryReader(stream)
  4.  
  5.                  If stream.Length >= 16 Then
  6.                      Dim samp = New String(reader.ReadChars(4))
  7.  
  8.                      If samp = "SAMP" Then
  9.  
  10.                          If reader.ReadUInt32 = 1UI Then
  11.                              Dim sc = reader.ReadInt32
  12.                              For i = 0 To sc - 1
  13.                                  Dim ip As String = Encoding.[Default].GetString(reader.ReadBytes(reader.ReadInt32))
  14.                                  Dim port As UShort = (reader.ReadUInt32)
  15.                                  ' Dim cn As String = Utils.GuessedStringEncoding(reader.ReadBytes(reader.ReadInt32))
  16.                                  Dim cn As String = Encoding.[Default].GetString(reader.ReadBytes(reader.ReadInt32))
  17.                                  Dim sp As String = Encoding.[Default].GetString(reader.ReadBytes(reader.ReadInt32))
  18.                                  Dim rp As String = Encoding.[Default].GetString(reader.ReadBytes(reader.ReadInt32))
  19.                                   MsgBox(cn & ip & port & sp)
  20.                               Next
  21.                          End If
  22.                      End If
  23.                  End If
  24.              End Using
  25.          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
  1. Private Shared Async Function SimpleQuery() As Task
  2.        Dim serverIP = IPAddress.Parse("151.80.94.179")
  3.        Dim port As Integer = 7777
  4.        Dim sampQuery = New SampQueryClient()
  5.        Dim playerList = Await sampQuery.SendQueryAsync(Of PlayerList)(serverIP, port)
  6.  
  7.        If playerList.IsCompleted Then
  8.            Dim filteredPlayerList = playerList.Players.Where(Function(p) p.Level > 5).OrderByDescending(Function(p) p.Level)
  9.  
  10.            For Each player In filteredPlayerList
  11.                Console.WriteLine($"ID: {player.ID} Username: {player.UserName} Ping: {player.ping}")
  12.            Next
  13.        End If
  14.    End Function
  15.  
  16.    Private Shared Async Function MultipleQueriesWithSameQueryResultType() As Task
  17.        Dim ipEndList = New List(Of IPEndPoint)()
  18.        Dim serverInfoList = Await New SampQueryClient().SendQueryAsync(Of ServerInfo)(ipEndList)
  19.  
  20.        For Each server In serverInfoList
  21.            If server.IsCompleted Then Console.WriteLine($"Server name: {server.HostName}")
  22.        Next
  23.    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!






« Última modificación: 21 Noviembre 2019, 17:21 pm por **Aincrad** » En línea



Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines