Esempio n. 1
0
        public static bool TraceFromFileLongValues(string sFileName, long lCurrentValue, DelegateLongFromRegistryFound dlfrf, params object[] args)
        {
            CachedLongValues clv = ReadCachedLongValuesFromFile(sFileName);

            if (clv != null && clv.Values.Contains(lCurrentValue))
            {
                dlfrf(lCurrentValue, args);
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        private static CachedLongValues ReadCachedLongValuesFromFile(string sFileName)
        {
            CachedLongValues clv = m_di.SafelyGetValue(sFileName);

            if (clv == null)
            {
                string sValue = ReadTextFromFile(GetTracePath(sFileName));

                clv = new CachedLongValues();
                clv.Initialize(sValue);

                m_di[sFileName] = clv;
            }
            else if (clv.Time + CACHED_TEXT_TIMEOUT < DateTime.UtcNow)
            {
                string sValue = ReadTextFromFile(GetTracePath(sFileName));
                clv.Initialize(sValue);
            }

            return(clv);
        }