void Syncronize(PwDatabase database) { try { var filename = database.IOConnectionInfo.Path; var isSame = Api.IsDatabaseSame(filename); if (!isSame) { var tempFilename = Path.GetTempPath() + String.Concat(Guid.NewGuid().ToString(), ".temp"); var tempFile = Api.DownloadDatabase(filename, tempFilename); if (tempFile != null) { var serialinfo = new IOConnectionInfo { Path = tempFile.FullName }; var db = new PwDatabase(); var log = new Log(); db.Open(serialinfo, database.MasterKey, log); database.MergeIn(db, PwMergeMethod.Synchronize); db.Close(); tempFile.Delete(); } Api.UploadDatabase(filename); Api.CompactDatabase(filename); } } catch (Exception ex) { ShowNotification(ex.Message); } }