436
社区成员
发帖
与我相关
我的任务
分享
//参数
//context
///test.zip
///storage/emulated/0/
public static void CopyToSD(Context ctx, string fileName,string outPath)
{
outPath = outPath + "/" + fileName;
Java.IO.File ttf = new Java.IO.File(outPath);//ROOT_FONT_SRC
if (!ttf.ParentFile.Exists())
{
ttf.ParentFile.Mkdirs();
}
try
{
//ttf.CreateNewFile();
using (System.IO.Stream fsRead = ctx.Assets.Open(fileName))
{
byte[] buffer = new byte[1024];
int length;
while ((length = fsRead.Read(buffer, 0, buffer.Length)) > 0)
{
报错语句: System.IO.FileStream dbOut = new System.IO.FileStream(outPath, System.IO.FileMode.Append);//ROOT_FONT_SRC
dbOut.Write(buffer, 0, buffer.Length);
}
UnZip(outPath, "/data/user/0/cn.x189.sh.caimomo/files/", null);
}
}
catch (Exception e1)
{
//e.printStackTrace();
}
}