IsolatedStorage Helper

Introduction

After some time developing for Windows Phone 7 I noticed that the core of this mobile apps is the process of saving to files, reading from files, managing the phone memory and in case you didn´t know the core of this file/folder management is the Windows Phone Isolated Storage.

In Microsoft words “With isolated storage, data is always isolated by user and by assembly. Credentials such as the origin or the strong name of the assembly determine assembly identity. Data can also be isolated by application domain, using similar credentials”.

For those who work with WP this becames easy as you work with it every day, however for those who are starting to build apps working with the isolated storage can be a hard learning process.

Because I don’t want to see programmers saying that they don’t build for Windows Phone because there aren´t easy solutions to manage files I decided to publish my own Isolated Storage class helper, this is just a bunch of static methods that you make the work for you. You can save files, load files, replace strings inside a file, get the available storage, increase the storage quota, create files and folder etc..

Using the Helper

To use this static helper just reference the DLL that I provide and enjoy. The list of available methods are:

· CreateFile(string fileName)

· DeleteFile(string fileName)

· ReadFromFile(string fileName)

· SaveToFile(string fileName, string textToSave, bool writeLine, FileMode fmode)

· ReplaceStringInFile(string fileName, string stringOriginal, string stringToReplace)

· GetFile(string fileName, FileMode fmode)

· CreateDirectory(string dirName)

· DeleteDirectory(string dirName)

· DeleteDirectory(dirName);

· GetAllFilesInIsolatedStorage()

· GetISSpaceAvailable()

· GetISSpaceQuota()

· IncreaseISSpaceAvailable(long newQuota)

· MoveDirectory(string sourcePath, string targetPath)

· MoveFile(string sourcePath, string targetPath)

To use any method and because it’s a static class with static methos, it doesn’t need to be instanciated, just reference de dll and call the heler class, example:

IsolatedStorageClassHelper.IsolatedStorageHelper.GetISSpaceQuota().ToString()

or

IsolatedStorageClassHelper.IsolatedStorageHelper.CreateFile(“f1”);

Download

Download the DLL: Download here

Any bug or improvement you need, contact me,

Thanks,

Rui Machado

Anúncios

Deixe uma Resposta

Preencha os seus detalhes abaixo ou clique num ícone para iniciar sessão:

Logótipo da WordPress.com

Está a comentar usando a sua conta WordPress.com Terminar Sessão / Alterar )

Imagem do Twitter

Está a comentar usando a sua conta Twitter Terminar Sessão / Alterar )

Facebook photo

Está a comentar usando a sua conta Facebook Terminar Sessão / Alterar )

Google+ photo

Está a comentar usando a sua conta Google+ Terminar Sessão / Alterar )

Connecting to %s