using System;
using System.IO;

namespace LauncherIcarus.Daemon
{
    public class Logger
    {
        public static void WriteLog(string strLog)
        {
            string path = "./Logger";
            Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName, "Top-Level Folder");
            Directory.CreateDirectory(path);
            string str = path + "/Log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".txt";
            FileInfo fileInfo = new FileInfo(str);
            DirectoryInfo directoryInfo = new DirectoryInfo(fileInfo.DirectoryName);
            if (!directoryInfo.Exists)
                directoryInfo.Create();
            StreamWriter streamWriter = new StreamWriter(fileInfo.Exists
                ? (Stream) new FileStream(str, FileMode.Append)
                : (Stream) fileInfo.Create());
            streamWriter.WriteLine("\r\nLog Entry : ");
            streamWriter.WriteLine("{0} {1}", (object) DateTime.Now.ToLongTimeString(),
                (object) DateTime.Now.ToLongDateString());
            streamWriter.WriteLine("  :");
            streamWriter.WriteLine("  :{0}", (object) strLog);
            streamWriter.WriteLine("-------------------------------");
            streamWriter.Close();
        }
    }
}