C# Class IsolatedStorageExtensions.IsolatedStorageHelper

Exibir arquivo Open project: Aaronontheweb/isolatedstorage-extensions

Public Methods

Method Description
CreateDirectoryTree ( string filepath ) : void

Creates all of the directories included in the given filepath.

CreateDirectoryTree ( string filepath, IsolatedStorageFile storage ) : void

Creates all of the directories included in the given filepath.

DeleteDirectoryTree ( string filepath ) : void

Deletes all of the folders and their contents in a given file-path.

DeleteDirectoryTree ( string filepath, IsolatedStorageFile storage ) : void

Deletes all of the folders and their contents in a given file-path.

DeleteFile ( string filename ) : void

Used for deleting a file from IsolatedStorage.

DeleteFile ( string filename, IsolatedStorageFile storage ) : void

Used for deleting a file from IsolatedStorage.

DirectoryExists ( string directorypath ) : bool

Verifies whether or not a given directory exists in IsolatedStorage

DirectoryExists ( string directorypath, IsolatedStorageFile storage ) : bool

Verifies whether or not a given directory exists in IsolatedStorage

FileExists ( string filepath ) : bool

Determines whether or not a given filepath exists.

FileExists ( string filepath, IsolatedStorageFile storage ) : bool

Determines whether or not a given filepath exists.

GetApplicationSetting ( string key ) : object

Retrieves an object from the application settings store

GetFileAge ( string filepath ) : DateTimeOffset

Determines the age of a file based on the last time it was written to

GetFileAge ( string filepath, IsolatedStorageFile storage ) : DateTimeOffset

Determines the age of a file based on the last time it was written to

GetFullDirectoryPath ( string filepath ) : string

Extracts the directory path based on what's present in a given filename.

GetRootDirectory ( string filepath ) : string

Extracts the root folder from a path and returns its name

GetSafeFileName ( string filename ) : string

Returns a safe filename based on an incoming string. Makes it easy to create valid filenames based off of any type of string.

GetSiteSetting ( string key ) : object

Retrieves an object from the site settings store

HasDirectories ( string filepath ) : bool

Returns true if a given path contains folders

MakeFile ( byte data, string filepath ) : void

Create a file in IsolatedStorage.

MakeFile ( byte data, string filepath, IsolatedStorageFile storage ) : void

Create a file in IsolatedStorage.

MakeFile ( string textdata, string filepath ) : void

Create a file in IsolatedStorage.

MakeFile ( string textdata, string filepath, IsolatedStorageFile storage ) : void

Create a file in IsolatedStorage.

ReadFileStream ( string filepath ) : Stream

Begins reading the file from IsolatedStorage as a stream.

ReadFileStream ( string filepath, IsolatedStorageFile storage ) : Stream

Begins reading the file from IsolatedStorage as a stream.

ReadFileText ( string filepath ) : string

Returns the contents of a file as text.

ReadFileText ( string filepath, IsolatedStorageFile storage ) : string

Returns the contents of a file as text.

RemoveApplicationSetting ( string key ) : void

Removes an object from the application settings store

RemoveSiteSetting ( string key ) : void

Removes an object from the site settings store

SaveApplicationSetting ( string key, object value ) : void

Adds a new object to the application settings store

SaveSiteSetting ( string key, object value ) : void

Adds a new object to the site settings store

Private Methods

Method Description
DeleteSetting ( System.IO.IsolatedStorage.IsolatedStorageSettings store, string key ) : void

Private helper method for performing deletes on a setting

GetApplicationSettings ( ) : System.IO.IsolatedStorage.IsolatedStorageSettings

Internal factory method for creating an accessor to the application's settings collection

GetSiteSettings ( ) : System.IO.IsolatedStorage.IsolatedStorageSettings

Internal factory method for creating an accessor to the site's settings collection

GetStore ( ) : IsolatedStorageFile

Internal factory method for creating storage instances used in other methods.

SafeGetStorageValue ( System.IO.IsolatedStorage.IsolatedStorageSettings store, string key ) : object

Returns a value from storage if it exists; otherwise, null

SaveOrUpdateSetting ( System.IO.IsolatedStorage.IsolatedStorageSettings store, string key, object value ) : void

Private helper method for performing saves on settings

Method Details

CreateDirectoryTree() public static method

Creates all of the directories included in the given filepath.
public static CreateDirectoryTree ( string filepath ) : void
filepath string A string containing a filepath which may or may not contain any number of directories.
return void

CreateDirectoryTree() public static method

Creates all of the directories included in the given filepath.
public static CreateDirectoryTree ( string filepath, IsolatedStorageFile storage ) : void
filepath string A string containing a filepath which may or may not contain any number of directories.
storage System.IO.IsolatedStorage.IsolatedStorageFile A reference to a valid IsolatedStorageFile instance
return void

DeleteDirectoryTree() public static method

Deletes all of the folders and their contents in a given file-path.
public static DeleteDirectoryTree ( string filepath ) : void
filepath string A valid filepath in IsolatedStorage.
return void

DeleteDirectoryTree() public static method

Deletes all of the folders and their contents in a given file-path.
public static DeleteDirectoryTree ( string filepath, IsolatedStorageFile storage ) : void
filepath string A valid filepath in IsolatedStorage.
storage System.IO.IsolatedStorage.IsolatedStorageFile A reference to a valid IsolateStorageFile object.
return void

DeleteFile() public static method

Used for deleting a file from IsolatedStorage.
public static DeleteFile ( string filename ) : void
filename string The name of the file to be deleted.
return void

DeleteFile() public static method

Used for deleting a file from IsolatedStorage.
public static DeleteFile ( string filename, IsolatedStorageFile storage ) : void
filename string The name of the file to be deleted.
storage System.IO.IsolatedStorage.IsolatedStorageFile A reference to an activate IsolatedStorageFile object.
return void

DirectoryExists() public static method

Verifies whether or not a given directory exists in IsolatedStorage
public static DirectoryExists ( string directorypath ) : bool
directorypath string The path to a given directory
return bool

DirectoryExists() public static method

Verifies whether or not a given directory exists in IsolatedStorage
public static DirectoryExists ( string directorypath, IsolatedStorageFile storage ) : bool
directorypath string The path to a given directory
storage System.IO.IsolatedStorage.IsolatedStorageFile A reference to a valid IsolatedStorageFile instance.
return bool

FileExists() public static method

Determines whether or not a given filepath exists.
public static FileExists ( string filepath ) : bool
filepath string A string containing a filepath.
return bool

FileExists() public static method

Determines whether or not a given filepath exists.
public static FileExists ( string filepath, IsolatedStorageFile storage ) : bool
filepath string A string containing a filepath.
storage System.IO.IsolatedStorage.IsolatedStorageFile A reference to a valid IsolatedStorageFile instance.
return bool

GetApplicationSetting() public static method

Retrieves an object from the application settings store
public static GetApplicationSetting ( string key ) : object
key string The key to identify the object with
return object

GetFileAge() public static method

Determines the age of a file based on the last time it was written to
public static GetFileAge ( string filepath ) : DateTimeOffset
filepath string The path of the file to test.
return DateTimeOffset

GetFileAge() public static method

Determines the age of a file based on the last time it was written to
public static GetFileAge ( string filepath, IsolatedStorageFile storage ) : DateTimeOffset
filepath string The path of the file to test.
storage System.IO.IsolatedStorage.IsolatedStorageFile A reference to a valid IsolatedStorageFile instance.
return DateTimeOffset

GetFullDirectoryPath() public static method

Extracts the directory path based on what's present in a given filename.
public static GetFullDirectoryPath ( string filepath ) : string
filepath string A string containing a filepath which may or may not contain any number of directories.
return string

GetRootDirectory() public static method

Extracts the root folder from a path and returns its name
public static GetRootDirectory ( string filepath ) : string
filepath string A filepath to be evaluated
return string

GetSafeFileName() public static method

Returns a safe filename based on an incoming string. Makes it easy to create valid filenames based off of any type of string.
public static GetSafeFileName ( string filename ) : string
filename string A string which doesn't necessarily contain a valid filename.
return string

GetSiteSetting() public static method

Retrieves an object from the site settings store
public static GetSiteSetting ( string key ) : object
key string The key to identify the object with
return object

HasDirectories() public static method

Returns true if a given path contains folders
public static HasDirectories ( string filepath ) : bool
filepath string A filepath to test
return bool

MakeFile() public static method

Create a file in IsolatedStorage.
public static MakeFile ( byte data, string filepath ) : void
data byte The data you want to write, expressed as a byte array.
filepath string The path of the file you want to write.
return void

MakeFile() public static method

Create a file in IsolatedStorage.
public static MakeFile ( byte data, string filepath, IsolatedStorageFile storage ) : void
data byte The data you want to write, expressed as a byte array.
filepath string The path of the file you want to write.
storage System.IO.IsolatedStorage.IsolatedStorageFile A reference to a valid IsolatedStorageFile instance.
return void

MakeFile() public static method

Create a file in IsolatedStorage.
public static MakeFile ( string textdata, string filepath ) : void
textdata string The data you want to write, expressed as a string.
filepath string The path of the file you want to write.
return void

MakeFile() public static method

Create a file in IsolatedStorage.
public static MakeFile ( string textdata, string filepath, IsolatedStorageFile storage ) : void
textdata string The data you want to write, expressed as a string.
filepath string The path of the file you want to write.
storage System.IO.IsolatedStorage.IsolatedStorageFile A reference to a valid IsolatedStorageFile instance.
return void

ReadFileStream() public static method

Begins reading the file from IsolatedStorage as a stream.
public static ReadFileStream ( string filepath ) : Stream
filepath string The path to the file.
return Stream

ReadFileStream() public static method

Begins reading the file from IsolatedStorage as a stream.
public static ReadFileStream ( string filepath, IsolatedStorageFile storage ) : Stream
filepath string The path to the file.
storage System.IO.IsolatedStorage.IsolatedStorageFile A valid IsolatedStorageFile instance.
return Stream

ReadFileText() public static method

Returns the contents of a file as text.
public static ReadFileText ( string filepath ) : string
filepath string The path to the file.
return string

ReadFileText() public static method

Returns the contents of a file as text.
public static ReadFileText ( string filepath, IsolatedStorageFile storage ) : string
filepath string The path to the file.
storage System.IO.IsolatedStorage.IsolatedStorageFile A reference to a valid IsolatedStorageFile instance.
return string

RemoveApplicationSetting() public static method

Removes an object from the application settings store
public static RemoveApplicationSetting ( string key ) : void
key string
return void

RemoveSiteSetting() public static method

Removes an object from the site settings store
public static RemoveSiteSetting ( string key ) : void
key string
return void

SaveApplicationSetting() public static method

Adds a new object to the application settings store
public static SaveApplicationSetting ( string key, object value ) : void
key string The key to identify the object with
value object The object to put into storage
return void

SaveSiteSetting() public static method

Adds a new object to the site settings store
public static SaveSiteSetting ( string key, object value ) : void
key string The key to identify the object with
value object The object to put into storage
return void