/// <summary>
        /// Triggered when a KeePass database is being saved
        /// </summary>
        private static async void MainWindowOnFileSaved(object sender, FileSavedEventArgs fileSavedEventArgs)
        {
            var config = Configuration.GetPasswordDatabaseConfiguration(fileSavedEventArgs.Database.IOConnectionInfo.Path);

            config.KeePassDatabase = fileSavedEventArgs.Database;

            // Check if we should sync this database
            if (config.DoNotSync)
            {
                return;
            }

            // Make sure it's not a remote database on i.e. an FTP or website
            if (!fileSavedEventArgs.Database.IOConnectionInfo.IsLocalFile())
            {
                MessageBox.Show("KeePass OneDriveSync does not support synchronizing databases from remote locations and will therefore not be available for this database", "KeePass OneDriveSync", MessageBoxButtons.OK, MessageBoxIcon.Information);

                config.DoNotSync = true;
                Configuration.Save();
                return;
            }

            await KeePass.SyncDatabase(fileSavedEventArgs.Database.IOConnectionInfo.Path, KeePass.UpdateStatus);

            // If the OneDrive Refresh Token is stored in the KeePass database, we must trigger a save of the database here so to ensure that the actual value gets saved into the KDBX
            if (config.RefreshTokenStorage == OneDriveRefreshTokenStorage.KeePassDatabase)
            {
                fileSavedEventArgs.Database.Save(null);
            }
        }
예제 #2
0
        /// <summary>
        /// Event handler to implement auto sync on save
        /// </summary>
        private void OnFileSaved(object sender, FileSavedEventArgs e)
        {
            if (e.Success == false)
            {
                return;
            }

            var conf = new SafeVaultConf(_host.Database);

            if (AutoSyncMode.Save != (conf.AutoSyncMode & AutoSyncMode.Save))
            {
                return;
            }

            if (Keys.Shift == (Control.ModifierKeys & Keys.Shift))
            {
                SetStatusText("Shift Key pressed. Auto Sync ignored.");
                return;
            }
            if (!IsSyncConfigured(conf))
            {
                SetStatusText("SafeVault sync not configured.");
                return;
            }
            SyncWithSafeVault(SyncCommand.SyncRemote);
        }
예제 #3
0
 /// <summary>
 /// The on file saved.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void OnFileSaved(object sender, FileSavedEventArgs e)
 {
     if (this.m_appConfig.AutoBackup)
     {
         this._BackupDB();
     }
 }
예제 #4
0
 private void OnFileSaved(object sender, FileSavedEventArgs e)
 {
     MessageBox.Show("Notification received: the user has tried to save the current database to:\r\n" +
                     m_host.Database.IOConnectionInfo.Path + "\r\n\r\nResult:\r\n" +
                     (e.Success ? "Success" : "Failed"), "Formind Plugin",
                     MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
예제 #5
0
 private void OnDatabaseSaveAction(object sender, FileSavedEventArgs e)
 {
     // only create backup if auto-backup is enabled
     if (this.m_config.AutoDatabaseBackup)
     {
         this.BackupAction(e.Database);
     }
 }
예제 #6
0
 private async void OnFileSaved(object sender, FileSavedEventArgs e)
 {
     //Check to make sure the save isn't part of an already-ongoing synchronization to prevent infinite loops
     if (!_config.SyncOnSave || Synchronization.Synchronizing)
     {
         return;
     }
     await Synchronization.SynchronizeDbAsync(_host);
 }
예제 #7
0
 private void OnFileSaved(object sender, FileSavedEventArgs e)
 {
     if (!IsPluginActive() || !IsActiveDatabase(e.Database))
     {
         return;
     }
     //automatically trigger the export function of the syncMaster
     m_keeShare.Export();
 }
예제 #8
0
        /// <summary>
        /// Used to detect if the master key has been changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void OnSavedDB(Object sender, FileSavedEventArgs args)
        {
            var    db     = args.Database;
            var    ioInfo = db.IOConnectionInfo;
            string dbPath = Library.CharChange(ioInfo.Path);

            if (!await UWPLibrary.FirstTime(dbPath) && await UWPLibrary.IsHelloAvailable() && !Library.CheckMasterKey(ioInfo, UWPLibrary.ck))
            {
                await Library.HandleMasterKeyChange(ioInfo, dbPath, false);
            }
        }
예제 #9
0
        private void Editor_FileSaved(object sender, FileSavedEventArgs e)
        {
            var file = File.Create(e.FilePath, true);

            file.SetData(e.Contents);

            if (e.FilePath.StartsWith("/bin/"))
            {
                file.Attributes = FileAttributes.Executable;
            }
        }
 /// <summary>
 /// Event handler to implement auto sync on save
 /// </summary>
 private void OnFileSaved(object sender, FileSavedEventArgs e)
 {
     if (e.Success && AutoSyncMode.SAVE == (m_autoSync & AutoSyncMode.SAVE))
     {
         if (Keys.Shift == (Control.ModifierKeys & Keys.Shift))
         {
             ShowMessage("Shift Key pressed. Auto Sync ignored.", true);
         }
         else if (!LoadConfiguration())
         {
             ShowMessage("No valid configuration found. Auto Sync ignored.", true);
         }
         else
         {
             syncWithGoogle(SyncCommand.SYNC, true);
         }
     }
 }
예제 #11
0
 /// <summary>
 /// Event handler to implement auto sync on save
 /// </summary>
 private void OnFileSaved(object sender, FileSavedEventArgs e)
 {
     if (e.Success && AutoSyncMode.SAVE == (m_autoSync & AutoSyncMode.SAVE))
     {
         if (Keys.Shift == (Control.ModifierKeys & Keys.Shift))
         {
             ShowMessage("按下 Shift 键,跳过自动同步。", true);
         }
         else if (!LoadConfiguration())
         {
             ShowMessage("找不到有效的配置,跳过自动同步。", true);
         }
         else
         {
             syncWithGoogle(SyncCommand.SYNC, true);
         }
     }
 }
예제 #12
0
        /// <summary>
        /// Triggered when a KeePass database is being saved
        /// </summary>
        private async void MainWindowOnFileSaved(object sender, FileSavedEventArgs fileSavedEventArgs)
        {
            var databasePath = fileSavedEventArgs.Database.IOConnectionInfo.Path;

            // If the database is located under the folder from where KeePass runs, use a relative path instead of the absolute path
            if (fileSavedEventArgs.Database.IOConnectionInfo.Path.StartsWith(AppDomain.CurrentDomain.BaseDirectory))
            {
                databasePath = databasePath.Remove(0, AppDomain.CurrentDomain.BaseDirectory.Length);
            }

            var config = Configuration.GetPasswordDatabaseConfiguration(databasePath);

            config.KeePassDatabase = fileSavedEventArgs.Database;

            // Check if we should sync this database
            if (config.DoNotSync)
            {
                return;
            }
            if (!_fileOfflineMenuItem.Checked)
            {
                Host.MainWindow.SetStatusEx(string.Format("OneDriveSync has been set to offline, skipping sync for database {0}", fileSavedEventArgs.Database.Name));
                return;
            }

            // Make sure it's not a remote database on i.e. an FTP or website
            if (!fileSavedEventArgs.Database.IOConnectionInfo.IsLocalFile())
            {
                MessageBox.Show("KeePass OneDriveSync does not support synchronizing databases from remote locations and will therefore not be available for this database", "KeePass OneDriveSync", MessageBoxButtons.OK, MessageBoxIcon.Information);

                config.DoNotSync = true;
                Configuration.Save();
                return;
            }

            await KeePassDatabase.SyncDatabase(databasePath, KeePassDatabase.UpdateStatus, true, config);

            // If the OneDrive Refresh Token is stored in the KeePass database, we must trigger a save of the database here so to ensure that the actual value gets saved into the KDBX
            if (config.RefreshTokenStorage == OneDriveRefreshTokenStorage.KeePassDatabase)
            {
                fileSavedEventArgs.Database.Save(null);
            }
        }
예제 #13
0
 private void OnFileSaved(object sender, FileSavedEventArgs e)
 {
     // nothing todo
 }
 private void OnFileSaved(object sender, FileSavedEventArgs e)
 {
     Generator.UpdateAll(e.Database);
 }
예제 #15
0
 private void OnKPDBSaved(object sender, FileSavedEventArgs e)
 {
     EnsureDBIconIsInKPRPCIconCache();
     SignalAllManagedRPCClients(Signal.DATABASE_SAVED);
 }
예제 #16
0
 private void OnFileSaved(object sender, FileSavedEventArgs e)
 {
 }
예제 #17
0
 async void OnSaveDatabase(object sender, FileSavedEventArgs e)
 {
     await Task.Run(() => Syncronize(e.Database));
 }
예제 #18
0
 private void StartSync(Object sender, FileSavedEventArgs args)
 {
     Sync.StartSync(args.Database);
 }
예제 #19
0
 private void OnKPDBSaved(object sender, FileSavedEventArgs e)
 {
     SignalAllManagedRPCClients(KeePassRPC.DataExchangeModel.Signal.DATABASE_SAVED);
 }
예제 #20
0
 private void OnKPDBSaved(object sender, FileSavedEventArgs e)
 {
     EnsureDBIconIsInKPRPCIconCache();
     SignalAllManagedRPCClients(KeePassRPC.DataExchangeModel.Signal.DATABASE_SAVED);
 }
 private void OnFileSaved(object sender, FileSavedEventArgs fileSavedEventArgs)
 {
     this.IsSaving = false;
 }
예제 #22
0
 private void StartExport(object sender, FileSavedEventArgs args)
 {
     Exporter.Export(args.Database);
 }