Exemplo n.º 1
0
        public async Task <TType> ReadData()
        {
            string file = await _fileAccessor.ReadFile(_fileUri);

            if (file == null)
            {
                throw new FileNotFoundException();
            }
            var   serializer = new XmlSerializer(typeof(TType));
            TType result;

            using (TextReader reader = new StringReader(file))
            {
                result = (TType)serializer.Deserialize(reader);
            }
            return(result);
        }
        public static async Task <Models.ProductsCatalog> ReadCatalog(IFileAccessor fileAccessor)
        {
            string text = await fileAccessor.ReadFile(CatalogFileUri);

            return(ParseCatalog(text));
        }