Merge branch 'feature/new_transmitter_tool' into develop
This commit is contained in:
commit
a3f2e4f7b3
@ -274,14 +274,15 @@ namespace SendNSWMessageService
|
||||
|
||||
}
|
||||
|
||||
// external processing for HIS-Nord
|
||||
if (bsmd.hisnord.transmitter.Transmit())
|
||||
// HIS-Nord --------------------------------------------------
|
||||
|
||||
if (bsmd.hisnord.transmitter.Transmit()) // run process (transmit+receive)
|
||||
{
|
||||
bsmd.hisnord.Request.ReadResponseFiles();
|
||||
bsmd.hisnord.Response.ReadAnswers();
|
||||
}
|
||||
|
||||
// external processing for dbh
|
||||
// dbh -------------------------------------------------------
|
||||
|
||||
bsmd.dbh.MessageController.SendAndReceive();
|
||||
|
||||
foreach (MessageCore core in DBManager.Instance.GetMessageCoresWithNSWStatusFlag())
|
||||
|
||||
@ -40,8 +40,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.16" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.17" targetFramework="net48" />
|
||||
</packages>
|
||||
@ -40,8 +40,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
@ -52,8 +52,8 @@
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WinSCPnet, Version=1.15.0.14890, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WinSCP.6.3.2\lib\net40\WinSCPnet.dll</HintPath>
|
||||
<Reference Include="WinSCPnet, Version=1.15.0.14955, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WinSCP.6.3.4\lib\net40\WinSCPnet.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -93,12 +93,12 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\WinSCP.6.3.2\build\WinSCP.targets" Condition="Exists('..\packages\WinSCP.6.3.2\build\WinSCP.targets')" />
|
||||
<Import Project="..\packages\WinSCP.6.3.4\build\WinSCP.targets" Condition="Exists('..\packages\WinSCP.6.3.4\build\WinSCP.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\WinSCP.6.3.2\build\WinSCP.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WinSCP.6.3.2\build\WinSCP.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\WinSCP.6.3.4\build\WinSCP.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WinSCP.6.3.4\build\WinSCP.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.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.16" targetFramework="net48" />
|
||||
<package id="WinSCP" version="6.3.2" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.17" targetFramework="net48" />
|
||||
<package id="WinSCP" version="6.3.4" targetFramework="net48" />
|
||||
</packages>
|
||||
@ -25,6 +25,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<CodeAnalysisRuleSet>..\code.ruleset</CodeAnalysisRuleSet>
|
||||
<UseWinFormsOutOfProcDesigner>False</UseWinFormsOutOfProcDesigner>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@ -33,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseWinFormsOutOfProcDesigner>False</UseWinFormsOutOfProcDesigner>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
@ -50,6 +52,7 @@
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>..\code.ruleset</CodeAnalysisRuleSet>
|
||||
<UseWinFormsOutOfProcDesigner>False</UseWinFormsOutOfProcDesigner>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -61,6 +64,7 @@
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>..\code.ruleset</CodeAnalysisRuleSet>
|
||||
<UseWinFormsOutOfProcDesigner>False</UseWinFormsOutOfProcDesigner>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
@ -70,6 +74,7 @@
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<UseWinFormsOutOfProcDesigner>False</UseWinFormsOutOfProcDesigner>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug 64|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -81,10 +86,11 @@
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>..\code.ruleset</CodeAnalysisRuleSet>
|
||||
<UseWinFormsOutOfProcDesigner>False</UseWinFormsOutOfProcDesigner>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\ENI2\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.17\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.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.17" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||
</packages>
|
||||
@ -38,8 +38,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.16" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.17" targetFramework="net48" />
|
||||
</packages>
|
||||
20
bsmd.hisnord/Properties/Settings.Designer.cs
generated
20
bsmd.hisnord/Properties/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace bsmd.hisnord.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
@ -50,15 +50,6 @@ namespace bsmd.hisnord.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Transmitter-Tool\\RESULTS")]
|
||||
public string ResultDir {
|
||||
get {
|
||||
return ((string)(this["ResultDir"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Transmitter-Tool\\ANSWERS")]
|
||||
@ -94,5 +85,14 @@ namespace bsmd.hisnord.Properties {
|
||||
return ((string)(this["TransmitterRoot"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Transmitter-Tool\\archive")]
|
||||
public string OutputArchiveDir {
|
||||
get {
|
||||
return ((string)(this["OutputArchiveDir"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,9 +11,6 @@
|
||||
<Setting Name="Transmitter" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Transmitter-Tool\client.bat</Value>
|
||||
</Setting>
|
||||
<Setting Name="ResultDir" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Transmitter-Tool\RESULTS</Value>
|
||||
</Setting>
|
||||
<Setting Name="AnswerDir" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Transmitter-Tool\ANSWERS</Value>
|
||||
</Setting>
|
||||
@ -26,5 +23,8 @@
|
||||
<Setting Name="TransmitterRoot" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\</Value>
|
||||
</Setting>
|
||||
<Setting Name="OutputArchiveDir" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Transmitter-Tool\archive</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -10,7 +10,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using bsmd.database;
|
||||
@ -21,7 +20,7 @@ namespace bsmd.hisnord
|
||||
{
|
||||
private static readonly ILog _log = LogManager.GetLogger(typeof(Request));
|
||||
private static Dictionary<Guid, ReportingParty> _reportingPartyDict = null;
|
||||
private static readonly Dictionary<MessageCore, Dictionary<Message, string>> coreFilenameDict = new Dictionary<MessageCore, Dictionary<Message,string>>();
|
||||
// private static readonly Dictionary<MessageCore, Dictionary<Message, string>> coreFilenameDict = new Dictionary<MessageCore, Dictionary<Message,string>>();
|
||||
|
||||
internal static Dictionary<Guid, ReportingParty> ReportingPartyDict
|
||||
{
|
||||
@ -31,6 +30,8 @@ namespace bsmd.hisnord
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
public static void ReadResponseFiles()
|
||||
{
|
||||
foreach (MessageCore core in coreFilenameDict.Keys)
|
||||
@ -72,9 +73,10 @@ namespace bsmd.hisnord
|
||||
{
|
||||
coreFilenameDict[core].Remove(removeMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#region Create message file to send
|
||||
|
||||
@ -1815,11 +1817,6 @@ namespace bsmd.hisnord
|
||||
serializer.Serialize(tw, _nsw);
|
||||
}
|
||||
|
||||
if (!coreFilenameDict.ContainsKey(core))
|
||||
coreFilenameDict[core] = new Dictionary<Message, string>();
|
||||
if(message != null)
|
||||
coreFilenameDict[core][message] = filename;
|
||||
|
||||
retval = true;
|
||||
|
||||
MessageTelemetry.Enqueue(Message.NSWProvider.DUDR, message);
|
||||
|
||||
@ -16,9 +16,6 @@
|
||||
<setting name="Transmitter" serializeAs="String">
|
||||
<value>Transmitter-Tool\client.bat</value>
|
||||
</setting>
|
||||
<setting name="ResultDir" serializeAs="String">
|
||||
<value>Transmitter-Tool\RESULTS</value>
|
||||
</setting>
|
||||
<setting name="AnswerDir" serializeAs="String">
|
||||
<value>Transmitter-Tool\ANSWERS</value>
|
||||
</setting>
|
||||
@ -31,6 +28,9 @@
|
||||
<setting name="TransmitterRoot" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\</value>
|
||||
</setting>
|
||||
<setting name="OutputArchiveDir" serializeAs="String">
|
||||
<value>Transmitter-Tool\archive</value>
|
||||
</setting>
|
||||
</bsmd.hisnord.Properties.Settings>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.16" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.17" targetFramework="net48" />
|
||||
</packages>
|
||||
@ -10,8 +10,6 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using bsmd.database;
|
||||
using log4net;
|
||||
|
||||
@ -32,15 +30,15 @@ namespace bsmd.hisnord
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo(Path.Combine(rootDir, Properties.Settings.Default.Transmitter));
|
||||
startInfo.WorkingDirectory = rootDir;
|
||||
startInfo.RedirectStandardError = true;
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
startInfo.RedirectStandardInput = false;
|
||||
startInfo.UseShellExecute = false;
|
||||
// der Transmitter schickt alles was im Ausgabe-Verzeichnis ist
|
||||
// damit das gut geht schicken wir die Nachrichten einzeln und arbeiten jeweils das
|
||||
// Ergebnis ab
|
||||
|
||||
using (Process transmitterProcess = new Process())
|
||||
{
|
||||
@ -80,6 +78,12 @@ namespace bsmd.hisnord
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Error($"Transmitter failed: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void TransmitterProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
@ -89,8 +93,9 @@ namespace bsmd.hisnord
|
||||
|
||||
private static void TransmitterProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
// Output of STDERR. HIS-Nord seems to be using this for logging, so we do not flag as error.
|
||||
if(!e.Data.IsNullOrEmpty())
|
||||
_log.Error(e.Data);
|
||||
_log.Debug(e.Data);
|
||||
}
|
||||
|
||||
private static void TransmitterProcess_Exited(object sender, EventArgs e)
|
||||
@ -99,20 +104,11 @@ namespace bsmd.hisnord
|
||||
processId = null;
|
||||
}
|
||||
|
||||
public static result GetResult(string filenameFullPath)
|
||||
{
|
||||
// now we should read the response message...
|
||||
string resultFilename = string.Format("{0}.result.xml", Path.GetFileName(filenameFullPath));
|
||||
string resultDir = Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.ResultDir);
|
||||
string resultFullPath = Path.Combine(resultDir, resultFilename);
|
||||
return result.ReadResult(resultFullPath);
|
||||
}
|
||||
|
||||
public static void PurgeOldFiles(int maxAgeDays)
|
||||
{
|
||||
try
|
||||
{
|
||||
// "ANSWERS_DONE"
|
||||
// "import_done" (= successfully received)
|
||||
DirectoryInfo info = new DirectoryInfo(Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.AnswerArchiveDir));
|
||||
FileInfo[] files = info.GetFiles();
|
||||
int cnt = 0;
|
||||
@ -127,9 +123,9 @@ namespace bsmd.hisnord
|
||||
}
|
||||
_log.Info($"deleted {cnt} files from {Properties.Settings.Default.AnswerArchiveDir}");
|
||||
|
||||
// "RESULTS"
|
||||
// "archive" (= successfully sent)
|
||||
cnt = 0;
|
||||
info = new DirectoryInfo(Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.ResultDir));
|
||||
info = new DirectoryInfo(Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.OutputArchiveDir));
|
||||
files = info.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
@ -140,67 +136,13 @@ namespace bsmd.hisnord
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
_log.Info($"deleted {cnt} files from {Properties.Settings.Default.ResultDir}");
|
||||
_log.Info($"deleted {cnt} files from {Properties.Settings.Default.OutputArchiveDir}");
|
||||
|
||||
// "READY"
|
||||
cnt = 0;
|
||||
info = new DirectoryInfo(Path.Combine(Properties.Settings.Default.TransmitterRoot, "READY"));
|
||||
files = info.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
if (file.CreationTime < DateTime.Now.AddDays(-maxAgeDays))
|
||||
{
|
||||
_log.Debug($"deleting {file.Name}");
|
||||
file.Delete();
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
_log.Info($"deleted {cnt} files from READY");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error trying to delete old files: {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// class to read transmitter result xml files
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class result
|
||||
{
|
||||
public result() { }
|
||||
public int code { get; set; }
|
||||
public string message { get; set; }
|
||||
public string detail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// create result items from file
|
||||
/// </summary>
|
||||
public static result ReadResult(string filename)
|
||||
{
|
||||
result aResult = null;
|
||||
try
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(result));
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
_log.WarnFormat("Expected file {0} does not exist!", filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
using (FileStream fs = new FileStream(filename, FileMode.Open))
|
||||
{
|
||||
aResult = (result)serializer.Deserialize(fs);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Exception deserializing transmitter result: {0}", ex.Message);
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.16" targetFramework="net48" />
|
||||
<package id="log4net" version="2.0.17" targetFramework="net48" />
|
||||
</packages>
|
||||
Loading…
Reference in New Issue
Block a user