void Copyassets ()
{
string[] files;
Try
{
Files = This.getresources (). Getassets (). List ("");
}
catch (IOException E1)
{
Return
}
if (!mworkingpath.exists ())
{
if (!mworkingpath.mkdirs ())
{
New Alertdialog.builder (This)
. Settitle (R.string.error)
. Setmessage (R.string.failed_dir_create)
. Setpositivebutton (Android. R.string.ok, New Onclicklistener () {
@Override
public void OnClick (Dialoginterface dialog, int which)
{
Dialog.dismiss ();
}
})
. Create ()
. Show ();
}
}
for (int i = 0; i < files.length; i++)
{
Try
{
String fileName = files[i];
if (Filename.compareto ("images") = = 0 | |
Filename.compareto ("sounds") = = 0 | |
Filename.compareto ("webkit") = = 0)
{
Continue
}
File outfile = new file (Mworkingpath, fileName);
if (outfile.exists ()) continue;
InputStream in = Getassets (). open (FileName);
OutputStream out = new FileOutputStream (outfile);
Transfer bytes from
byte[] buf = new byte[1024];
int Len;
while (len = In.read (buf)) > 0)
{
Out.write (buf, 0, Len);
}
In.close ();
Out.close ();
}
catch (FileNotFoundException e)
{
E.printstacktrace ();
}
catch (IOException E)
{
E.printstacktrace ();
}
}