protected override PluginProfileDto ConvertToPluginProfile(Project[] legacyProfile) { var rules = new List <ProfileRule>(); rules.AddRange(GetRulesFromBinderProfiles(legacyProfile.First())); rules.AddRange( legacyProfile.Select( project => new ProfileRule(project.ProjectID.ToString(), project.InboundMailCreateRequests.GetValueOrDefault()))); var pluginProfile = new ProjectEmailProfile { Login = legacyProfile.First().InboundMailLogin, Password = legacyProfile.First().InboundMailPassword, Port = legacyProfile.First().InboundMailPort.GetValueOrDefault(), Protocol = legacyProfile.First().InboundMailProtocol, MailServer = legacyProfile.First().InboundMailServer, UseSSL = legacyProfile.First().InboundMailUseSSL.GetValueOrDefault(), Rules = rules.Select(x => x.ToString()).ToString(Environment.NewLine) }; var profileName = legacyProfile.Aggregate("Email integration for ", (current, project) => current + string.Format("Project {0} ", project.ProjectID)); profileName = profileName.Substring(0, profileName.Length - 1); return(new PluginProfileDto { Name = profileName, Settings = pluginProfile }); }
public EmailReader(IStorageRepository storageRepository, ILocalBus localBus, IEmailClient client, MessageUidRepository messageUidRepository, IActivityLogger log) { _client = client; _messageUidRepository = messageUidRepository; _localBus = localBus; _profile = storageRepository.GetProfile <ProjectEmailProfile>(); _log = log; _processedUids = new List <string>(); }
private void CreateProfileInitialization(ProjectEmailProfile settings, string profileName) { var profile = new PluginProfileDto { Name = profileName, Settings = settings }; var createProfileCmd = new ExecutePluginCommandCommand { CommandName = EmbeddedPluginCommands.AddProfile, Arguments = profile.Serialize() }; _transportMock.HandleMessageFromTp( new List <HeaderInfo> { new HeaderInfo { Key = BusExtensions.ACCOUNTNAME_KEY, Value = "Account" } }, createProfileCmd); }
private IEnumerable<MailRule> Parse(ProjectEmailProfile profile, Action<string, object[]> log) { foreach (var ruleLine in GetRuleLines(profile)) { var parser = new Parser(new Scanner()); var tree = parser.Parse(ruleLine); if (tree.Errors.Count > 0) { var errors = new StringBuilder(); tree.Errors.ForEach(x => errors.Append(string.Format("<{0}>", x.Message))); log("rule '{0}' can not be parsed because of the following errors: {1}", new object[] {ruleLine, errors}); continue; } log("rule '{0}' parsed successfully and prepared to process", new object[] {ruleLine}); var thenClause = _thenClauseFactory.CreateBy(tree); var whenClauses = new WhenClauseFactory(thenClause); var whenClause = whenClauses.CreateBy(tree); yield return new MailRule(whenClause, thenClause, ruleLine); } }
private IEnumerable <MailRule> Parse(ProjectEmailProfile profile, Action <string, object[]> log) { foreach (var ruleLine in GetRuleLines(profile)) { var parser = new Parser(new Scanner()); var tree = parser.Parse(ruleLine); if (tree.Errors.Count > 0) { var errors = new StringBuilder(); tree.Errors.ForEach(x => errors.Append(string.Format("<{0}>", x.Message))); log("rule '{0}' can not be parsed because of the following errors: {1}", new object[] { ruleLine, errors }); continue; } log("rule '{0}' parsed successfully and prepared to process", new object[] { ruleLine }); var thenClause = _thenClauseFactory.CreateBy(tree); var whenClauses = new WhenClauseFactory(thenClause); var whenClause = whenClauses.CreateBy(tree); yield return(new MailRule(whenClause, thenClause, ruleLine)); } }
private void CreateProfileInitialization(ProjectEmailProfile settings, string profileName) { var profile = new PluginProfileDto { Name = profileName, Settings = settings }; var createProfileCmd = new ExecutePluginCommandCommand {CommandName = EmbeddedPluginCommands.AddProfile, Arguments = profile.Serialize()}; _transportMock.HandleMessageFromTp( new List<HeaderInfo> {new HeaderInfo {Key = BusExtensions.ACCOUNTNAME_KEY, Value = "Account"}}, createProfileCmd); }
public IEnumerable<MailRule> Parse(ProjectEmailProfile profile) { return Parse(profile, (message, args) => _log.InfoFormat(message, args)); }
public IEnumerable <MailRule> Parse(ProjectEmailProfile profile) { return(Parse(profile, (message, args) => _log.InfoFormat(message, args))); }