I have a log which has information such as:
Jane opened the video file at 9/10/2015 7:30 AM
Bob opened the video file at 9/11/2015 7:38 AM
Dave opened the video file at 9/12/2015 10:30 AM
I'm looking to filter this text file to only the current date and users who have opened the video
file show, and create a new string like so:
Dave opened the video file at 9/12/2015 10:30 AM
Then, compare this to a list of users to see who hasn't who opened the file today, so I would get notified that Jane
and Bob
haven't opened the file yet today.
Here's what I've tried:
private void refreshbtn_Click(object sender, EventArgs e)
{
string currentdate = DateTime.Now.ToShortDateString();
string[] logfile = File.ReadAllLines(@"C:\log.txt");
string[] users = {"Jane", "Bob", "Dave"};
if (!logfile.Contains(currentdate))
{
logfile.Where(val => val != currentdate).ToArray();
if (logfile.Contains(users.ToString()))
{
string x = users.ToString();
richTextBox1.Text = x;
}
}
}
Is anyone able to spot where I'm going wrong and/or explain to me what would be the correct process?