Beispiel #1
0
        public static PEDCalcValue GetPEDCValue(PwEntry pe, bool recursion)
        {
            if (!m_dPEDValues.ContainsKey(pe))
            {
                string         days_string = pe.ReadPEDCString();
                PEDCValueEntry pve         = new PEDCValueEntry();
                pve.value = PEDCalcValue.ConvertFromString(days_string);

                if (pve.value.Inherit && (pe.ParentGroup != null))
                {
                    pve.valueinherit = pe.ParentGroup.GetPEDValue(true);
                }
                else
                {
                    pve.valueinherit = new PEDCalcValue(PEDC.Off);
                }
                m_dPEDValues[pe] = pve;
                PluginDebug.AddInfo("Add PEDCValues to buffer", 0,
                                    "Entry: " + pe.Uuid.ToHexString() + " / " + pe.Strings.ReadSafe(PwDefs.TitleField),
                                    "Value: " + pve.value.ToString(),
                                    "Value inherited: " + pve.valueinherit.ToString());
            }
            if (recursion && m_dPEDValues[pe].value.Inherit)
            {
                return(m_dPEDValues[pe].valueinherit);
            }
            return(m_dPEDValues[pe].value);
        }
Beispiel #2
0
        internal static PEDCalcValue ReadPEDCString(this ProtectedStringDictionary psd)
        {
            string sPEDC = psd.ReadSafe(Configuration.DaysField);

            if (string.IsNullOrEmpty(sPEDC))
            {
                sPEDC = psd.ReadSafe(Configuration.Interval);
            }
            if (!string.IsNullOrEmpty(sPEDC))
            {
                return(PEDCalcValue.ConvertFromString(sPEDC));
            }
            return(null);
        }
Beispiel #3
0
        internal static PEDCalcValue GetPEDValue(this PwGroup pg, bool recursion)
        {
            string       days_string = pg.ReadPEDCString();
            PEDCalcValue PEDValue    = PEDCalcValue.ConvertFromString(days_string);

            if (PEDValue.Inherit && recursion && pg.ParentGroup != null)
            {
                return(GetPEDValue(pg.ParentGroup, true));
            }
            if (PEDValue.Inherit && pg.ParentGroup == null)
            {
                PEDValue.unit = PEDC.Off;
            }
            return(PEDValue);
        }