src/K4W.KinectVOD.Client.WinStore/LocalStorage/LocalStorageHelper.cs
/// <summary>
/// Load a local file and retrieve the content
/// </summary>
/// <typeparam name="T">Requested result type</typeparam>
/// <param name="fileName">Local filename</param>
/// <returns>Local content</returns>
Load a local file and retrieve the content
Load a local file and retrieve the content
public static async Task<T> LoadFileContentAsync<T>(string fileName)
        {
            try
            {
                StorageFile localFile = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName);
                return (localFile != null) ? (await FileIO.ReadTextAsync(localFile)).DeserializeFromJson<T>() : default(T);
            }
            catch (FileNotFoundException ex)
            {
                return default(T);
            }
        }
public static async Task < T > LoadFileContentAsync < T > ( string fileName ) { try { StorageFile localFile = await ApplicationData . Current . LocalFolder . GetFileAsync ( fileName ) ; return ( localFile != null ) ? ( await FileIO . ReadTextAsync ( localFile ) ) . DeserializeFromJson < T > ( ) : default ( T ) ; } catch ( FileNotFoundException ex ) { return default ( T ) ; } }
Load a local file and retrieve the content
Load a local file and retrieve the content
None
fileName
string
None
typeparam
Requested result type
Requested result type