public static async Task <bool> RestoreStorage(StorageBase s, string url = null) { if (string.IsNullOrWhiteSpace(url)) { string backupName = s.GetPath() + ".bk"; if (!File.Exists(backupName)) { return(false); } s.Load(backupName); s.Save(); return(true); } using (WebClient wc = new WebClient()) { try { await wc.DownloadFileTaskAsync(url, s.GetPath()); } catch (Exception) { return(false); } if (!File.Exists(s.GetPath())) { return(false); } s.Load(); s.Save(); } return(true); }
public void SetParent(StorageBase parent) { _parent = parent; }