Exemple #1
0
        // Token: 0x060000B7 RID: 183 RVA: 0x00005EFC File Offset: 0x000040FC
        private void RefreshViewOfDirectory()
        {
            ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch LogMonitor ReadDirectory");
            Exception ex = null;

            FileInfo[] source = null;
            try
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(this.path);
                source = directoryInfo.GetFiles(this.pattern, SearchOption.TopDirectoryOnly);
            }
            catch (UnauthorizedAccessException ex2)
            {
                ex = ex2;
            }
            catch (SecurityException ex3)
            {
                ex = ex3;
            }
            catch (IOException ex4)
            {
                ex = ex4;
            }
            catch (ArgumentException ex5)
            {
                ex = ex5;
            }
            if (ex != null)
            {
                ExTraceGlobals.ServiceTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Could not open directory {0}, files will not be refreshed, exception: {1}", this.path, ex.ToString());
                return;
            }
            IOrderedEnumerable <FileInfo> source2 = from fileInfo in source
                                                    orderby fileInfo.CreationTimeUtc descending
                                                    select fileInfo;
            ulong indexSizeLimit           = LogSearchIndexingParameters.GetIndexLimit(this.prefix);
            ulong accumulatedIndexSize     = 0UL;
            IEnumerable <FileInfo> source3 = source2.TakeWhile((FileInfo fileInfo) => this.IsIndexUnderLimit(fileInfo, indexSizeLimit, ref accumulatedIndexSize));
            Dictionary <string, List <FileInfo> > dictionary = new Dictionary <string, List <FileInfo> >();

            foreach (FileInfo fileInfo2 in source3.Reverse <FileInfo>())
            {
                if (fileInfo2.Exists)
                {
                    string          fullPrefix = LogMonitor.GetFullPrefix(fileInfo2.FullName);
                    List <FileInfo> list;
                    if (!dictionary.TryGetValue(fullPrefix, out list))
                    {
                        dictionary[fullPrefix] = new List <FileInfo>();
                    }
                    dictionary[fullPrefix].Add(fileInfo2);
                }
            }
            this.ProcessNewFiles(dictionary);
            this.RetireUnusedFiles(dictionary);
        }
Exemple #2
0
        // Token: 0x060000C1 RID: 193 RVA: 0x000067B4 File Offset: 0x000049B4
        private double GetIndexPercentage(FileInfo fileInfo)
        {
            string fullPrefix = LogMonitor.GetFullPrefix(fileInfo.FullName);
            double result;

            if (this.indexPercentageByPrefix != null && this.indexPercentageByPrefix.TryGetValue(fullPrefix, out result))
            {
                return(result);
            }
            return(LogSearchIndexingParameters.GetDefaultIndexPercentage(this.prefix));
        }
Exemple #3
0
        // Token: 0x0600000D RID: 13 RVA: 0x000023EC File Offset: 0x000005EC
        public void ChangePath(string path)
        {
            ExTraceGlobals.ServiceTracer.TraceDebug <string>((long)this.GetHashCode(), "MsExchangeLogSearch Log ChangePath with new path {0}", path);
            if (string.Compare(this.monitor.Path, path, StringComparison.OrdinalIgnoreCase) == 0)
            {
                return;
            }
            LogMonitor logMonitor = new LogMonitor(path, this.prefix, this.server, this.extension, this.table, this.indexPercentageByPrefix);

            logMonitor.Start();
            LogMonitor logMonitor2 = Interlocked.Exchange <LogMonitor>(ref this.monitor, logMonitor);

            logMonitor2.Stop();
        }
Exemple #4
0
 // Token: 0x06000073 RID: 115 RVA: 0x000044D4 File Offset: 0x000026D4
 public LogFileInfo(string fullName, long length, DateTime startTime, CsvTable csvTable, bool isActive)
 {
     ExTraceGlobals.ServiceTracer.TraceDebug <string, long, string>((long)this.GetHashCode(), "MsExchangeLogSearch constructs LogFileInfo with FilePath {0}, FileLength {1}, FileCreateTime {2}", fullName, length, startTime.ToString());
     this.fullName       = fullName.ToLower();
     this.length         = length;
     this.startTime      = startTime;
     this.prefix         = LogMonitor.GetFullPrefix(this.fullName);
     this.csvTable       = csvTable;
     this.isActive       = isActive;
     this.needsTimeCheck = true;
     if (LogFileInfo.LogFileOpened != null)
     {
         LogFileInfo.LogFileOpened(new LogFile(this), null);
     }
 }
Exemple #5
0
        // Token: 0x060000BF RID: 191 RVA: 0x00006628 File Offset: 0x00004828
        private bool TryGetTimestampFromName(string name, out DateTime timestamp)
        {
            ExTraceGlobals.ServiceTracer.TraceDebug <string>((long)this.GetHashCode(), "MsExchangeLogSearch LogMoniter TryGetTimestampFromName {0}", name);
            timestamp = default(DateTime);
            int num = name.Length - this.extension.Length - "yyyyMMddTHHmmssfff".Length;

            if (num < this.prefix.Length)
            {
                return(false);
            }
            int year;

            if (!LogMonitor.TryGetDigits(name, num, 4, out year))
            {
                return(false);
            }
            num += 4;
            int month;

            if (!LogMonitor.TryGetDigits(name, num, 2, out month))
            {
                return(false);
            }
            num += 2;
            int day;

            if (!LogMonitor.TryGetDigits(name, num, 2, out day))
            {
                return(false);
            }
            num += 2;
            if (name[num++] != 'T')
            {
                return(false);
            }
            int hour;

            if (!LogMonitor.TryGetDigits(name, num, 2, out hour))
            {
                return(false);
            }
            num += 2;
            int minute;

            if (!LogMonitor.TryGetDigits(name, num, 2, out minute))
            {
                return(false);
            }
            num += 2;
            int second;

            if (!LogMonitor.TryGetDigits(name, num, 2, out second))
            {
                return(false);
            }
            num += 2;
            int millisecond;

            if (!LogMonitor.TryGetDigits(name, num, 3, out millisecond))
            {
                return(false);
            }
            num += 3;
            try
            {
                timestamp = new DateTime(year, month, day, hour, minute, second, millisecond);
            }
            catch (ArgumentException)
            {
                return(false);
            }
            return(true);
        }