I've just started to implement encryption for the save files on my project and its worked quite smoothly so far, but now I am trying to write a tool to decrypt the save files and resave them as text for debugging and I have run into a problem. The code looks like this:
Code: Select all
ES3Settings fileSettings = new ES3Settings(path, ES3.Location.Cache);
ES3Settings settings = new ES3Settings(path, ES3.EncryptionType.AES, info.key, fileSettings);
ES3.CacheFile(path);
string contents = ES3.LoadRawString(settings);
if (!string.IsNullOrEmpty(contents))
{
contents = ES3.DecryptString(contents, info.key);
ES3Settings textSettings = new ES3Settings(newPath, ES3.EncryptionType.None);
ES3.SaveRaw(contents, newPath, textSettings);
}
ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
I'm just guessing that this is a reasonable method to do what I want, and I'm guessing that I need to call DecryptString because the result of LoadRawString is not human readable. Can you let me know if I am on the right track here or if I need to do something different?
Thanks for any help!