Created
April 1, 2014 14:19
-
-
Save maskaravivek/9915068 to your computer and use it in GitHub Desktop.
This method simply moves the referenced database from the windows phone's project folder to the application's isolated storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void MoveReferenceDatabase() | |
{ | |
// Obtain the virtual store for the application. | |
IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication(); | |
// Create a stream for the file in the installation folder. | |
using (Stream input = Application.GetResourceStream(new Uri("DutchMe.sdf", UriKind.Relative)).Stream) | |
{ | |
// Create a stream for the new file in the local folder. | |
using (IsolatedStorageFileStream output = iso.CreateFile("DutchMe.sdf")) | |
{ | |
// Initialize the buffer. | |
byte[] readBuffer = new byte[4096]; | |
int bytesRead = -1; | |
// Copy the file from the installation folder to the local folder. | |
while ((bytesRead = input.Read(readBuffer, 0, readBuffer.Length)) > 0) | |
{ | |
output.Write(readBuffer, 0, bytesRead); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment