Änderung

- Doppelte File Extension wird vermieden
This commit is contained in:
Eugen Höglinger 2021-08-26 15:28:36 +02:00
parent 866676ef53
commit 07a3c208d5
14 changed files with 17 additions and 3 deletions

Binary file not shown.

View File

@ -341,11 +341,25 @@ namespace Eugen.ESystem.IO
{
if (this.path[this.path.Length - 1] != System.IO.Path.DirectorySeparatorChar)
{
fileName = String.Concat(path, System.IO.Path.DirectorySeparatorChar, this.filename, ".log");
if (String.IsNullOrEmpty(System.IO.Path.GetExtension(this.filename)))
{
fileName = String.Concat(path, System.IO.Path.DirectorySeparatorChar, this.filename, ".log");
}
else
{
fileName = String.Concat(path, System.IO.Path.DirectorySeparatorChar, this.filename);
}
}
else
{
fileName = String.Concat(this.path, this.filename, ".log");
if (String.IsNullOrEmpty(System.IO.Path.GetExtension(this.filename)))
{
fileName = String.Concat(this.path, this.filename, ".log");
}
else
{
fileName = String.Concat(this.path, this.filename);
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -135,7 +135,7 @@ namespace Test_LogWriter
logWriter1.WriteMessage("Das ist ein Test");
//Variante 2 - Logdateiname wird angegeben, z.B. 'my_logfile.log'
var logWriter2 = new LogWriter(@"C:\TMP\", "my_logfile2");
var logWriter2 = new LogWriter(@"C:\TMP\", "my_logfile2.log");
logWriter2.WriteMessage("Das ist Test 2");
//Variante 3 - Logdateiname wird angegeben und Header wird geschrieben