-
Notifications
You must be signed in to change notification settings - Fork 0
/
ForecastLog.cs
49 lines (45 loc) · 1.32 KB
/
ForecastLog.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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using RWCustom;
using UnityEngine;
public static class ForecastLog
{
public static void ClearLog()
{
File.WriteAllText(Custom.RootFolderDirectory() + Path.DirectorySeparatorChar.ToString() + "ForecastLog.txt", "[FORECAST LOGGER] - " + DateTime.Now.ToString());
}
public static void Log(string text)
{
if (RainWorld.ShowLogs)
{
string path = Custom.RootFolderDirectory() + Path.DirectorySeparatorChar.ToString() + "ForecastLog.txt";
if (!File.Exists(path))
{
ClearLog();
}
File.AppendAllText(path, "\n" + text);
}
}
public static void LogOnce(string text)
{
if (RainWorld.ShowLogs)
{
string path = Custom.RootFolderDirectory() + Path.DirectorySeparatorChar.ToString() + "ForecastLog.txt";
if (!File.Exists(path))
{
ClearLog();
}
if (!onceText.Contains(text))
{
File.AppendAllText(path, "\n" + text);
onceText.Add(text);
}
}
}
public static List<string> onceText = new List<string>();
}