-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.cs
46 lines (37 loc) · 973 Bytes
/
Logger.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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Game.Loggers
{
class Logger2
{
public void CreateNewLog()
{
int i = Increment();
log = String.Format("C:/Games/log/{0}.txt", i);
}
private static string log;
public void Write(String n)
{
using (StreamWriter fs = new StreamWriter(log,true))
{
fs.WriteLine(n);
}
}
private int Increment()
{
int _return;
StreamReader sr = new StreamReader("C:/Games/log/inc.txt");
_return = int.Parse(sr.ReadLine());
sr.Close();
StreamWriter sw = new StreamWriter("C:/Games/log/inc.txt");
_return += 1;
sw.WriteLine(_return);
sw.Close();
return _return;
}
}
}