Kandis exporter um parametern erweitert
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@@ -9,30 +11,76 @@ namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||
{
|
||||
public static class ExporterHelper
|
||||
{
|
||||
public static Dictionary<string, int> Exporters = new Dictionary<string, int>()
|
||||
public static Dictionary<string, int> LineSize = new Dictionary<string, int>()
|
||||
{
|
||||
{ "KANSCH4.0",557 },
|
||||
{ "KANSCH6.0",2041 },
|
||||
{ "KANHAL4.0",530 },
|
||||
{ "KANHAL6.0",2167 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
internal abstract class KANDIS_Exporter : IDisposable
|
||||
{
|
||||
public enum kType
|
||||
{
|
||||
HALTUNG,
|
||||
SCHACHT
|
||||
}
|
||||
|
||||
private StreamWriter sw;
|
||||
char[] zeile;
|
||||
|
||||
protected string Zeile => new string(zeile);
|
||||
|
||||
public KANDIS_Exporter(string filename, int maxzeilen)
|
||||
public KANDIS_Exporter(string filename, EExportType exportType, kType kType)
|
||||
{
|
||||
string version = string.Empty;
|
||||
switch (kType)
|
||||
{
|
||||
case kType.HALTUNG:
|
||||
{
|
||||
switch (exportType)
|
||||
{
|
||||
case EExportType.KANDIS4: version = "KANHAL4.0"; break;
|
||||
case EExportType.KANDIS6: version = "KANHAL6.0"; break;
|
||||
default: throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case kType.SCHACHT:
|
||||
{
|
||||
switch (exportType)
|
||||
{
|
||||
case EExportType.KANDIS4: version = "KANSCH4.0"; break;
|
||||
case EExportType.KANDIS6: version = "KANSCH6.0"; break;
|
||||
default: throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ExporterHelper.LineSize.ContainsKey(version))
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
int maxzeilen = ExporterHelper.LineSize[version];
|
||||
|
||||
sw = new StreamWriter(filename, append: false, Encoding.GetEncoding("ISO-8859-1"));
|
||||
|
||||
zeile = new char[1476];
|
||||
WriteHeader(version);
|
||||
zeile = new char[maxzeilen];
|
||||
ClearLine();
|
||||
}
|
||||
|
||||
private void WriteHeader(string header)
|
||||
{
|
||||
sw.WriteLine(header);
|
||||
sw.Flush();
|
||||
}
|
||||
|
||||
private void ClearLine()
|
||||
{
|
||||
for (int i = 0; i < zeile.Length; i++)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,7 +10,7 @@ namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||
{
|
||||
internal class KANDIS_HALTUNG60 : KANDIS_Exporter
|
||||
{
|
||||
public KANDIS_HALTUNG60(string filename, List<Kanal> kanaele) : base(filename+".hal", ExporterHelper.Exporters["KANHAL6.0"])
|
||||
public KANDIS_HALTUNG60(string filename, List<Kanal> kanaele) : base(filename+".hal", EExportType.KANDIS6, kType.HALTUNG)
|
||||
{
|
||||
foreach(Kanal haltung in kanaele)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
|
||||
namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||
{
|
||||
internal class KANDIS_SCHACHT60 : KANDIS_Exporter
|
||||
{
|
||||
public KANDIS_SCHACHT60(string filename,List<Schacht> schaechte) : base(filename+".sch", ExporterHelper.Exporters["KANSCH6.0"])
|
||||
public KANDIS_SCHACHT60(string filename,List<Schacht> schaechte) : base(filename+".sch", EExportType.KANDIS6, kType.SCHACHT)
|
||||
{
|
||||
|
||||
foreach(Schacht schacht in schaechte)
|
||||
|
||||
Reference in New Issue
Block a user