示例#1
0
 public static void CopyDatabase(Context context, string dbName)
 {
     using (Stream istream = context.Assets.Open(dbName))
     {
         using (SQLiteDatabase db = context.OpenOrCreateDatabase(dbName, FileCreationMode.Private, null))
         {
         }
         using (Stream ostream = new FileStream(context.GetDatabasePath(dbName).AbsolutePath, FileMode.Open))
         {
             byte[] buffer = new byte[1024];
             int length = 0;
             while ((length = istream.Read(buffer, 0, buffer.Length)) > 0)
             {
                 ostream.Write(buffer, 0, length);
             }
         }
     }
 }
 public BowlingDatabase(Context context)
     : base(context, DATABASE_NAME, null, DATABASE_VERSION)
 {
     mContext = context;
     string dbPath = context.GetDatabasePath(DATABASE_NAME).AbsolutePath;
 }