示例#1
0
        private static void InvokeMethods(Smarsy op, CommandLineOptions options)
        {
            string[] methodNames = options.GetMethods().ToArray();

            foreach (var methodName in methodNames)
            {
                InvokeMethodByName(op, methodName);
            }
        }
示例#2
0
        private static void InvokeMethodByName(Smarsy op, string methodName)
        {
            Type       classType  = op.GetType();
            MethodInfo methodInfo = classType.GetMethod(methodName.Trim());

            if (methodInfo != null)
            {
                methodInfo.Invoke(op, null);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
示例#3
0
        private static void Main(string[] args)
        {
            if (TryGetOptionsFromArguments(args, out var options))
            {
                return;
            }

            Smarsy smarsy = CreateSmarsy();

            RunSmarsy(smarsy, "test");

            InvokeMethods(smarsy, options);

            SendEmails(smarsy, options);
        }
示例#4
0
        private static void SendEmails(Smarsy smarsy, CommandLineOptions options)
        {
            string[] emails = options.GetEmails().ToArray();

            smarsy.SendEmail(options.From, emails);
        }
示例#5
0
 private static void RunSmarsy(Smarsy smarsy, string userLogin)
 {
     smarsy.Run(userLogin);
 }