Converting X file to txt file, how to?

  • Thread starter Thread starter Onlyme2013
  • Start date Start date
O

Onlyme2013

Guest
Hi

I need to convert X file (DirectX) to txt file in order to change textures paths, and then back to X file, I need to use that file on game engine, I'm using Visual Basic.net and windows 10.

I've tried treating X file as binary, but it does not, I'm not expert about but it seems most like utf-8, in fact the piece of code I've tried to read binary file thrown error, "do not encounter any valid digit", meanly it is not binary one, but I am unable to know the really X file encode.

I've failing installing DirectX sdk on my pc, it allways thrown error 0x0005AA or something like this, I was expecting some library than help me to open or convert to txt, since I was unable to do it, so I'm looking for some code than help me to achieve it.

Dim sourcePath As String = fileName Dim destPath As String = "C:\Users\myname\Desktop\mymodel.x" Dim sourceEncoding As Encoding = Encoding.UTF8 Dim destEncoding As Encoding = Encoding.ASCII 'String Path = "c:\\sample\\sample.xml"; Dim instream As Stream = File.OpenRead(sourcePath) ' crear buffer para abrir stream Dim bufin As BufferedStream = New BufferedStream(instream) Dim myByte As Byte() = New Byte(128) ' leer los primeros 128 bytes del archivo bufin.Read(myByte, 0, 128) Console.WriteLine("Allocated bytes: " + Encoding.ASCII.GetString(myByte)) ListBox1.Items.Add(Encoding.ASCII.GetString(myByte))


There is a line of code giving me a error, but I don't know how to.


Dim myByte As Byte() = New Byte(128)

Any help would be much appreciate. :)

Continue reading...
 
Back
Top