Merge branch 'master' of github.com:tparnell8/NOCQ

This commit is contained in:
Norm MacLennan
2014-05-07 11:42:04 -07:00
4 changed files with 35 additions and 15 deletions

View File

@@ -59,12 +59,15 @@
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Extensability\Catalog.cs" /> <Compile Include="Extensability\Catalog.cs" />
<Compile Include="Plugins\Email\ImapInput.cs" /> <Compile Include="Plugins\Email\ImapInput.cs">
<DependentUpon>IEmailSetting.cs</DependentUpon>
</Compile>
<Compile Include="Plugins\Email\EmailSettings.cs" /> <Compile Include="Plugins\Email\EmailSettings.cs" />
<Compile Include="Imports\IDataImportHook.cs" /> <Compile Include="Imports\IDataImportHook.cs" />
<Compile Include="Imports\DataImports.cs" /> <Compile Include="Imports\DataImports.cs" />
<Compile Include="DB\RedisDataase.cs" /> <Compile Include="DB\RedisDataase.cs" />
<Compile Include="Plugins\Email\ParseRule.cs" /> <Compile Include="Plugins\Email\ParseRule.cs" />
<Compile Include="Plugins\Email\IEmailSetting.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace NOCQ.Plugins.Email namespace NOCQ.Plugins.Email
{ {
public class EmailSettings public class EmailSettings :IEmailSetting
{ {
public string Username {get;set;} public string Username {get;set;}
public string Password {get;set;} public string Password {get;set;}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace NOCQ.Plugins.Email
{
public interface IEmailSetting
{
string Username {get;set;}
string Password {get;set;}
string Host {get;set;}
int Port {get;set;}
string Folder {get;set;}
bool IsSsl {get;set;}
int Frequency { get; set; }
IEnumerable<ParseRule> ParseRules {get;set;}
}
}

View File

@@ -8,24 +8,24 @@ namespace NOCQ.Plugins.Email
{ {
public class ImapInput public class ImapInput
{ {
private string loginName { get; set; } string loginName { get; set; }
private string password { get; set; } string password { get; set; }
private string server { get; set; } string server { get; set; }
private string folderPath { get; set; } string folderPath { get; set; }
private Timer timer { get; set; } Timer timer { get; set; }
private int port { get; set; } int port { get; set; }
private bool ssl { get; set; } bool ssl { get; set; }
private DateTime lastRun { get; set; } DateTime lastRun { get; set; }
private List<ParseRule> parseRules{ get; set; } List<ParseRule> parseRules{ get; set; }
public ImapInput (dynamic settings) public ImapInput (dynamic settings)
{ {
var sets = settings as EmailSettings; var sets = settings as EmailSettings;
if (sets.Username == null if (sets.GetType().GetProperty("Username") == null
|| sets.Password == null || sets.GetType().GetProperty("Password") == null
|| sets.Host == null || sets.GetType().GetProperty("Host") == null
|| sets.Folder == null) || sets.GetType().GetProperty("Folder") == null)
throw new ArgumentException ("You are missing a required setting."); throw new ArgumentException ("You are missing a required setting.");
parseRules = sets.ParseRules.Where (x => x.Enabled).ToList(); parseRules = sets.ParseRules.Where (x => x.Enabled).ToList();