// Decompiled with JetBrains decompiler
// Type: SE0085.CTdB.LogWriter
// Assembly: SE0085CTdB, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null
// MVID: F67560B6-58CB-4471-AAC9-80007CA3AF52
// Assembly location: C:\Users\Abishek\Downloads\SchneiderCode_Breaker_09292016\Breaker Schedule-20160930T014118Z\Breaker Schedule\Solution for gathering Breaker Data\DMS\bin\Debug\SE0085CTdB.dll

using Microsoft.VisualBasic.CompilerServices;
using System;
using System.IO;

//namespace SE0085.CTdB
namespace FAS_LIB
{
  public class LogWriter
  {
    private StreamWriter _LogWrt;

    public LogWriter(string LogFile)
    {
      try
      {
        this._LogWrt = new StreamWriter(LogFile, true);
        this._LogWrt.Write("\r\nLog Entry : ");
      }
      catch (Exception ex)
      {
        ProjectData.SetProjectError(ex);
        ProjectData.ClearProjectError();
      }
    }

    ~LogWriter()
    {
      try
      {
        this.logClose();
      }
      catch (Exception ex)
      {
        ProjectData.SetProjectError(ex);
        ProjectData.ClearProjectError();
      }
      // ISSUE: explicit finalizer call
      //base.Finalize();
    }

    public void logData(string logMessage)
    {
      try
      {
        this._LogWrt.Write("{0} {1}", (object) DateTime.Now.ToLongTimeString(), (object) DateTime.Now.ToLongDateString());
        this._LogWrt.WriteLine("  :{0}", (object) logMessage);
        this._LogWrt.Flush();
        Console.Write("{0} {1}", (object) DateTime.Now.ToLongTimeString(), (object) DateTime.Now.ToLongDateString());
        Console.WriteLine("  :{0}", (object) logMessage);
      }
      catch (Exception ex)
      {
        ProjectData.SetProjectError(ex);
        ProjectData.ClearProjectError();
      }
    }

    public void logDataEOL()
    {
      try
      {
        this._LogWrt.WriteLine("EOL------------------ {0} {1} ------------------EOL", (object) DateTime.Now.ToLongTimeString(), (object) DateTime.Now.ToLongDateString());
        this._LogWrt.Flush();
      }
      catch (Exception ex)
      {
        ProjectData.SetProjectError(ex);
        ProjectData.ClearProjectError();
      }
    }

    public void logClose()
    {
      try
      {
        this._LogWrt.Flush();
        this._LogWrt.Close();
        this._LogWrt.Dispose();
        this._LogWrt = (StreamWriter) null;
      }
      catch (Exception ex)
      {
        ProjectData.SetProjectError(ex);
        ProjectData.ClearProjectError();
      }
    }
  }
}
