/// <summary> /// Prepare for saving the configuration to disk. None of the /// modifications in this method need to be rolled back /// (for rollback, use <c>OnSavePre</c> / <c>OnSavePost</c>). /// </summary> private void PrepareSave() { AceMeta aceMeta = this.Meta; // m_meta might be null AceApplication aceApp = this.Application; // m_aceApp might be null AceSearch aceSearch = this.Search; // m_aceSearch might be null AceDefaults aceDef = this.Defaults; // m_def might be null aceMeta.OmitItemsWithDefaultValues = true; aceMeta.DpiFactorX = DpiUtil.FactorX; // For new (not loaded) cfgs. aceMeta.DpiFactorY = DpiUtil.FactorY; aceApp.LastUsedFile.ClearCredentials(true); foreach (IOConnectionInfo iocMru in aceApp.MostRecentlyUsed.Items) { iocMru.ClearCredentials(true); } if (aceDef.RememberKeySources == false) { aceDef.KeySources.Clear(); } aceApp.TriggerSystem = Program.TriggerSystem; SearchUtil.PrepareForSerialize(aceSearch.LastUsedProfile); foreach (SearchParameters sp in aceSearch.UserProfiles) { SearchUtil.PrepareForSerialize(sp); } const int m = 64; // Maximum number of compatibility items List <string> l = aceApp.PluginCompatibility; if (l.Count > m) { l.RemoveRange(m, l.Count - m); // See reg. } }
internal void OnLoad() { AceMainWindow aceMW = this.MainWindow; // m_uiMainWindow might be null AceSearch aceSearch = this.Search; // m_aceSearch might be null AceDefaults aceDef = this.Defaults; // m_def might be null // aceInt.UrlSchemeOverrides.SetDefaultsIfEmpty(); ObfuscateCred(false); ChangePathsRelAbs(true); // Remove invalid columns List <AceColumn> lColumns = aceMW.EntryListColumns; int i = 0; while (i < lColumns.Count) { if (((int)lColumns[i].Type < 0) || ((int)lColumns[i].Type >= (int)AceColumnType.Count)) { lColumns.RemoveAt(i); } else { ++i; } } SearchUtil.FinishDeserialize(aceSearch.LastUsedProfile); foreach (SearchParameters sp in aceSearch.UserProfiles) { SearchUtil.FinishDeserialize(sp); } DpiScale(); if (aceMW.EscMinimizesToTray) // For backward compatibility { aceMW.EscMinimizesToTray = false; // Default value aceMW.EscAction = AceEscAction.MinimizeToTray; } if (NativeLib.IsUnix()) { this.Security.MasterKeyOnSecureDesktop = false; AceIntegration aceInt = this.Integration; aceInt.HotKeyGlobalAutoType = (long)Keys.None; aceInt.HotKeyGlobalAutoTypePassword = (long)Keys.None; aceInt.HotKeySelectedAutoType = (long)Keys.None; aceInt.HotKeyShowWindow = (long)Keys.None; aceInt.HotKeyEntryMenu = (long)Keys.None; } if (MonoWorkarounds.IsRequired(1378)) { AceWorkspaceLocking aceWL = this.Security.WorkspaceLocking; aceWL.LockOnSessionSwitch = false; aceWL.LockOnSuspend = false; aceWL.LockOnRemoteControlChange = false; } if (MonoWorkarounds.IsRequired(1418)) { aceMW.MinimizeAfterOpeningDatabase = false; this.Application.Start.MinimizedAndLocked = false; } if (MonoWorkarounds.IsRequired(1976)) { aceMW.FocusQuickFindOnRestore = false; aceMW.FocusQuickFindOnUntray = false; } }