STAT, AGNT, NAME fertig, fixed package versions

This commit is contained in:
Daniel Schick 2022-04-29 09:51:53 +02:00
parent d223c0921b
commit a7705ed8f3
9 changed files with 90 additions and 22 deletions

View File

@ -82,9 +82,7 @@
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
<ManifestCertificateThumbprint>94D98790E3B6C4CC9F4B57C8FD305E3225894DF8</ManifestCertificateThumbprint>
</PropertyGroup>
@ -164,8 +162,8 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SQLite, Version=1.0.115.5, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.5\lib\net46\System.Data.SQLite.dll</HintPath>
<Reference Include="System.Data.SQLite, Version=1.0.115.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
@ -952,12 +950,12 @@
<PropertyGroup>
<PostBuildEvent>"C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool" sign /f $(ProjectDir)\..\misc\codesigning.pfx /p t5bj2dk9ifdIWBPhPra4U $(TargetPath)</PostBuildEvent>
</PropertyGroup>
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.5\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.5\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.5\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.5\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.115.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -98,7 +98,7 @@ namespace ENI2.Excel
if ((message.MessageNotificationClass == Message.NotificationClass.SERV) && notificationClasses.Contains(Message.NotificationClass.SERV))
{ if (ScanSERV(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.STAT) && notificationClasses.Contains(Message.NotificationClass.STAT))
{ if (ScanSTAT(message, messageCore, messages, reader)) ExcelReader.SaveMessage(message); continue; }
{ if (ScanSTAT(message, messageCore, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.STO) && notificationClasses.Contains(Message.NotificationClass.STO))
{ if (ScanSTO(message, reader)) ExcelReader.SaveMessage(message); continue; }
if ((message.MessageNotificationClass == Message.NotificationClass.TIEFA) && notificationClasses.Contains(Message.NotificationClass.TIEFA))
@ -162,9 +162,46 @@ namespace ENI2.Excel
throw new NotImplementedException();
}
private static bool ScanSTAT(Message message, MessageCore messageCore, List<Message> messages, ExcelReader reader)
private static bool ScanSTAT(Message statMessage, MessageCore core, ExcelReader reader)
{
throw new NotImplementedException();
if (statMessage.Elements.Count == 0)
{
STAT newSTAT = new STAT();
newSTAT.MessageHeader = statMessage;
statMessage.Elements.Add(newSTAT);
}
STAT stat = statMessage.Elements[0] as STAT;
stat.ShipName = reader.ReadCellAsText("ship", "C8");
stat.CallSign = reader.ReadCellAsText("ship", "C9");
core.IMO = reader.ReadCellAsText("ship", "C10");
core.ENI = reader.ReadCellAsText("ship", "C11");
DBManager.Instance.Save(core);
stat.MMSINumber = reader.ReadCellAsText("ship", "C12");
stat.Flag = reader.ReadCellAsText("ship", "C13");
stat.LengthOverall_MTR = reader.ReadCellAsDecimal("ship", "C14");
stat.Beam_MTR = reader.ReadCellAsDecimal("ship", "C15");
stat.GrossTonnage = (int?) reader.ReadCellAsDecimal("ship", "C16");
stat.PortOfRegistry = reader.ReadCellAsText("ship", "C17");
stat.InmarsatCallNumber = string.Format("{0} {1} {2} {3} {4}",
reader.ReadCellAsText("ship", "C18"),
reader.ReadCellAsText("ship", "C19"),
reader.ReadCellAsText("ship", "C20"),
reader.ReadCellAsText("ship", "C21"),
reader.ReadCellAsText("ship", "C22")
).Trim();
stat.ShipType = reader.ReadCellAsText("ship", "C23");
stat.TransportMode = reader.ReadCellAsText("ship", "C24");
stat.ISMCompanyName = reader.ReadCellAsText("ship", "C26");
stat.ISMCompanyId = reader.ReadCellAsText("ship", "C27");
string street = reader.ReadCellAsText("ship", "C28");
string number = reader.ReadCellAsText("ship", "C29");
stat.ISMCompanyStreetAndNumber = string.Format("{0} {1}", street, number).Trim();
stat.ISMCompanyPostalCode = reader.ReadCellAsText("ship", "C30");
stat.ISMCompanyCity = reader.ReadCellAsText("ship", "C31");
stat.ISMCompanyCountry = reader.ReadCellAsText("ship", "C32");
return true;
}
private static bool ScanSERV(Message message, ExcelReader reader)

View File

@ -38,7 +38,7 @@ namespace ENI2.Excel
this.InitNameFields();
// Determine if this is a Dakosy or BSMD Sheet
_sheetType = (_nameDict.Count > 0) ? SheetTypeEnum.BSMD : SheetTypeEnum.DAKOSY;
_sheetType = (_nameDict.Count > 10) ? SheetTypeEnum.BSMD : SheetTypeEnum.DAKOSY;
}
public SheetTypeEnum SheetType { get { return _sheetType; } }
@ -567,13 +567,46 @@ namespace ENI2.Excel
{
Worksheet workSheet = (Worksheet) _workBook.Worksheets[sheetName];
string result = workSheet.Range[range].Text.ToString();
return result;
}
catch(Exception e)
{
_log.Warn(e.Message);
}
return null;
}
internal double? ReadCellAsDecimal(string sheetName, string range)
{
try
{
double? result = null;
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName];
var val = workSheet.Range[range].Value;
if (val is double) result = val;
if (val is string)
{
if (double.TryParse(val, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite,
CultureInfo.InvariantCulture, out double tmpDouble))
result = tmpDouble;
if (result == null)
{
if (double.TryParse(val, out tmpDouble)) // current language style (==GER, mit , statt .)
result = tmpDouble;
}
}
if ((result == null) && (val != null))
{
double tmpDouble2 = val[1, 1];
result = tmpDouble2;
}
return result;
}
catch (Exception e)
{
_log.Warn(e.Message);
}
return null;
}

View File

@ -8,6 +8,6 @@ Sample license text.
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1000" targetFramework="net452" />
<package id="PDFsharp-MigraDoc-gdi" version="1.50.5147" targetFramework="net452" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.115.5" targetFramework="net48" />
<package id="System.Data.SQLite.Core" version="1.0.115.5" targetFramework="net48" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.115.0" targetFramework="net48" />
<package id="System.Data.SQLite.Core" version="1.0.115.0" targetFramework="net48" />
</packages>

View File

@ -46,8 +46,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\ENI2\packages\log4net.2.0.13\lib\net45\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\ENI2\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data.DataSetExtensions" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.13" targetFramework="net452" />
<package id="log4net" version="2.0.14" targetFramework="net48" />
</packages>

View File

@ -83,8 +83,8 @@
<CodeAnalysisRuleSet>..\code.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\ENI2\packages\log4net.2.0.13\lib\net45\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\ENI2\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\ENI2\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.13" targetFramework="net45" />
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
</packages>