How do I serialize an array of characters to a file? The whole reason I’m doing it is so that you can’t just open up the file and edit the data but what I’m about to tell you shows otherwise. I create an array of characters and set arr[0] to ‘a’, arr[1] to ‘b’, and arr[2] to ‘c’. I then use .NET to serialize the array. I run it, open the file and it reads this:

As stated above I don’t want someone to just open up the file and edit the data but this clearly shows it’s possible.
Code:
arr[0] = 'a';
arr[1] = 'b';
arr[2] = 'c';
FileStream stream = new FileStream(Application.dataPath+"/testing.wld", FileMode.Create);
BinaryFormatter bFormatter = new BinaryFormatter();
bFormatter.Serialize(stream, arr);
stream.Close();
How do I fix this? Thanks.
You are not asking about serialization. You are asking about obfuscating / schiffering / more advanced sollutions.
If you want to use the built-in serialize classes in .NET you will have to implemented your own (XML)Writer/Reader – implement a obfuscating routine of choice in this function and make sure its 1:1.
But it will of course not be “safe”, just delay the penetrator for a while.