public void CheckLog(string Log)
{
if (File.Exists(LogFile))
{
WriteLog(Log);
}
else
{
CreateLog();
WriteLog(Log);
}
}
private void CreateLog()
{
StreamWriter SW;
SW = File.CreateText(LogFile);
SW.WriteLine("Log created at: " +
DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss"));
SW.Close();
}
private void WriteLog(string Log)
{
using (StreamWriter SW = File.AppendText(LogFile))
{
SW.WriteLine(Log);
SW.Close();
}
}