/// <summary>
        /// Fires the ProjectStarting event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <returns>Whether this event was canceled or not.</returns>
        protected virtual bool FireProjectStarting(string projectName)
        {
            bool isCanceled = false;

            if (ProjectStarting != null)
            {
                CancelProjectEventArgs args = new CancelProjectEventArgs(projectName);
                ProjectStarting(this, args);
                isCanceled = args.Cancel;
            }
            return(isCanceled);
        }
        /// <summary>
        /// Fires the AbortBuildReceived event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <param name="enforcerName">The name of the person aborting the build.</param>
        /// <returns>Whether this event was canceled or not.</returns>
        protected virtual bool FireAbortBuildReceived(string projectName, string enforcerName)
        {
            bool isCanceled = false;

            if (AbortBuildReceived != null)
            {
                CancelProjectEventArgs <string> args = new CancelProjectEventArgs <string>(projectName, enforcerName);
                AbortBuildReceived(this, args);
                isCanceled = args.Cancel;
            }
            return(isCanceled);
        }
        /// <summary>
        /// Fires the SendMessageReceived event.
        /// </summary>
        /// <param name="projectName">The name of the project.</param>
        /// <param name="message">The message to be sent.</param>
        /// <returns>Whether this event was canceled or not.</returns>
        protected virtual bool FireSendMessageReceived(string projectName, Message message)
        {
            bool isCanceled = false;

            if (SendMessageReceived != null)
            {
                CancelProjectEventArgs <Message> args = new CancelProjectEventArgs <Message>(projectName, message);
                SendMessageReceived(this, args);
                isCanceled = args.Cancel;
            }
            return(isCanceled);
        }
Exemplo n.º 4
0
        public void SendMessageReceived(object obj, CancelProjectEventArgs <Message> message)
        {
            string        messageTxt    = message.Data.Text;
            CustomMessage customMessage = GetCustomMessage(messageTxt);

            if (customMessage != null)
            {
                var fileSystem = server.RetrieveService(typeof(IFileSystem)) as IFileSystem ??
                                 new SystemIoFileSystem();
                if (customMessage.Command == "ChangeBranch")
                {
                    ChangeBranch(fileSystem, customMessage.Branch, message.ProjectName);
                }
                if (customMessage.Command == "GetAllBranches")
                {
                    if (!string.IsNullOrEmpty(customMessage.Repo) &&
                        !string.IsNullOrEmpty(customMessage.WorkingDirectory) &&
                        !string.IsNullOrEmpty(customMessage.SourcecontrolType))
                    {
                        GetAllBranches(fileSystem, message.ProjectName, customMessage);
                    }
                }
            }
        }