/// <summary>
/// 读取本地文件信息,SilverLight缓存中
/// </summary>
/// <param name="rFileName">存储文件名</param>
/// <returns>返回文件数据</returns>
public static byte[] ReadSlByteFile(string rFileName)
{
System.IO.IsolatedStorage.IsolatedStorageFile isf = null;
System.IO.Stream stream = null;
byte[] buffer = null;
try
{
isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();
if (!isf.FileExists(rFileName))
{
return(null);
}
stream = new System.IO.IsolatedStorage.IsolatedStorageFileStream(rFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read, isf);
buffer = new byte[stream.Length];
stream.Read(buffer, 0, (int)stream.Length);
}
finally
{
if (stream != null)
{
stream.Close(); // Close the stream
stream.Dispose();
}
isf.Dispose();
}
return(buffer);
}