mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-27 09:01:48 +01:00
38 lines
883 B
C#
38 lines
883 B
C#
|
using System.Collections.Generic;
|
|||
|
using System.IO;
|
|||
|
|
|||
|
namespace DS4WinWPF
|
|||
|
{
|
|||
|
public class LogWriter
|
|||
|
{
|
|||
|
private string filename;
|
|||
|
private List<LogItem> logCol;
|
|||
|
|
|||
|
public LogWriter(string filename, List<LogItem> col)
|
|||
|
{
|
|||
|
this.filename = filename;
|
|||
|
logCol = col;
|
|||
|
}
|
|||
|
|
|||
|
public void Process()
|
|||
|
{
|
|||
|
List<string> outputLines = new List<string>();
|
|||
|
foreach(LogItem item in logCol)
|
|||
|
{
|
|||
|
outputLines.Add($"{item.Datetime}: {item.Message}");
|
|||
|
}
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
StreamWriter stream = new StreamWriter(filename);
|
|||
|
foreach(string line in outputLines)
|
|||
|
{
|
|||
|
stream.WriteLine(line);
|
|||
|
}
|
|||
|
stream.Close();
|
|||
|
}
|
|||
|
catch { }
|
|||
|
}
|
|||
|
}
|
|||
|
}
|