public void AddFile(string file)
{
if (FileIsLoaded(file))
{
return;
}
FileInfo fi = new FileInfo(file);
if (!fi.Exists)
{
throw new FileNotFoundException("The file does not exist.", file);
}
string size = (fi.Length / 1024.0).ToString("N2") + " KB";
string path = Path.GetDirectoryName(file);
string name = Path.GetFileName(file);
string modified = fi.LastWriteTime.ToShortDateString() + " " + fi.LastWriteTime.ToShortTimeString();
string[] itemValues = { name, modified, size, path };
ListViewItem item = new ListViewItem(itemValues);
listViewActiveFiles.Items.Insert(0, item);
listViewActiveFiles.Sort();
}