75 lines
2.0 KiB
C#
75 lines
2.0 KiB
C#
using StgSharp.Geometries;
|
|
using System;
|
|
using System.IO;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace StgSharp
|
|
{
|
|
internal enum LogType
|
|
{
|
|
Error,
|
|
Warning,
|
|
Info,
|
|
InfoError,
|
|
InfoWarning,
|
|
}
|
|
|
|
internal static unsafe partial class internalIO
|
|
{
|
|
|
|
internal const string SSGC_libname =
|
|
"StgSharpGraphic";
|
|
|
|
internal const string SSG_errorlog =
|
|
"SSG_errorlog.log";
|
|
|
|
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
|
{
|
|
if (!File.Exists(internalIO.SSG_errorlog))
|
|
{
|
|
FileStream stream = File.Create(internalIO.SSG_errorlog);
|
|
stream.Close();
|
|
}
|
|
|
|
using (StreamWriter logStream = File.AppendText(SSG_errorlog))
|
|
{
|
|
logStream.WriteLine(beforeTime);
|
|
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
|
logStream.WriteLine(logLine);
|
|
}
|
|
}
|
|
|
|
internal static void InternalWriteLog(string logLine, LogType logType)
|
|
{
|
|
if (!File.Exists(internalIO.SSG_errorlog))
|
|
{
|
|
FileStream stream = File.Create(internalIO.SSG_errorlog);
|
|
stream.Close();
|
|
}
|
|
|
|
using (StreamWriter logStream = File.AppendText(SSG_errorlog))
|
|
{
|
|
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
|
|
|
logStream.WriteLine(logLine);
|
|
}
|
|
}
|
|
|
|
internal static void InternalAppendLog(string log)
|
|
{
|
|
if (!File.Exists(internalIO.SSG_errorlog))
|
|
{
|
|
FileStream stream = File.Create(internalIO.SSG_errorlog);
|
|
stream.Close();
|
|
}
|
|
|
|
using (StreamWriter logStream = File.AppendText(SSG_errorlog))
|
|
{
|
|
logStream.WriteLine(log);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|