Deployment Excel Reader

This commit is contained in:
Daniel Schick 2016-09-06 07:16:16 +00:00
parent 384dad5950
commit 4f117a1ae7
6 changed files with 34 additions and 6 deletions

Binary file not shown.

View File

@ -89,7 +89,7 @@ namespace bsmd.ExcelReadService
bool readResult;
string readMessage = "";
string receiptText = "";
MessageCore messageCore = null;
MessageCore messageCore = null;
if (attachmentLocalPath == null)
@ -133,7 +133,7 @@ namespace bsmd.ExcelReadService
// Quittung / set messagecore to createreport and let reportGenerator create a reply?
if (Properties.Settings.Default.SendConfirmationSheet)
{
string confirmationFileName = Path.Combine(Path.GetDirectoryName(attachmentLocalPath),
string confirmationFileName = Path.Combine(Path.GetDirectoryName(attachmentLocalPath),
string.Format("{0}_confirm.xls", Path.GetFileNameWithoutExtension(attachmentLocalPath)));
if (reader.SaveCopy(confirmationFileName))
@ -145,7 +145,7 @@ namespace bsmd.ExcelReadService
}
}
}
}
}
}
if (receiptText.Length > 0)
@ -159,7 +159,7 @@ namespace bsmd.ExcelReadService
// remove attachment
_log.InfoFormat("removing local file {0}", attachmentLocalPath);
if(!Properties.Settings.Default.TestMode)
if (!Properties.Settings.Default.TestMode)
File.Delete(attachmentLocalPath);
}

View File

@ -13,6 +13,8 @@ using System.IO;
using OpenPop.Pop3;
using OpenPop.Mime;
using log4net;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
namespace bsmd.email
{
@ -28,7 +30,10 @@ namespace bsmd.email
try
{
this.pop3Client = new Pop3Client();
this.pop3Client.Connect(Properties.Settings.Default.POP3Server, 995, true);
this.pop3Client.Connect(Properties.Settings.Default.POP3Server, Properties.Settings.Default.POP3Port, true,
60000, 60000, new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate));
this.pop3Client.Authenticate(Properties.Settings.Default.POP3User, Properties.Settings.Default.POP3Password);
this._connected = true;
}
@ -39,6 +44,14 @@ namespace bsmd.email
}
}
/// <summary>
/// Diese Funktion validiert *jedes* Zertifikat und ist eigentlich scheiße. Das geht nur so im abgeschlossenen BSMD Netz!
/// </summary>
public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
public bool IsConnected { get { return this._connected; } }
public bool ReceiveSingleMail(out string attachmentLocalFile, out string messageId, out string sender)
@ -50,7 +63,7 @@ namespace bsmd.email
if (!_connected) return false;
int messageCount = this.pop3Client.GetMessageCount();
if (messageCount > 0)
if (messageCount > (this.currentMail - 1))
{
Message mailMessage = this.pop3Client.GetMessage(this.currentMail);

View File

@ -114,5 +114,14 @@ namespace bsmd.email.Properties {
return ((string)(this["AdminEmail"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("995")]
public int POP3Port {
get {
return ((int)(this["POP3Port"]));
}
}
}
}

View File

@ -35,5 +35,8 @@
<Setting Name="AdminEmail" Type="System.String" Scope="Application">
<Value Profile="(Default)">nsw@textbausteine.net</Value>
</Setting>
<Setting Name="POP3Port" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">995</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -42,6 +42,9 @@
<setting name="AdminEmail" serializeAs="String">
<value>nsw@textbausteine.net</value>
</setting>
<setting name="POP3Port" serializeAs="String">
<value>995</value>
</setting>
</bsmd.email.Properties.Settings>
</applicationSettings>
</configuration>