Subversion Repositories Code-Repo

Rev

Rev 64 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
64 Kevin 1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.IO;
6
using System.Windows.Forms;
7
 
8
namespace SWAT_Office_App
9
{
10
    class Debug
11
    {
12
        private static string debugLocation = "StatusLog.txt";
13
        public static void appendText(string text)
14
        {
15
            // Appends passed string into Debug.txt
16
            using (StreamWriter sw = File.AppendText(debugLocation))
17
            {
18
                sw.Write("[" + DateTime.Now.ToLongDateString() + " | " + DateTime.Now.ToLongTimeString() + "] -- ");
19
                sw.Write(text + "\r\n");
20
                sw.Flush();
21
            }
22
        }
23
        public static void createNewDebugTxt()
24
        {
25
            // Deletes old Debug.txt and creates a new one
26
            if (File.Exists(debugLocation))
27
            {
28
                File.Delete(debugLocation);
29
                File.Create(debugLocation);
30
            }
31
        }
32
        public static void startNewSession()
33
        {
34
            using (StreamWriter sw = File.AppendText(debugLocation))
35
            {
36
                sw.Write("-- New Session --\r\n");
37
                sw.Flush();
38
            }
39
        }
40
    }
41
}