diff --git a/nsw/Source/bsmd.EMailReceiveService/App.config b/nsw/Source/bsmd.EMailReceiveService/App.config deleted file mode 100644 index edfcd46f..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/App.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - -
- - - - - - - - - replace me! - - - replace me! - - - replace me! - - - replace me! - - - 995 - - - - \ No newline at end of file diff --git a/nsw/Source/bsmd.EMailReceiveService/EmailReceiveService.Designer.cs b/nsw/Source/bsmd.EMailReceiveService/EmailReceiveService.Designer.cs deleted file mode 100644 index 1f6bc51d..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/EmailReceiveService.Designer.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace bsmd.EMailReceiveService -{ - partial class EmailReceiveService - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - this.ServiceName = "Service1"; - } - - #endregion - } -} diff --git a/nsw/Source/bsmd.EMailReceiveService/EmailReceiveService.cs b/nsw/Source/bsmd.EMailReceiveService/EmailReceiveService.cs deleted file mode 100644 index a4bfd4a5..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/EmailReceiveService.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Linq; -using System.IO; -using System.ServiceProcess; -using System.Text; -using System.Timers; -using System.Threading.Tasks; - -using OpenPop; -using log4net; -using bsmd.database; - -namespace bsmd.EMailReceiveService -{ - - /// - /// Simpler Windows-Service zum Abruf von NSW Antworten via E-mail. Ich verwende OpenPop.NET Library (via NuGet) - /// http://hpop.sourceforge.net/ - /// - /// - public partial class EmailReceiveService : ServiceBase - { - - private Timer _timer; - private object _timerlock = new object(); - private bool processRunning = false; - private ILog _log = LogManager.GetLogger(typeof(EmailReceiveService)); - - public EmailReceiveService() - { - Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); - InitializeComponent(); - } - - protected override void OnStart(string[] args) - { - this.EventLog.Source = this.ServiceName; - this.EventLog.Log = "Application"; - this.EventLog.BeginInit(); - if (!EventLog.SourceExists(this.EventLog.Source, this.EventLog.Log)) - EventLog.CreateEventSource(this.EventLog.Source, this.EventLog.Log); - this.EventLog.EndInit(); - - this.Init(args); - - this.EventLog.WriteEntry("NSW EMail Receive Service started.", EventLogEntryType.Information); - } - - protected override void OnStop() - { - _log.Info("EmailReceiveService stopped"); - } - - public void Init(string[] args) - { - this._timer = new Timer(); - this._timer.Interval = 600000; // 10 Min, TODO: Settings - this._timer.Elapsed += _timer_Elapsed; - this._timer.Enabled = true; - - if (Debugger.IsAttached) - this._timer_Elapsed(null, null); - } - - void _timer_Elapsed(object sender, ElapsedEventArgs e) - { - lock (this._timerlock) - { - if (this.processRunning) return; - else this.processRunning = true; - } - - if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString)) - { - try - { - - // dbh E-Mail aus Postfach abrufen - using (OpenPop.Pop3.Pop3Client client = new OpenPop.Pop3.Pop3Client()) - { - client.Connect(Properties.Settings.Default.Host, Properties.Settings.Default.Port, true); - client.Authenticate(Properties.Settings.Default.User, Properties.Settings.Default.Password); - - int messageNum = client.GetMessageCount(); - _log.DebugFormat("Mail Server has {0} messages", messageNum); - - if (messageNum > 0) - { - // We want to download all messages - List allMessages = new List(messageNum); - - // Messages are numbered in the interval: [1, messageCount] - // Ergo: message numbers are 1-based. - // Most servers give the latest message the highest number - for (int i = 1; i <= messageNum; i++) - { - allMessages.Add(client.GetMessage(i)); - } - - for (int i = 0; i < allMessages.Count; i++) - { - // XML Anhang extrahieren und in einen string schreiben - OpenPop.Mime.Message message = allMessages[i]; - - List messageParts = message.FindAllAttachments(); - for (int partIndex = 0; partIndex < messageParts.Count; partIndex++) - { - OpenPop.Mime.MessagePart part = messageParts[partIndex]; - _log.DebugFormat("{0} Encoding: {1}", partIndex, part.ContentTransferEncoding); - - switch (part.ContentTransferEncoding) - { - case OpenPop.Mime.Header.ContentTransferEncoding.Base64: - // decode base64 body - - break; - default: - break; - } - - } - - - // E-Mail entfernen - - // client.DeleteMessage(i+1); - } - } - } - } - catch (Exception ex) - { - _log.ErrorFormat("Exception occurred: {0}", ex.ToString()); - } - } - else - { - this.EventLog.WriteEntry("FormService stopped: DB connection failed", EventLogEntryType.Error); - this.Stop(); - } - - lock (this._timerlock) - { - this.processRunning = false; - } - } - } -} diff --git a/nsw/Source/bsmd.EMailReceiveService/Program.cs b/nsw/Source/bsmd.EMailReceiveService/Program.cs deleted file mode 100644 index 5f2ed440..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/Program.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.ServiceProcess; -using System.Text; -using System.Threading.Tasks; - -namespace bsmd.EMailReceiveService -{ - static class Program - { - /// - /// The main entry point for the application. - /// - static void Main() - { - ServiceBase[] ServicesToRun; - ServicesToRun = new ServiceBase[] - { - new EmailReceiveService() - }; - - if (Debugger.IsAttached) - { - ((EmailReceiveService)ServicesToRun[0]).Init(null); - while (true) ; - } - else - { - ServiceBase.Run(ServicesToRun); - } - } - } -} diff --git a/nsw/Source/bsmd.EMailReceiveService/Properties/AssemblyInfo.cs b/nsw/Source/bsmd.EMailReceiveService/Properties/AssemblyInfo.cs deleted file mode 100644 index d0a6e84a..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("bsmd.EMailReceiveService")] -[assembly: AssemblyDescription("E-Mail checker for NSW response messages sent by mail")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("03d0b447-a06c-46ad-b888-94501a6ea618")] \ No newline at end of file diff --git a/nsw/Source/bsmd.EMailReceiveService/Properties/Settings.Designer.cs b/nsw/Source/bsmd.EMailReceiveService/Properties/Settings.Designer.cs deleted file mode 100644 index abd44164..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/Properties/Settings.Designer.cs +++ /dev/null @@ -1,86 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34209 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace bsmd.EMailReceiveService.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("replace me!")] - public string ConnectionString { - get { - return ((string)(this["ConnectionString"])); - } - set { - this["ConnectionString"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("replace me!")] - public string User { - get { - return ((string)(this["User"])); - } - set { - this["User"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("replace me!")] - public string Host { - get { - return ((string)(this["Host"])); - } - set { - this["Host"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("replace me!")] - public string Password { - get { - return ((string)(this["Password"])); - } - set { - this["Password"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("995")] - public int Port { - get { - return ((int)(this["Port"])); - } - set { - this["Port"] = value; - } - } - } -} diff --git a/nsw/Source/bsmd.EMailReceiveService/Properties/Settings.settings b/nsw/Source/bsmd.EMailReceiveService/Properties/Settings.settings deleted file mode 100644 index aa60a589..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/Properties/Settings.settings +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - replace me! - - - replace me! - - - replace me! - - - replace me! - - - 995 - - - \ No newline at end of file diff --git a/nsw/Source/bsmd.EMailReceiveService/bsmd.EMailReceiveService.csproj b/nsw/Source/bsmd.EMailReceiveService/bsmd.EMailReceiveService.csproj deleted file mode 100644 index e2988306..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/bsmd.EMailReceiveService.csproj +++ /dev/null @@ -1,110 +0,0 @@ - - - - - Debug - AnyCPU - {6D46F847-24F2-4883-8B0E-21386FFD0C96} - WinExe - Properties - bsmd.EMailReceiveService - bsmd.EMailReceiveService - v4.5 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - - - ..\bsmdKey.snk - - - - packages\log4net.2.0.3\lib\net40-full\log4net.dll - - - packages\OpenPop.NET.2.0.6.1102\lib\net40\OpenPop.dll - - - - - - - - - - - - - Properties\AssemblyProductInfo.cs - - - Properties\AssemblyProjectInfo.cs - - - Properties\AssemblyProjectKeyInfo.cs - - - Component - - - EmailReceiveService.cs - - - - - True - True - Settings.settings - - - - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - {19945af2-379b-46a5-b27a-303b5ec1d557} - bsmd.database - - - {df625ff0-2265-4686-9cb6-2a8511cb3b9d} - bsmd.dbh - - - - - - - - \ No newline at end of file diff --git a/nsw/Source/bsmd.EMailReceiveService/packages.config b/nsw/Source/bsmd.EMailReceiveService/packages.config deleted file mode 100644 index d9f96dd1..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/nsw/Source/bsmd.EMailReceiveService/readme.txt b/nsw/Source/bsmd.EMailReceiveService/readme.txt deleted file mode 100644 index f3555084..00000000 --- a/nsw/Source/bsmd.EMailReceiveService/readme.txt +++ /dev/null @@ -1,11 +0,0 @@ -DB Connection string lokal: -Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False - -Testaccount: - -nsw@textbausteine.net - -Passwort: 3kjksJSD343 -Server: pop3.strato.de - -Port: 995