1
我真的與Windows Phone 8上的一些存儲功能混淆。我試圖保存在本地電話存儲中由多個應用程序共享的憑據(密碼/用戶)。 從那裏用戶將只能在一個應用程序中更改密碼一次,並且所有應用程序都將更改密碼。 我經歷過的3種可能性保存bytearray(加密的密碼)爲圖片使用中型圖書館WP8
- 保存在外部服務器上
- 節省Medialibrary爲圖片
- 保存有關管理憑據
在這個新的特定應用程序的Isolatedstorage代碼暴露第二種情況我得到一個問題「System.InvalidOperationException.An意外的錯誤發生」
public static void SaveToFile(byte[] Encryptedfile, string FileName)
{
using (var mediaLibrary = new MediaLibrary())
{
using (var stream = new MemoryStream(Encryptedfile))
{
var file = string.Format(FileName, Guid.NewGuid());
stream.Seek(0, SeekOrigin.Begin);
var picture = mediaLibrary.SavePicture(file, stream); //ERROR
}
}
}
功能
byte[] PasswordByte = Encoding.UTF8.GetBytes(password);
byte[] UserByte = Encoding.UTF8.GetBytes(user);
byte[] EncryptedPasswordUser = ProtectedData.Protect(PasswordByte, null);
byte[] EncryptedUser = ProtectedData.Protect(UserByte, null);
IsolatedStorageOperations.SaveToFile(EncryptedPasswordUser, "Password");
IsolatedStorageOperations.SaveToFile(EncryptedUser, "User");
我會很高興,如果你可以給我另一種方式來保存在WP8一個共同的本地存儲文件或電話,如果你能給我一個解決問題與medialibrary 。
謝謝
我已經試過用writableimage但我在Savepicture方法得到同樣的問題?我能以圖片格式保存anykind和bytearray嗎?因爲我提醒你密碼和用戶在字節[]中進行字符串內部轉換... –