I was trying to save these huge bool arrays (by huge I mean a little over 16.7 million values) into text files by using stringbuilder to append a string to either 0 for false or 1 for true while iterating through the array - to later load at runtime - and well a problem im seeing is this makes huge txt files, like 16mb if I save it all as one. I couldn’t even open this txt up in notepad (or other programs) and decided to try breaking it up into 8 separate txt files. No joy, those 2mb files still are too much to open and view in notepad… bummer.
So I’m wondering if it’s possible (for performance and filesize purposes) to instead save directly to a binary file (you know just the ones and zeros instead of a huge string of the chars 1 and 0) while I’m in the editor, then load those binary files at runtime.
I’m assuming that doing that would produce smaller files, and improve load time on device. Note that opening/editing in notepad (or anything) is not necessary, that’s just how I realized those files are bloated.
Ideas? Anybody done this “save to binary file, then load at runtime” thing?
Here is how I was saving plain text files:
StringBuilder sB = new StringBuilder;
for(int i = 0; i < 16777216; i++)
{
if (hugeBoolArray *== false)*
sB.Append (“0”);
else
sB.Append (“1”);
}
File.WriteAllText (filePath + “_file.txt”, sB.ToString ());