Example #1
0
        private string GetLogFileNameFromId(LogDirectory.LogFileId id)
        {
            int weekNumber = LogDirectory.GetWeekNumber(id.Date);

            return(Path.Combine(this.FullName, string.Format(CultureInfo.InvariantCulture, this.production, new object[]
            {
                this.prefix,
                id.Date,
                id.Instance,
                this.note,
                ".LOG",
                weekNumber
            })));
        }
Example #2
0
            public bool SameLogSeries(DateTime date, LogDirectory logDirectory)
            {
                if (!this.note.Equals(logDirectory.Note, StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
                if (logDirectory.MaxLogFileSize != 0L)
                {
                    return(logDirectory.MaxLogFileSize == long.MaxValue || ((!logDirectory.EnforceAccurateAge || this.Date.Hour == date.Hour) && (this.Date.Year == date.Year && this.Date.Month == date.Month) && this.Date.Day == date.Day));
                }
                switch (logDirectory.LogFileRollOver)
                {
                case LogFileRollOver.Hourly:
                    return(this.Date.Year == date.Year && this.Date.Month == date.Month && this.Date.Day == date.Day && this.Date.Hour == date.Hour);

                case LogFileRollOver.Daily:
                    return(this.Date.Year == date.Year && this.Date.Month == date.Month && this.Date.Day == date.Day);

                case LogFileRollOver.Weekly:
                    return(this.Date.Year == date.Year && this.Date.Month == date.Month && LogDirectory.GetWeekNumber(this.Date) == LogDirectory.GetWeekNumber(date));

                case LogFileRollOver.Monthly:
                    return(this.Date.Year == date.Year && this.Date.Month == date.Month);

                default:
                    throw new InvalidOperationException("The code should never be hit.");
                }
            }