mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 01:35:32 +00:00
Moved unused code into Achive
This commit is contained in:
52
Archive/HaInformator/Logger.cs
Normal file
52
Archive/HaInformator/Logger.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HaInformator
|
||||
{
|
||||
|
||||
public sealed class Logger
|
||||
{
|
||||
private static StringBuilder _sb;
|
||||
private static string _filepath = System.IO.Path.GetTempFileName();
|
||||
private static TextBox _textbox;
|
||||
|
||||
public Logger() {
|
||||
_sb = new StringBuilder();
|
||||
}
|
||||
|
||||
public Logger(TextBox box)
|
||||
{
|
||||
_textbox = box;
|
||||
_sb = new StringBuilder();
|
||||
}
|
||||
|
||||
public static void AddTextBox(TextBox box)
|
||||
{
|
||||
_textbox = box;
|
||||
}
|
||||
|
||||
public static void Log(string _msg)
|
||||
{
|
||||
_sb.Append(_msg);
|
||||
_textbox.AppendText(_msg);
|
||||
}
|
||||
|
||||
public static void Save(string filepath)
|
||||
{
|
||||
try
|
||||
{
|
||||
_filepath = filepath;
|
||||
File.WriteAllText(_filepath, _sb.ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
File.WriteAllText(System.IO.Path.GetTempFileName(), _sb.ToString() + "\n" + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user