Ejemplo n.º 1
0
        public PersisterResult Save(Uri uri, string persistableItem)
        {
            var result = new PersisterResult();

            try
            {
                using (var writer = new StreamWriter(uri.AbsolutePath))
                {
                    writer.Write(persistableItem);
                }
                result.IsSuccess = true;
            }
            catch (Exception e)
            {
                result.Message   = e.Message;
                result.IsSuccess = false;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public PersisterResult Load(Uri uri)
        {
            var result = new PersisterResult();

            try
            {
                using (var reader = new StreamReader(uri.AbsolutePath))
                {
                    result.Content = reader.ReadToEnd();
                }
                result.IsSuccess = true;
            }
            catch (Exception e)
            {
                result.Message   = e.Message;
                result.IsSuccess = false;
            }
            return(result);
        }