private object ParseMessage(string Message, InstallMessage MessageType)
        {
            switch (MessageType)
            {
            case InstallMessage.ActionStart:
                ActionStartMessage message = new ActionStartMessage();
                String[]           items   = Message.Trim().Split(new char[] { ' ' });

                string dateRun    = items[1];
                string actionName = items[2];

                if (dateRun.EndsWith(":"))
                {
                    dateRun = dateRun.Trim().TrimEnd(new char[] { ':' });
                }

                if (actionName.EndsWith("."))
                {
                    actionName = actionName.Trim().TrimEnd(new char[] { '.' });
                }

                StringBuilder messageInfo = new StringBuilder();
                if (items.Length > 3)
                {
                    for (int i = 3; i < items.Length; i++)
                    {
                        messageInfo.Append(items[i] + " ");
                    }
                }

                DateTime.TryParse(dateRun, out message.DateRun);
                message.Name    = actionName.Trim();
                message.Message = messageInfo.ToString().Trim();

                return(message);

                break;
            }

            return(null);
        }
        void OnExecuteMessage(object sender, ExecuteMsiMessageEventArgs e)
        {
            string eMessage = string.Empty;

            switch (e.MessageType)
            {
            case InstallMessage.ActionStart:
                ActionStartMessage   message   = (ActionStartMessage)ParseMessage(e.Message, e.MessageType);
                ActionStartEventArgs eventArgs = new ActionStartEventArgs();
                eventArgs.DateRun = message.DateRun;
                eventArgs.Message = message.Message;
                eventArgs.Name    = message.Name;
                eMessage          = message.Name + ":" + message.Message;
                break;

            default:
                eMessage = e.Message;
                break;
            }
            this.Status = eMessage;
        }
Exemple #3
0
        private object ParseMessage(string Message, InstallMessage MessageType)
        {
            switch (MessageType)
            {
                case InstallMessage.ActionStart:
                    ActionStartMessage message = new ActionStartMessage();
                    String[] items = Message.Trim().Split(new char[] { ' ' });

                    string dateRun = items[1];
                    string actionName = items[2];

                    if (dateRun.EndsWith(":"))
                    {
                        dateRun = dateRun.Trim().TrimEnd(new char[] { ':' });
                    }

                    if (actionName.EndsWith("."))
                    {
                        actionName = actionName.Trim().TrimEnd(new char[] { '.' });
                    }

                    StringBuilder messageInfo = new StringBuilder();
                    if (items.Length > 3)
                    {

                        for (int i = 3; i < items.Length; i++)
                        {
                            messageInfo.Append(items[i] + " ");
                        }
                    }

                    DateTime.TryParse(dateRun, out message.DateRun);
                    message.Name = actionName.Trim();
                    message.Message = messageInfo.ToString().Trim();

                    return message;

                    break;
            }

            return null;
        }