Schnittstelle um logging erweitert

This commit is contained in:
2023-06-27 12:41:47 +02:00
parent b22b9855fa
commit 8b5d706db4
10 changed files with 43 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
using SewerStammGen.Shared.Enum;
using SewerStammGen.Shared.Contracts;
using SewerStammGen.Shared.Enum;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -32,11 +33,13 @@ namespace WWTech_KanalSchnittstelle.Exporter.Kandis
private StreamWriter sw;
char[] zeile;
protected IWWLog Logger;
protected string Zeile => new string(zeile);
public KANDIS_Exporter(string filename, EExportType exportType, kType kType)
public KANDIS_Exporter(string filename, EExportType exportType, kType kType, IWWLog Logger)
{
this.Logger = Logger;
string version = string.Empty;
switch (kType)
{
@@ -104,9 +107,11 @@ namespace WWTech_KanalSchnittstelle.Exporter.Kandis
uint length = (ende+1) - start;
if(content.Length > length)
{
content = content.Substring(0, (int)length);
//Debugger.Break();
//throw new Exception("Inhalt des Feldes ist zu lang");
string newcontent = content.Substring(0,(int)length);
Logger.Log(string.Format("Inhalt {0} des Feldes war zu lang. Feld wird auf {1} stellen gekürzt." +
"Neue Inhalt lautet: {2}",content,length,newcontent));
content = newcontent;
}
int counter = 0;