protected override byte[] LoadData()
{
// get storage for the app
var storageFile = IsolatedStorageFile.GetUserStoreForApplication();
// if file exists, open it
if (storageFile.FileExists(StorageFile))
{
using (var stream = storageFile.OpenFile(StorageFile,
FileMode.Open,
FileAccess.ReadWrite))
{
// allocate and read the protected data
byte[] protectedBytes = new byte[stream.Length];
stream.Read(protectedBytes, 0, (int)stream.Length);
// obtain clear data by decrypting
return ProtectedData.Unprotect(protectedBytes, StoragePasswordArray);
}
}
return null;
}