public override void Conflict(ListItem item, Action <ListItem, string, string> uploaded) { var path = GetNonConflictPath(); UploadFileAsync(path, x => uploaded(x, _client.GetUrl(path), new Uri(path).LocalPath)); }
private void OnFileDownloaded(byte[] file, string path, string title, string modified) { var dispatcher = Dispatcher; try { using (var buffer = new MemoryStream(file)) { if (string.IsNullOrEmpty(_folder)) { if (!DatabaseVerifier.Verify(dispatcher, buffer)) { return; } var storage = new DatabaseInfo(); storage.SetDatabase(buffer, new DatabaseDetails { Modified = modified, Name = title.RemoveKdbx(), Url = _client.GetUrl(path), Type = SourceTypes.Synchronizable, Source = DatabaseUpdater.WEBDAV_UPDATER, }); } else { var hash = KeyFile.GetKey(buffer); if (hash == null) { dispatcher.BeginInvoke(() => MessageBox.Show( Properties.Resources.InvalidKeyFile, Properties.Resources.KeyFileTitle, MessageBoxButton.OK)); return; } new DatabaseInfo(_folder) .SetKeyFile(hash); } } dispatcher.BeginInvoke( this.BackToDBs); } finally { dispatcher.BeginInvoke(() => progBusy.IsBusy = false); } }