I'm making my own type of Trial mode and I was wondering if there is a way to check if the time information from the text file is the same as the Date.Today
?
private void Trial()
{
DateTime saveNow = DateTime.Today;
DateTime expiryDate = DateTime.Today.AddDays(30);
string fileName = System.IO.Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "trailexample.txt");
if (!File.Exists(fileName))
{
// Write the string to a file.
System.IO.StreamWriter file = new System.IO.StreamWriter(fileName);
file.WriteLine(saveNow);
file.WriteLine(expireDate);
file.Close();
}
else if (File.Exists(fileName))
{
var lastLine = File.ReadLines(fileName).Last();
If (saveNow == LastLine) // This doesn't work of course but kinda the Idea. This is what I need help with.
{
messagebox.Show("Your trial is over");
}
}
}