Exemple #1
0
 public virtual object Deserialization(SecureMessenger o)
 {
     using (FileStream fs = new FileStream(FilePath, SerializationFileMode))
     {
         o = (SecureMessenger)SerializationFormatter.Deserialize(fs);
         Console.WriteLine("Object deserialized");
     }
     return(o);
 }
        private async Task <T> Load <T>(Uri uri) where T : IBaseUri
        {
            log.Information("Loading {T} from {url}", typeof(T), uri);
            using (var mem = new MemoryStream())
            {
                await Downloader.Download(uri, mem);

                log.Debug("Deserializing");
                mem.Position = 0;
                var t = (T)SerializationFormatter.Deserialize(mem);
                t.BaseUri = new Uri(uri, ".");
                return(t);
            }
        }