Example #1
0
 static string OldestOf(string one, string two)
 {
     ReportInfo a = new ReportInfo(one);
     ReportInfo b = new ReportInfo(two);
     if (a.Date < b.Date)
         return one;
     else
         return two;
 }
Example #2
0
        // Maybe change this to where you can specify the timespan.
        public virtual void ArchiveOldLogs()
        {
            string[] files = Directory.GetFiles(logFilePath, "*.txt", System.IO.SearchOption.TopDirectoryOnly);
            List<FileInfo> moveList = new List<FileInfo>();

            for (int i = 0; i < files.Length; i++)
            {
                ReportInfo current = new ReportInfo(files[i]);
                if(DateTime.Now - current.Date > new TimeSpan(24, 0, 0))
                    moveList.Add(new FileInfo(files[i]));
            }

            ArchiveFiles(logFilePath, moveList);
        }
Example #3
0
 static string RegionAndItem(string fullpath)
 {
     ReportInfo info = new ReportInfo(fullpath);
     return info.Region + " - " + info.ItemName;
 }
Example #4
0
 public static int CompareByDate(ReportInfo a, ReportInfo b)
 {
     return DateTime.Compare(a.date, b.date);
 }