예제 #1
0
        private void _writeLineTS(string txt)
        {
            lock (this)
            {
                try
                {
                    using (StreamWriter wt = new StreamWriter(FilePath, true))
                    {
                        wt.WriteLine(txt);
                        LineCount++;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Writing Failed : " + e.GetMessageRecursive());
                    WritingFailed?.Invoke(this, new EventArgs());
                }
            }

            if (MaxLines != 0 && MaxLinesReached != null)
            {
                if (LineCount >= MaxLines && MaxLines != 0)
                {
                    MaxLinesReached?.Invoke(this, new EventArgs());
                }
            }
        }
예제 #2
0
 private void _writeTS(string txt)
 {
     lock (this)
     {
         try
         {
             using (StreamWriter wt = new StreamWriter(FilePath, true))
             {
                 wt.Write(txt);
             }
         }
         catch (Exception e)
         {
             Console.WriteLine("Writing Failed : " + e.GetMessageRecursive());
             WritingFailed?.Invoke(this, new EventArgs());
         }
     }
 }