public void InitEx(AutoTypeConfig atConfig, ProtectedStringDictionary vStringDict, string strOriginalName, bool bEditSequenceOnly)
		{
			Debug.Assert(vStringDict != null); if(vStringDict == null) throw new ArgumentNullException("vStringDict");
			Debug.Assert(atConfig != null); if(atConfig == null) throw new ArgumentNullException("atConfig");

			m_atConfig = atConfig;
			m_vStringDict = vStringDict;
			m_strOriginalName = strOriginalName;
			m_bEditSequenceOnly = bEditSequenceOnly;
		}
        public void InitEx(AutoTypeConfig atConfig, int iAssocIndex, bool bEditSequenceOnly,
            string strDefaultSeq, ProtectedStringDictionary vStringDict)
        {
            Debug.Assert(atConfig != null); if(atConfig == null) throw new ArgumentNullException("atConfig");

            m_atConfig = atConfig;
            m_iAssocIndex = iAssocIndex;
            m_bEditSequenceOnly = bEditSequenceOnly;
            m_strDefaultSeq = (strDefaultSeq ?? string.Empty);
            m_vStringDict = (vStringDict ?? new ProtectedStringDictionary());
        }
Example #3
0
        public void InitEx(AutoTypeConfig atConfig, int iAssocIndex, bool bEditSequenceOnly,
                           string strDefaultSeq, ProtectedStringDictionary vStringDict)
        {
            Debug.Assert(atConfig != null); if (atConfig == null)
            {
                throw new ArgumentNullException("atConfig");
            }

            m_atConfig          = atConfig;
            m_iAssocIndex       = iAssocIndex;
            m_bEditSequenceOnly = bEditSequenceOnly;
            m_strDefaultSeq     = (strDefaultSeq ?? string.Empty);
            m_vStringDict       = (vStringDict ?? new ProtectedStringDictionary());
        }
Example #4
0
        /// <summary>
        /// Assign properties to the current entry based on a template entry.
        /// </summary>
        /// <param name="peTemplate">Template entry. Must not be <c>null</c>.</param>
        /// <param name="bOnlyIfNewer">Only set the properties of the template entry
        /// if it is newer than the current one.</param>
        /// <param name="bIncludeHistory">If <c>true</c>, the history will be
        /// copied, too.</param>
        /// <param name="bAssignLocationChanged">If <c>true</c>, the
        /// <c>LocationChanged</c> property is copied, otherwise not.</param>
        public void AssignProperties(PwEntry peTemplate, bool bOnlyIfNewer,
                                     bool bIncludeHistory, bool bAssignLocationChanged)
        {
            if (peTemplate == null)
            {
                Debug.Assert(false); throw new ArgumentNullException("peTemplate");
            }

            if (bOnlyIfNewer && (TimeUtil.Compare(peTemplate.m_tLastMod,
                                                  m_tLastMod, true) < 0))
            {
                return;
            }

            // Template UUID should be the same as the current one
            Debug.Assert(m_uuid.Equals(peTemplate.m_uuid));
            m_uuid = peTemplate.m_uuid;

            if (bAssignLocationChanged)
            {
                m_tParentGroupLastMod = peTemplate.m_tParentGroupLastMod;
            }

            m_listStrings  = peTemplate.m_listStrings.CloneDeep();
            m_listBinaries = peTemplate.m_listBinaries.CloneDeep();
            m_listAutoType = peTemplate.m_listAutoType.CloneDeep();
            if (bIncludeHistory)
            {
                m_listHistory = peTemplate.m_listHistory.CloneDeep();
            }

            m_pwIcon         = peTemplate.m_pwIcon;
            m_pwCustomIconID = peTemplate.m_pwCustomIconID;             // Immutable

            m_clrForeground = peTemplate.m_clrForeground;
            m_clrBackground = peTemplate.m_clrBackground;

            m_tCreation   = peTemplate.m_tCreation;
            m_tLastMod    = peTemplate.m_tLastMod;
            m_tLastAccess = peTemplate.m_tLastAccess;
            m_tExpire     = peTemplate.m_tExpire;
            m_bExpires    = peTemplate.m_bExpires;
            m_uUsageCount = peTemplate.m_uUsageCount;

            m_strOverrideUrl = peTemplate.m_strOverrideUrl;

            m_vTags = new List <string>(peTemplate.m_vTags);

            m_dCustomData = peTemplate.m_dCustomData.CloneDeep();
        }
Example #5
0
        public void InitEx(AutoTypeConfig atConfig, ProtectedStringDictionary vStringDict, string strOriginalName, bool bEditSequenceOnly)
        {
            Debug.Assert(vStringDict != null); if (vStringDict == null)
            {
                throw new ArgumentNullException("vStringDict");
            }
            Debug.Assert(atConfig != null); if (atConfig == null)
            {
                throw new ArgumentNullException("atConfig");
            }

            m_atConfig          = atConfig;
            m_vStringDict       = vStringDict;
            m_strOriginalName   = strOriginalName;
            m_bEditSequenceOnly = bEditSequenceOnly;
        }
Example #6
0
        /// <summary>
        /// Assign properties to the current entry based on a template entry.
        /// </summary>
        /// <param name="peTemplate">Template entry. Must not be <c>null</c>.</param>
        /// <param name="bOnlyIfNewer">Only set the properties of the template entry
        /// if it is newer than the current one.</param>
        /// <param name="bIncludeHistory">If <c>true</c>, the history will be
        /// copied, too.</param>
        /// <param name="bAssignLocationChanged">If <c>true</c>, the
        /// <c>LocationChanged</c> property is copied, otherwise not.</param>
        public void AssignProperties(PwEntry peTemplate, bool bOnlyIfNewer,
                                     bool bIncludeHistory, bool bAssignLocationChanged)
        {
            Debug.Assert(peTemplate != null); if (peTemplate == null)
            {
                throw new ArgumentNullException("peTemplate");
            }

            if (bOnlyIfNewer && (peTemplate.m_tLastMod < m_tLastMod))
            {
                return;
            }

            // Template UUID should be the same as the current one
            Debug.Assert(m_uuid.EqualsValue(peTemplate.m_uuid));
            m_uuid = peTemplate.m_uuid;

            if (bAssignLocationChanged)
            {
                m_tParentGroupLastMod = peTemplate.m_tParentGroupLastMod;
            }

            m_listStrings  = peTemplate.m_listStrings;
            m_listBinaries = peTemplate.m_listBinaries;
            m_listAutoType = peTemplate.m_listAutoType;
            if (bIncludeHistory)
            {
                m_listHistory = peTemplate.m_listHistory;
            }

            m_pwIcon         = peTemplate.m_pwIcon;
            m_pwCustomIconID = peTemplate.m_pwCustomIconID;             // Immutable

            m_clrForeground = peTemplate.m_clrForeground;
            m_clrBackground = peTemplate.m_clrBackground;

            m_tCreation   = peTemplate.m_tCreation;
            m_tLastMod    = peTemplate.m_tLastMod;
            m_tLastAccess = peTemplate.m_tLastAccess;
            m_tExpire     = peTemplate.m_tExpire;
            m_bExpires    = peTemplate.m_bExpires;
            m_uUsageCount = peTemplate.m_uUsageCount;

            m_strOverrideUrl = peTemplate.m_strOverrideUrl;
        }
        private void ReadAutoType(XmlNode xmlNode, AutoTypeConfig atConfig)
        {
            ProcessNode(xmlNode);

            foreach(XmlNode xmlChild in xmlNode.ChildNodes)
            {
                if(xmlChild.Name == ElemAutoTypeEnabled)
                    atConfig.Enabled = ReadBool(xmlChild, true);
                else if(xmlChild.Name == ElemAutoTypeObfuscation)
                    atConfig.ObfuscationOptions =
                        (AutoTypeObfuscationOptions)ReadUInt(xmlChild, 0);
                else if(xmlChild.Name == ElemAutoTypeDefaultSeq)
                    atConfig.DefaultSequence = ReadString(xmlChild);
                else if(xmlChild.Name == ElemAutoTypeItem)
                    ReadAutoTypeItem(xmlChild, atConfig);
                else ReadUnknown(xmlChild);
            }
        }
Example #8
0
        private void OnBtnAutoTypeEdit(object sender, EventArgs e)
        {
            // string strName = @"(" + KPRes.AutoType + @")";

            AutoTypeConfig atConfig = new AutoTypeConfig();

            atConfig.DefaultSequence = m_tbDefaultAutoTypeSeq.Text;

            EditAutoTypeItemForm dlg = new EditAutoTypeItemForm();

            dlg.InitEx(atConfig, -1, true, atConfig.DefaultSequence, null);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                m_tbDefaultAutoTypeSeq.Text = atConfig.DefaultSequence;
            }

            UIUtil.DestroyForm(dlg);
            EnableControlsEx();
        }
Example #9
0
        private void OnBtnAutoTypeEdit(object sender, EventArgs e)
        {
            EditAutoTypeItemForm dlg = new EditAutoTypeItemForm();

            string strName = @"(" + KPRes.AutoType + @")";

            AutoTypeConfig atConfig = new AutoTypeConfig();

            atConfig.DefaultSequence = m_tbDefaultAutoTypeSeq.Text;

            dlg.InitEx(atConfig, new ProtectedStringDictionary(),
                       strName, true);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                m_tbDefaultAutoTypeSeq.Text = atConfig.DefaultSequence;
            }

            EnableControlsEx();
        }
Example #10
0
        private void textBoxHotKeySequence_Click(object sender, EventArgs e)
        {
            AutoTypeConfig autoTypeConfig = new AutoTypeConfig();

            if (textBoxHotKeySequence.Text != KeeOtp2Ext.BuiltInTotpPlaceHolder)
            {
                autoTypeConfig.DefaultSequence = textBoxHotKeySequence.Text;
            }
            EditAutoTypeItemForm eatf = new EditAutoTypeItemForm();

            eatf.InitEx(autoTypeConfig, -1, true, KeeOtp2Ext.BuiltInTotpPlaceHolder, null);
            eatf.ShowDialog();

            if (eatf.DialogResult == DialogResult.OK && autoTypeConfig.DefaultSequence != string.Empty)
            {
                textBoxHotKeySequence.Text = autoTypeConfig.DefaultSequence;
            }
            else
            {
                textBoxHotKeySequence.Text = KeeOtp2Ext.BuiltInTotpPlaceHolder;
            }
        }
Example #11
0
        private void bSequenceEdit_Click(object sender, EventArgs e)
        {
            EditAutoTypeItemForm dlg = new EditAutoTypeItemForm();
            AutoTypeConfig       atc = new AutoTypeConfig();

            if (string.IsNullOrEmpty(rtbSequence.Text))
            {
                atc.DefaultSequence = PasswordChangeAssistantExt.GetPCASequence(PasswordChangeAssistantExt.SelectedEntry, PluginTranslate.DefaultSequence01);
            }
            else
            {
                atc.DefaultSequence = rtbSequence.Text;
            }
            dlg.InitEx(atc, -1, true, rtbSequence.Text, m_pcadata.Strings);
            dlg.Text = KPRes.ConfigureKeystrokeSeq;
            Control cCustomSequence = Tools.GetControl("m_rbKeySeq", dlg);
            Control cFirst          = Tools.GetControl("m_lblTargetWindow", dlg);

            if ((cCustomSequence != null) && (cFirst != null))
            {
                int y = cCustomSequence.Top - cFirst.Top;
                HideControl("m_lblTargetWindow", dlg);
                HideControl("m_rbSeqDefault", dlg);
                HideControl("m_cmbWindow", dlg);
                HideControl("m_lblOpenHint", dlg);
                HideControl("m_lnkWildcardRegexHint", dlg);
                HideControl("m_rbSeqCustom", dlg);
                MoveControlUp("m_rbKeySeq", y, dlg);
                MoveControlUp("m_lblKeySeqInsertInfo", y, dlg);
                MoveControlUp("m_rtbPlaceholders", y, dlg);
                Tools.GetControl("m_rtbPlaceholders", dlg).Height += y;
            }
            if (UIUtil.ShowDialogAndDestroy(dlg) == DialogResult.OK)
            {
                rtbSequence.Text = atc.DefaultSequence;
            }
        }
        internal void ReadAutoTypeItem(XmlNode xmlNode, AutoTypeConfig atStorage)
        {
            ProcessNode(xmlNode);

            string strWindow = string.Empty, strKeySeq = string.Empty;

            foreach (XmlNode xmlChild in xmlNode.ChildNodes)
            {
                if (xmlChild.Name == ElemWindow)
                {
                    strWindow = ReadString(xmlChild);
                }
                else if (xmlChild.Name == ElemKeystrokeSequence)
                {
                    strKeySeq = ReadString(xmlChild);
                }
                else
                {
                    ReadUnknown(xmlChild);
                }
            }

            atStorage.Set(strWindow, strKeySeq);
        }
Example #13
0
 public AutoTypeAssociationsBuffer(AutoTypeConfig autoTypeConfig)
 {
     mAutoTypeConfig = autoTypeConfig;
 }
		private void WriteList(string name, AutoTypeConfig dictAutoType)
		{
			Debug.Assert(name != null);
			Debug.Assert(dictAutoType != null);
			if(dictAutoType == null) throw new ArgumentNullException("dictAutoType");

			m_xmlWriter.WriteStartElement(name);

			WriteObject(ElemAutoTypeEnabled, dictAutoType.Enabled);
			WriteObject(ElemAutoTypeObfuscation, (uint)dictAutoType.ObfuscationOptions);

			if(dictAutoType.DefaultSequence.Length > 0)
				WriteObject(ElemAutoTypeDefaultSeq, dictAutoType.DefaultSequence, true);

			foreach(KeyValuePair<string, string> kvp in dictAutoType.WindowSequencePairs)
				WriteObject(ElemAutoTypeItem, ElemWindow, ElemKeystrokeSequence, kvp);

			m_xmlWriter.WriteEndElement();
		}
        private void ReadAutoTypeItem(XmlNode xmlNode, AutoTypeConfig atStorage)
        {
            ProcessNode(xmlNode);

            string strWindow = string.Empty, strKeySeq = string.Empty;

            foreach(XmlNode xmlChild in xmlNode.ChildNodes)
            {
                if(xmlChild.Name == ElemWindow)
                    strWindow = ReadString(xmlChild);
                else if(xmlChild.Name == ElemKeystrokeSequence)
                    strKeySeq = ReadString(xmlChild);
                else ReadUnknown(xmlChild);
            }

            atStorage.Set(strWindow, strKeySeq);
        }
Example #16
0
        private void WriteList(string name, AutoTypeConfig cfgAutoType)
        {
            Debug.Assert(name != null);
            Debug.Assert(cfgAutoType != null);
            if(cfgAutoType == null) throw new ArgumentNullException("cfgAutoType");

            m_xmlWriter.WriteStartElement(name);

            WriteObject(ElemAutoTypeEnabled, cfgAutoType.Enabled);
            WriteObject(ElemAutoTypeObfuscation, (int)cfgAutoType.ObfuscationOptions);

            if(cfgAutoType.DefaultSequence.Length > 0)
                WriteObject(ElemAutoTypeDefaultSeq, cfgAutoType.DefaultSequence, true);

            foreach(AutoTypeAssociation a in cfgAutoType.Associations)
                WriteObject(ElemAutoTypeItem, ElemWindow, ElemKeystrokeSequence,
                    new KeyValuePair<string, string>(a.WindowName, a.Sequence));

            m_xmlWriter.WriteEndElement();
        }
Example #17
0
        private void OnBtnAutoTypeEdit(object sender, EventArgs e)
        {
            // string strName = @"(" + KPRes.AutoType + @")";

            AutoTypeConfig atConfig = new AutoTypeConfig();
            atConfig.DefaultSequence = m_tbDefaultAutoTypeSeq.Text;

            EditAutoTypeItemForm dlg = new EditAutoTypeItemForm();
            dlg.InitEx(atConfig, -1, true, atConfig.DefaultSequence, null);

            if(dlg.ShowDialog() == DialogResult.OK)
                m_tbDefaultAutoTypeSeq.Text = atConfig.DefaultSequence;

            UIUtil.DestroyForm(dlg);
            EnableControlsEx();
        }
Example #18
0
 public AutoTypeConfigBuffer(AutoTypeConfig autoTypeConfig)
 {
     mAutoTypeConfig             = autoTypeConfig;
     mAutoTypeAssociationsBuffer = new AutoTypeAssociationsBuffer(mAutoTypeConfig);
 }
Example #19
0
        public void InitEx(PwEntry pwEntry, PwEditMode pwMode, PwDatabase pwDatabase,
            ImageList ilIcons, bool bShowAdvancedByDefault, bool bSelectFullTitle)
        {
            Debug.Assert(pwEntry != null); if(pwEntry == null) throw new ArgumentNullException("pwEntry");
            Debug.Assert(pwMode != PwEditMode.Invalid); if(pwMode == PwEditMode.Invalid) throw new ArgumentException();
            Debug.Assert(ilIcons != null); if(ilIcons == null) throw new ArgumentNullException("ilIcons");

            m_pwEntry = pwEntry;
            m_pwEditMode = pwMode;
            m_pwDatabase = pwDatabase;
            m_ilIcons = ilIcons;
            m_bShowAdvancedByDefault = bShowAdvancedByDefault;
            m_bSelectFullTitle = bSelectFullTitle;

            m_vStrings = m_pwEntry.Strings.CloneDeep();
            m_vBinaries = m_pwEntry.Binaries.CloneDeep();
            m_atConfig = m_pwEntry.AutoType.CloneDeep();
            m_vHistory = m_pwEntry.History.CloneDeep();
        }
Example #20
0
 public AutoTypeConfigBuffer()
 {
     mAutoTypeConfig             = new AutoTypeConfig();
     mAutoTypeAssociationsBuffer = new AutoTypeAssociationsBuffer(mAutoTypeConfig);
 }
Example #21
0
        private void OnBtnAutoTypeEdit(object sender, EventArgs e)
        {
            EditAutoTypeItemForm dlg = new EditAutoTypeItemForm();

            string strName = @"(" + KPRes.AutoType + @")";

            AutoTypeConfig atConfig = new AutoTypeConfig();
            atConfig.DefaultSequence = m_tbDefaultAutoTypeSeq.Text;

            dlg.InitEx(atConfig, new ProtectedStringDictionary(),
                strName, true);

            if(dlg.ShowDialog() == DialogResult.OK)
                m_tbDefaultAutoTypeSeq.Text = atConfig.DefaultSequence;

            EnableControlsEx();
        }
Example #22
0
        public void InitEx(AutoTypeConfig atConfig, ProtectedStringDictionary vStringDict,
            int iOrgIndex, bool bEditSequenceOnly)
        {
            Debug.Assert(vStringDict != null); if(vStringDict == null) throw new ArgumentNullException("vStringDict");
            Debug.Assert(atConfig != null); if(atConfig == null) throw new ArgumentNullException("atConfig");

            m_atConfig = atConfig;
            m_vStringDict = vStringDict;
            m_iOrgIndex = iOrgIndex;
            m_bEditSequenceOnly = bEditSequenceOnly;
        }