public void PartitionByDate() { var ages = new Dictionary <int, string>() { [0] = "Recent", [1] = "A Bit Ago", [2] = "A While Ago" }; var partitions = FileLinq.PartitionBy( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), 3, fi => fi.LastWriteTime).Select(grp => new { Text = $"{ages[grp.Key]}, from {grp.Min(fi => fi.LastWriteTime):M/d/yy} to {grp.Max(fi => fi.LastWriteTime):M/d/yy}", Files = grp }); }
public void GetLargest() { var largest = FileLinq.GetLargest(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), 5); Assert.IsTrue(largest.Count() == 5); }
public void GetRecentByExtension() { var recentByExt = FileLinq.GetRecentByExtension(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), 5); Assert.IsTrue(recentByExt.All(ext => ext.Count() <= 5)); }
public void GetFileInfosLimitCount() { var files = FileLinq.GetFileInfosLimited(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), 10); Assert.IsTrue(files.Count() == 10); }
public void GetFileInfosAll() { var files = FileLinq.GetFileInfosAll(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); Assert.IsTrue(files.Any()); }
public static IEnumerable <Mp3Info> GetMp3InfoLimitedWhere(string path, Func <Mp3Info, bool> predicate, int limit = 0) => FileLinq.GetFileInfosLimited(path, limit, Mp3Filter) .Select(fileInfo => new Mp3Info(fileInfo)) .Where(predicate);
public static IEnumerable <Mp3Info> GetMp3InfoLimited(string path, int limit = 0) => FileLinq.GetFileInfosLimited(path, limit, Mp3Filter) .Select(fileInfo => new Mp3Info(fileInfo));
public static IEnumerable <Mp3Info> GetMp3InfoAll(string path) => FileLinq.GetFileInfosAll(path, Mp3Filter) .Select(fileInfo => new Mp3Info(fileInfo));