Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Essentials
- public string LogPath = @"data\Logs.txt";
- public void Print(string String)
- {
- File.AppendAllText(Rooter(LogPath), String.Replace("\r", ""));
- Console.Write(String);
- }
- public void Print(string String, bool DoTag)
- {
- if (DoTag == true) { File.AppendAllText(Rooter(LogPath), Tag(String.Replace("\r", ""))); Console.Write(Tag(String)); }
- else { File.AppendAllText(Rooter(LogPath), String.Replace("\r", "")); Console.Write(String); }
- }
- public void PrintLine(string String)
- {
- File.AppendAllText(Rooter(LogPath), String.Replace("\r", "") + "\n");
- Console.WriteLine(String);
- }
- public void PrintLine(string String, bool DoTag)
- {
- if (DoTag == true) { File.AppendAllText(Rooter(LogPath), Tag(String.Replace("\r", "") + "\n")); Console.WriteLine(Tag(String)); }
- else { File.AppendAllText(Rooter(LogPath), String.Replace("\r", "") + "\n"); Console.WriteLine(String); }
- }
- public void PrintLine()
- {
- File.AppendAllText(Rooter(LogPath), "\n");
- Console.WriteLine();
- }
- public void PrintLines(string[] StringArray)
- {
- foreach (string String in StringArray)
- {
- File.AppendAllText(Rooter(LogPath), String.Replace("\r", "") + "\n");
- Console.WriteLine(String);
- }
- }
- public void PrintLines(string[] StringArray, bool DoTag)
- {
- foreach (string String in StringArray)
- {
- if (DoTag == true) { File.AppendAllText(Rooter(LogPath), Tag(String.Replace("\r", "") + "\n")); Console.WriteLine(Tag(String)); }
- else { File.AppendAllText(Rooter(LogPath), String.Replace("\r", "") + "\n"); Console.WriteLine(String); }
- }
- }
- public string[] ReadData(string DataDir)
- {
- if (System.IO.File.Exists(DataDir) == true)
- {
- return System.IO.File.ReadAllLines(DataDir).ToArray();
- }
- else
- return null;
- }
- public string Rooter(string RelPath)
- {
- return System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), RelPath);
- }
- public string Tag(string Text)
- {
- return "[" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "] " + Text;
- }
- public string Tag()
- {
- return "[" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "] ";
- }
- #endregion
Add Comment
Please, Sign In to add comment