Ejemplo n.º 1
0
        /// <summary>
        /// Starting main execution engine
        /// </summary>
        /// <param name="args"></param>
        private static void ProcessArgs(string[] args)
        {
            try
            {
                Log.Initialize(args[0]);
                MailSimSequence seq = ConfigurationFile.LoadSequenceFile(args[0]);

                if (seq == null)
                {
                    Log.Out(Log.Severity.Error, Process.GetCurrentProcess().ProcessName, "Unable to load sequence XML file {0}", args[0]);
                    return;
                }

                // initializes logging
                Log.LogFileLocation(seq.LogFileLocation);

                ExecuteSequence exeSeq = new ExecuteSequence(seq);

                exeSeq.Execute();
            }
            catch (Exception ex)
            {
                Log.Out(Log.Severity.Error, Process.GetCurrentProcess().ProcessName, "Error encountered\n" + ex.ToString());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="seq">Sequence file content </param>
        public ExecuteSequence(MailSimSequence seq)
        {
            typeFuncs[typeof(MailSimOperationsMailSend)]     = (oper) => MailSend((MailSimOperationsMailSend)oper);
            typeFuncs[typeof(MailSimOperationsMailDelete)]   = (oper) => MailDelete((MailSimOperationsMailDelete)oper);
            typeFuncs[typeof(MailSimOperationsMailReply)]    = (oper) => MailReply((MailSimOperationsMailReply)oper);
            typeFuncs[typeof(MailSimOperationsMailForward)]  = (oper) => MailForward((MailSimOperationsMailForward)oper);
            typeFuncs[typeof(MailSimOperationsMailMove)]     = (oper) => MailMove((MailSimOperationsMailMove)oper);
            typeFuncs[typeof(MailSimOperationsFolderCreate)] = (oper) => FolderCreate((MailSimOperationsFolderCreate)oper);
            typeFuncs[typeof(MailSimOperationsFolderDelete)] = (oper) => FolderDelete((MailSimOperationsFolderDelete)oper);
            typeFuncs[typeof(MailSimOperationsEventMonitor)] = (oper) => EventMonitor((MailSimOperationsEventMonitor)oper);

            sequence = seq;

            if (sequence != null)
            {
                try
                {
                    olMailStore = ProviderFactory.CreateMailStore(null, sequence);
                }
                catch (Exception)
                {
                    Log.Out(Log.Severity.Error, "Run", "Error encountered during initialization");
                    throw;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="seq">Sequence file content </param>
        internal ExecuteSequence(MailSimSequence seq, MailSimOptions options)
        {
            typeFuncs[typeof(MailSimOperationsMailSend)] = (oper) => MailSend((MailSimOperationsMailSend)oper);
            typeFuncs[typeof(MailSimOperationsMailDelete)] = (oper) => MailDelete((MailSimOperationsMailDelete)oper);
            typeFuncs[typeof(MailSimOperationsMailReply)] = (oper) => MailReply((MailSimOperationsMailReply)oper);
            typeFuncs[typeof(MailSimOperationsMailForward)] = (oper) => MailForward((MailSimOperationsMailForward)oper);
            typeFuncs[typeof(MailSimOperationsMailMove)] = (oper) => MailMove((MailSimOperationsMailMove)oper);
            typeFuncs[typeof(MailSimOperationsFolderCreate)] = (oper) => FolderCreate((MailSimOperationsFolderCreate)oper);
            typeFuncs[typeof(MailSimOperationsFolderDelete)] = (oper) => FolderDelete((MailSimOperationsFolderDelete)oper);
            typeFuncs[typeof(MailSimOperationsEventMonitor)] = (oper) => EventMonitor((MailSimOperationsEventMonitor)oper);

            sequence = seq;

            if (sequence != null)
            {
                try
                {
                    olMailStore = ProviderFactory.CreateMailStore(null, options);
                }
                catch (Exception)
                {
                    Log.Out(Log.Severity.Error, "Run", "Error encountered during initialization");
                    throw;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Starting main execution engine
        /// </summary>
        /// <param name="args"></param>
        private static void ProcessSequense(string[] args, MailSimOptions options)
        {
            Log.Initialize(args[0]);
            MailSimSequence seq = ConfigurationFile.LoadSequenceFile(args[0]);

            if (seq == null)
            {
                Log.Out(Log.Severity.Error, Process.GetCurrentProcess().ProcessName, "Unable to load sequence XML file {0}", args[0]);
                return;
            }

            ExecuteSequence exeSeq = new ExecuteSequence(seq, options);

            // initializes logging
            Log.LogFileLocation(seq.LogFileLocation);

            exeSeq.Execute();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="seq">Sequence file content </param>
        public ExecuteSequence(MailSimSequence seq)
        {
            typeFuncs[typeof(MailSimOperationsMailSend)] = (oper) => MailSend((MailSimOperationsMailSend)oper);
            typeFuncs[typeof(MailSimOperationsMailDelete)] = (oper) => MailDelete((MailSimOperationsMailDelete)oper);
            typeFuncs[typeof(MailSimOperationsMailReply)] = (oper) => MailReply((MailSimOperationsMailReply)oper);
            typeFuncs[typeof(MailSimOperationsMailForward)] = (oper) => MailForward((MailSimOperationsMailForward)oper);
            typeFuncs[typeof(MailSimOperationsMailMove)] = (oper) => MailMove((MailSimOperationsMailMove)oper);
            typeFuncs[typeof(MailSimOperationsFolderCreate)] = (oper) => FolderCreate((MailSimOperationsFolderCreate)oper);
            typeFuncs[typeof(MailSimOperationsFolderDelete)] = (oper) => FolderDelete((MailSimOperationsFolderDelete)oper);
            typeFuncs[typeof(MailSimOperationsEventMonitor)] = (oper) => EventMonitor((MailSimOperationsEventMonitor)oper);

            if (seq != null)
            {
                try
                {
                    sequence = seq;

                    // Disables the Outlook security prompt if specified
                    if (sequence.DisableOutlookPrompt == true)
                    {
                        ConfigOutlookPrompts(false);
                    }

                    // Openes connection to Outlook with default profile, starts Outlook if it is not running
                    olConnection = new MailConnection();

                    // Note: Currently only the default MailStore is supported.
                    olMailStore = olConnection.GetDefaultStore();

                    // Initializes a random number
                    randomNum = new Random();
                }
                catch (Exception)
                {
                    Log.Out(Log.Severity.Error, "Run", "Error encountered during initialization");
                    throw;
                }
            }
        }
 public static IMailStore CreateMailStore(string mailboxName, MailSimSequence seq=null)
 {
     // Opens connection to Outlook with default profile, starts Outlook if it is not running
     // Note: Currently only the default MailStore is supported.
     return new MailStoreProviderOM(mailboxName, seq == null ? false : seq.DisableOutlookPrompt);
 }
 public static IMailStore CreateMailStore(string mailboxName, MailSimSequence seq = null)
 {
     // Opens connection to Outlook with default profile, starts Outlook if it is not running
     // Note: Currently only the default MailStore is supported.
     return(new MailStoreProviderOM(mailboxName, seq == null ? false : seq.DisableOutlookPrompt));
 }