Пример #1
0
        public static async Task <HostedConfig> GetHostedConfigAsync(IStorageFile file)
        {
            var config = await IoUtils.DeserializeFromFileAsync <HostedConfig>(file, default);

            config.Path = file.Path;
            return(config);
        }
Пример #2
0
        public static async Task <Snapshot> GetSnapshotFromHostConfigAsync(HostedConfig config)
        {
            var         fileName = Path.GetFileName(config.Path);
            StorageFile file;

            try
            {
                file = await(await SnapshotFolderTask).GetFileAsync(fileName);
                var snapshot = await IoUtils.DeserializeFromFileAsync <Snapshot>(file, default);

                snapshot.Path = file.Path;
                return(snapshot);
            }
            catch (FileNotFoundException)
            {
                return(null);
            }
        }