Read file
Read file
Read file
Read file
Read file
Read file Read file Read file Read file Read file Read file Read file Read file
Read file Read file
Read file
Go Back  Xtreme Visual Basic Talk > > > Read file


Reply
 
Thread Tools Display Modes
  #1  
Old 01-22-2011, 06:56 PM
sanaga sanaga is offline
Newcomer
 
Join Date: Oct 2010
Posts: 3
Default Read file


Hi everyone, this is my first post here. I making a program to edit a futbol videogame, but I need to read the file that contains all the data, and convert to characters. But i don´t know how.

Dim path As String = "E:\PES\Pes6EditCenter\Option\KONAMI-WIN32PES6OPT"
Dim ofile As Byte()
ofile = File.ReadAllBytes(path)

For example i know the team names start at byte 751472 and are spacing in 88 bytes between them. And if you change one letter in game changes more than one byte in the option file...

this is the first team of the list and bytes change for each character.

A B7768 - B7770
r B7769 - B7771
s B776A - B7772
e B776B - B7773
n B7768 - B7774
a B7769 - B7775
l B776A - B7776
"space" B776B - B7777
F B7768 - B7778
C B7769 - B7779

in all my trys to convert it i get strange characters.

Need some help because i can´t continue without this.

This is the file i have to read...
http://www.sendspace.com/file/8o6o9v

thanks in advanced and sorry for my english
Reply With Quote
  #2  
Old 01-22-2011, 10:09 PM
AtmaWeapon's Avatar
AtmaWeaponRead file AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

The bytes are probably Unicode; if they're taking up 2 bytes per character it's likely UTF-16. I could write a long explanation, but for English characters all you have to know is UTF-16 will always be a 0 byte followed by the ASCII value of the character. For example, "A" is 65 in ASCII, so in UTF-15 it is 0 65; in a hex editor it would appear as 00 41.

That's a format called big endian; sometimes files store data in little endian. In that case the bytes are swapped and A would be 65 0 or 41 00. You should figure out which way your file uses and mimic it; getting them backwards will not have the desired effect.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 01-23-2011, 05:38 AM
sanaga sanaga is offline
Newcomer
 
Join Date: Oct 2010
Posts: 3
Default

thanks for answer

i try this:

Dim item As String
item = New UnicodeEncoding().GetString(ofile, 751472, 10).Split(New Char(1 - 1) {})(0)
ListBox1.Items.Add(item)
TextBox1.Text = item

and i get this "쥱씛ࢢ쌠"

i don´t find 00 41, this is what appears in Hexeditor, the last bytes change each four characters (1-4, 5-8, etc)

A r s e n a l F C
80 EA 71 C9 1B C5 A2 08 20 C3

A s t o n V i l l a
14 83 3E 2B 0C BC A0 29 81 94 03

byte B7768 to B776B

C7 B2 86 D2
Reply With Quote
  #4  
Old 01-23-2011, 11:28 AM
AtmaWeapon's Avatar
AtmaWeaponRead file AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

How do you know that those bytes correspond to the text? If they do, I don't believe they correspond to any particular encoding. note that both strings start with "A", but the first bytes are different. "a" and "s" appear in both strings, yet there's no common bytes. Perhaps the file is compressed or you have the wrong location. It's also possible that the letters are stored in a special format and you need more information about that.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #5  
Old 02-03-2011, 12:10 PM
sanaga sanaga is offline
Newcomer
 
Join Date: Oct 2010
Posts: 3
Default

I know because there is other program to edit this file, and i change data and compare with the original with hexeditor.
i think you are right about compress, because this program have the zlib.dll in his directory. Now i "only" have to know how to decompress with zlib.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Read file
Read file
Read file Read file
Read file
Read file
Read file Read file Read file Read file Read file Read file Read file
Read file
Read file
 
Read file
Read file
 
-->