Add option to sort the My Queries pane by date
This will let recently used queries float to the top of the list.
-
Brad commented
I created a simple Linq query for this with hyperlinks to quickly open either the File Explorer or open the query in LinqPad. I hope this helps:
void Main()
{
string location = Util.ReadLine("Directory To Search", @"C:\WORK\My Documents\LINQPad Queries\");IEnumerable<FileInfo> Files =
new DirectoryInfo(location).EnumerateDirectories()
.AsParallel()
.SelectMany(di => di.EnumerateFiles("*.linq", SearchOption.AllDirectories));List<FileList> fileList = new List<UserQuery.FileList>();
foreach (FileInfo file in Files)
{
FileList fl = new FileList();
bool finished = false;
do
{
try
{
//$"Processing {file}".Dump();
fl.File_openInExplorer = new Hyperlinq(string.Format("\"file:///{0}\"", Path.GetDirectoryName(file.FullName).Replace("\\", "/")), file.Name.Replace(".linq", ""));
fl.Location_openInLinqpad = new Hyperlinq(() => { Util.Cmd("\"C:\\Program Files\\LINQPad5\\LINQPad.exe\" \"" + file.FullName + "\""); }, file.FullName.Replace(location, "").Replace("\\", " - ").Replace(".linq", ""));
fl.ModifiedDate = file.LastWriteTime;
fl.LastAccessedDate = file.LastAccessTime;
fl.CreatedDate = file.CreationTime;
finished = true;
}
catch (IOException ioe)
{
ioe.Message.Dump();
}
} while (!finished);
fileList.Add(fl);
}
fileList.OrderByDescending(l => l.ModifiedDate).Dump("Recently Updated Files");
}class FileList
{
public Hyperlinq File_openInExplorer { get; set; }
public Hyperlinq Location_openInLinqpad { get; set; }
public DateTime ModifiedDate { get; set; }
public DateTime LastAccessedDate { get; set; }
public DateTime CreatedDate { get; set; }
}