我要在IsolatedStorage下存储很多图片文件,如何实现?
如果有的话请给个例子。
如果有的话请给个例子。
解决方案 »
- “System.Data.DataRow”不包含“Columns”的定义,并且找不到可接受类型为“System.Data.DataRow”
- msscritp.ocx 在win7 64位机器上调用报错
- 有C#高手没有
- C#正则问题,正则网页代码
- datatable 已获得的数据之后,有没有办法快速倒转过来?
- 新手,求教dataGridView如何显示数据库的一个表的数据???
- 50分求源码.刚熬夜了,醒来就给分.
- 十万火急,这个这么搞呢
- 请教:WebClient.UploadFile 的使用方法
- 如何得到局域网内全总的计算机名.100分,100分,100分,100分,100分,急.....
- 如何 控制listbox里面的数据 现实问题
- 组件类的用法
{
IsolatedStorageFile isfile = IsolatedStorageFile.GetUserStoreForDomain(); if(isfile.GetDirectoryNames("Images").Length == 0)
{
isfile.CreateDirectory("Images");
}
string savePath = @"Images\" + Path.GetFileName(imgPath);
if (isfile.GetFileNames(savePath).Length == 0)
{
IsolatedStorageFileStream imgFileStream = new IsolatedStorageFileStream(savePath, FileMode.CreateNew, isfile);
FileStream fs = new FileStream(imgPath,FileMode.Open);
byte[] readbuffer = new byte[8192];
while(true)
{
int readSize = fs.Read(readbuffer,0,8192);
if(readSize > 0)
{
imgFileStream.Write(readbuffer,0,readSize);
}
else
{
break;
}
} readbuffer = null;
fs.Close();
imgFileStream.Flush();
imgFileStream.Close();
} }
用在抓图程序里
GetUserStoreForApplication 获取与调用代码的应用程序标识对应的用户范围的独立存储。
GetUserStoreForAssembly 获取与调用代码的程序集标识对应的用户范围的独立存储。
GetUserStoreForDomain 获取与应用程序域标识和程序集标识对应的用户范围的独立存储。
只有这3种获取方式,没有你说的那个API你想覆盖去掉判断就行: if (isfile.GetFileNames(savePath).Length == 0)
没用过!!