Encrypting GameMap

02/24/2012 05:55 U2_Caparzo#1
Hi all!

I'm trying to make a gamemap cryptor/decryptor... i decrypted it fine, but i have problem encrypting it.

i decrypted it like

FileStream fs = blabla bla(file, FileMode.Open);
BinaryReader br = .....(fs);

so i read it in this way.

uint MapCount = br.ReadUint32();
uint ID = br.ReadUint32();
int Length = br.ReadInt32();
string name = ..........//i get it witl help of intellisense :$
int size = br.ReadInt32();

but when i try to encrypt it i have problems.

i have converted the data that i read from the GameMap.txt generated when decrypting so i make it look like

bw = new BinaryWriter(file, FileMode.Create)

uint mapcount = uint.Parse(data loaded from gamemap.txt)
uint ID = ...... same thing
int Length = .... samething with int
string Path = ......
int Size = .......

then i write with BinaryWriter all to the File GameMap2.dat

yes, i write mapcount just one time.
i write it in this order.

count
loop()//i tried differents ones lOl
{
bw.Write(ID)
bw.Write(Length)
bw.Write(Path)
bw.Write(Size)
}

but the new gamemap.dat's size is like 200 bytes major to the original one

6.22 kb original
6.42 kb new one

and i cant decrypt it, the file NEVER finish of being decrypted!
also never finish of loading(in the source side)...

so i dk what can i do now...

srry but i'm not in home so i can't provide u the exact codes i tried...
i made it decrypt to the file really simple for try encrypt again faster, but that wasn't the error.

i hope someone give me some guidance with this...

thanks

srry for my bad english :(
02/24/2012 08:47 Spirited#2
[Only registered and activated users can see links. Click Here To Register...]

Does that solve your problem?
02/24/2012 09:03 U2_Caparzo#3
Quote:
Originally Posted by Fаng View Post
[Only registered and activated users can see links. Click Here To Register...]

Does that solve your problem?
yeah but not 100% :s
do u can give me any advice about what i'm doing wrong?
02/24/2012 09:53 Kiyono#4
Check mine instead of Fang's as I have the source code included so you can simply compare your code to mine.
02/24/2012 10:22 Spirited#5
Instead of writing the path like "bw.Write(Path)", write each character individually.