Page 2 of 2

Re: Read text from .dat file?

Posted: Sat Dec 11, 2010 6:06 pm
by DarkyKnife
Agust1337 wrote:
Hello DarkyKnife,
I haven't tried this code, but here:
Code: Select all
 Dim fInfo As New FileInfo("servercache.dat")
        Dim numBytes As Long = fInfo.Length
        Dim fStream As New FileStream("servercache.dat", FileMode.Open, FileAccess.Read)
        Dim br As New BinaryReader(fStream)
        Dim data As Char() = br.ReadChars(CInt(numBytes))
        'Dim data As Byte() = br.ReadBytes(CInt(numBytes))
        Dim test As String = ""
        For i = 0 To 5000
            test += Convert.ToString(data(i))
        Next
        MsgBox(test)
 
        br.Close()
        fStream.Close()
Hi August, the code is not working, i get error while running program in line
Code: Select all
 test += Convert.ToString(data(i)) 

and it says
Code: Select all
 Index was outside the bounds of the array. 

Re: Read text from .dat file?

Posted: Sat Dec 11, 2010 8:46 pm
by Agust1337
Hmm Okay, try opening it in the debug folder not through vb.

Re: Read text from .dat file?

Posted: Sat Dec 11, 2010 8:48 pm
by mandai
This minecraft game may use a specific format for stored text, if thats the case you will have to figure out the file structure.

You could search through the file to match patterns of unicode/ASCII text if that is what you are after.

Re: Read text from .dat file?

Posted: Sun Dec 12, 2010 2:37 pm
by DarkyKnife
Agust1337 wrote:
Hmm Okay, try opening it in the debug folder not through vb.
I get the same message when i open not in VB

Re: Read text from .dat file?

Posted: Sun Dec 12, 2010 7:38 pm
by Codex
You need to change the 5000 to the length of the file(characters).

Re: Read text from .dat file?

Posted: Thu Jan 20, 2011 12:29 am
by GoodGuy17
mandai wrote:
This minecraft game may use a specific format for stored text, if thats the case you will have to figure out the file structure.

You could search through the file to match patterns of unicode/ASCII text if that is what you are after.
Mandai, check these links:
http://www.minecraft.net/docs/levelformat.jsp
http://www.minecraft.net/docs/NBT.txt
Hope it helped!