Esempio n. 1
0
        public CallDataProvider(ISelectorConfig config)
        {
            Debug.Assert(null != config);
            //this.config = config;

            this.HostName = config.HostName();
            this.Port = config.Port();
            this.useSSL = config.UseSSL();

            this.Login = config.Login();
            this.Password = config.Password();

            this.Sender = config.Sender();

            this.HostRequestDelayMilliseconds = config.HostRequestDelayMilliseconds();

            this.DirectoryForAudioFiles = config.DirectoryForAudioFiles();
            this.AudioFileExtension = config.AudioFileExtension();


            this.MessageRegex = config.MessageRegex();

            this.RegexIndexOperator = config.RegexIndexOperator();
            this.RegexIndexAbonent = config.RegexIndexAbonent();
            this.RegexIndexDateStart = config.RegexIndexDateStart();
            this.RegexIndexDateInterval = config.RegexIndexDateInterval();

            this.FormatVariantsForDateStart = config.FormatVariantsForDateStart();
            this.FormatVariantsForDateInterval = config.FormatVariantsForDateInterval();
        }
 public CallDataProviderImplPop3(ISelectorConfig config)
     : base(config)
 {
     this.pop3Client = new Pop3Client();
     pop3Client.Connect(HostName, Port, useSSL);
     pop3Client.Authenticate(Login, Password);
     NULL_MESSAGE = new CallMessageImpl(pop3Client, 0, this);
     
 }
Esempio n. 3
0
        public Selector(ISelectorConfig config)
        {
            Debug.Assert(null != config);
            logDebug = config.LogDebug();
            switch (config.Protocol())
            {
                case MailProtocol.Pop3:
                    this.callDataProvider = new CallDataProviderImplPop3(config);
                    break;
                default:
                    throw new InvalidDataException("Undefined Mail protocol type");
            }

            switch (config.DbType())
            {
                case DBType.SQLServer:
                    this.callDataConsumer = new CallDataConsumerImplSqlServer(config);
                    break;
                default:
                    throw new InvalidDataException("Undefined Data base type");
            }
        }
        protected override void OnStart(string[] args)
        {
           
            try
            {
                base.OnStart(args);
                int delay = 0;
                lock (lockShutdown)
                {
                    hasShutteddown = false;

                    errorHandler = new ErrorHandler(serviceEventLog, lockLog);

                    setInstallationWorkingDirectory();
                    config = CallSelectorFactory.loadISelectorConfig(new FileInfo("CallSelectorConfig.xml"));
                    delay = config.HostRequestDelayMilliseconds();
                    processingThread = new Thread(new ThreadStart(RunProcessing));
                    processingThread.Start();
                }
                lock (lockLog)
                {
                    serviceEventLog.WriteEntry("Start. delay=" + delay + "; " + (config.LogDebug() ? "debug=true" : "debug=false"));
                }
            }
            catch (ThreadAbortException) { /*ignore*/}
            catch (Exception e)
            {
                if (null != errorHandler) errorHandler.handle(e);
            }
            
        }
 public CallDataConsumerImplSqlServer(ISelectorConfig config)
 {
     this.connection = new SqlConnection(Utils.formatText(config.DBConnectionString()));
     this.connection.Open();
     this.directoryForAudioFiles = config.DirectoryForAudioFiles();
 }
Esempio n. 6
0
 public SelectorImplTest(ISelectorConfig config) : 
     base(config)
 {
     this.DirectoryForAudioFiles = config.DirectoryForAudioFiles();
 }
Esempio n. 7
0
 public SelectorImpl(ISelectorConfig config)
     : base(config)
 {
 }
 public static ISelector createISelector(ISelectorConfig config)
 {
     return new SelectorImpl(config);
 }