Initial commit: Add ShadowStream media application with file scanning and classification
This commit is contained in:
43
ShadowStream/LogHelper/LogHelper.cs
Normal file
43
ShadowStream/LogHelper/LogHelper.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
//namespace Scheckenrennen_GUI.modules
|
||||
//Quinn Grafe Schnecken rennen
|
||||
namespace ShadowStream.LogHelper
|
||||
{
|
||||
public class LogHelper
|
||||
{
|
||||
private List<string> logEntries;
|
||||
|
||||
public LogHelper()
|
||||
{
|
||||
logEntries = new List<string>();
|
||||
}
|
||||
|
||||
public void Log(string entry)
|
||||
{
|
||||
AddEntry($"[{DateTime.Now:HH:mm:ss}] [INFO ] {entry}");
|
||||
}
|
||||
|
||||
public void Warn(string entry)
|
||||
{
|
||||
AddEntry($"[{DateTime.Now:HH:mm:ss}] [WARN ] {entry}");
|
||||
}
|
||||
public void Error(string entry)
|
||||
{
|
||||
AddEntry($"[{DateTime.Now:HH:mm:ss}] [ERROR] {entry}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void AddEntry(string entry)
|
||||
{
|
||||
logEntries.Add(entry);
|
||||
}
|
||||
|
||||
public List<string> GetEntries()
|
||||
{
|
||||
return logEntries;
|
||||
}
|
||||
}
|
||||
}
|
13
ShadowStream/LogHelper/LogWindow.xaml
Normal file
13
ShadowStream/LogHelper/LogWindow.xaml
Normal file
@@ -0,0 +1,13 @@
|
||||
<!-- Quinn Grafe Schencken rennen-->
|
||||
<Window x:Class="ModuleManager.LogWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ModuleManager"
|
||||
mc:Ignorable="d"
|
||||
Title="LogWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
<TextBox Foreground="Gray" Background="Black" FontFamily="consolas" Name="LogBox" IsReadOnly="True"></TextBox>
|
||||
</Grid>
|
||||
</Window>
|
24
ShadowStream/LogHelper/LogWindow.xaml.cs
Normal file
24
ShadowStream/LogHelper/LogWindow.xaml.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
//Quinn Grafe Schnecken rennen.
|
||||
namespace ModuleManager;
|
||||
public partial class LogWindow : Window
|
||||
{
|
||||
public LogWindow(List<string> logText)
|
||||
{
|
||||
InitializeComponent();
|
||||
foreach (var s in logText)
|
||||
{
|
||||
LogBox.Text += s + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddLogEntry(string logEntry)
|
||||
{
|
||||
LogBox.Text += logEntry + Environment.NewLine;
|
||||
// Force scroll to the bottom
|
||||
LogBox.ScrollToEnd();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user