Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
53 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 DebugText
11
    {
12
        private static string debugLocation = "StatusLog.txt";
13
        public static void appendText(string text)
14
        {
15
            // Appends passed string into Debug.txt
16
            if (!File.Exists(debugLocation))
17
                File.Create(debugLocation);
18
            using (StreamWriter sw = File.AppendText(debugLocation))
19
            {
20
                sw.Write("[" + DateTime.Now.ToLongDateString() + " | " + DateTime.Now.ToLongTimeString() + "] -- ");
21
                sw.Write(text + "\r\n");
22
                sw.Flush();
23
            }
24
        }
25
        public static void createNewDebugTxt()
26
        {
27
            // Deletes old Debug.txt and creates a new one
28
            if (File.Exists(debugLocation))
29
            {
30
                File.Delete(debugLocation);
31
                File.Create(debugLocation);
32
            }
33
        }
34
        public static void startNewSession()
35
        {
36
            if (!File.Exists(debugLocation))
37
                File.Create(debugLocation);
38
            using (StreamWriter sw = File.AppendText(debugLocation))
39
            {
40
                sw.Write("-- New Session --\r\n");
41
                sw.Flush();
42
            }
43
        }
44
    }
45
}