protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            string text = base.ValidateAndNormalizeAgentIdentity(this.Name);

            if (base.AgentExists(text))
            {
                base.WriteError(new ArgumentException(AgentStrings.AgentAlreadyExist(this.Name), "Name"), ErrorCategory.InvalidArgument, null);
            }
            Type      type      = this.ReflectAgentType(this.absoluteAssemblyPath, this.TransportAgentFactory);
            AgentInfo agentInfo = new AgentInfo(text, type.ToString(), this.TransportAgentFactory, this.absoluteAssemblyPath, false, false);

            if (base.TransportService == TransportService.FrontEnd && type != typeof(SmtpReceiveAgent))
            {
                base.WriteError(new InvalidOperationException(AgentStrings.AgentTypeNotSupportedOnFrontEnd(type.ToString())), ErrorCategory.InvalidOperation, null);
            }
            if (type == typeof(DeliveryAgent))
            {
                this.ValidateDeliveryAgent(agentInfo);
            }
            TransportAgent sendToPipeline = new TransportAgent(text, false, base.MExConfiguration.GetPublicAgentList().Count + 1, this.TransportAgentFactory, this.absoluteAssemblyPath);
            int            index          = base.MExConfiguration.GetPublicAgentList().Count + base.MExConfiguration.GetPreExecutionInternalAgents().Count;

            base.MExConfiguration.AgentList.Insert(index, agentInfo);
            base.Save();
            base.WriteObject(sendToPipeline);
            if (base.MissingConfigFile)
            {
                this.WriteWarning(AgentStrings.MissingConfigurationFileCreate(base.MExConfigPath));
            }
            this.WriteWarning(AgentStrings.ReleaseAgentBinaryReference);
            this.WriteWarning(AgentStrings.RestartServiceForChanges(base.GetTransportServiceName()));
            TaskLogger.LogExit();
        }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            GetTransportAgent.MatchOptions matchOptions = GetTransportAgent.MatchOptions.FullString;
            string text = (this.Identity == null) ? null : this.Identity.ToString();
            bool   flag = !string.IsNullOrEmpty(text) && (text.StartsWith("*") || text.EndsWith("*"));

            if (flag)
            {
                if (text.StartsWith("*") && text.EndsWith("*") && text.Length > 2)
                {
                    text         = text.Substring(1, text.Length - 2);
                    matchOptions = GetTransportAgent.MatchOptions.SubString;
                }
                else if (text.EndsWith("*") && text.Length > 1)
                {
                    text         = text.Substring(0, text.Length - 1);
                    matchOptions = GetTransportAgent.MatchOptions.StartsWith;
                }
                else if (text.StartsWith("*") && text.Length > 1)
                {
                    text         = text.Substring(1);
                    matchOptions = GetTransportAgent.MatchOptions.EndsWith;
                }
                else if (string.Compare("*", text, StringComparison.InvariantCultureIgnoreCase) == 0)
                {
                    text = string.Empty;
                }
            }
            if (!string.IsNullOrEmpty(text) && -1 != text.IndexOf("*", StringComparison.InvariantCultureIgnoreCase))
            {
                TaskLogger.LogExit();
                return;
            }
            IList <AgentInfo> publicAgentList = base.MExConfiguration.GetPublicAgentList();

            for (int i = 0; i < publicAgentList.Count; i++)
            {
                if (string.IsNullOrEmpty(text) || (matchOptions == GetTransportAgent.MatchOptions.FullString && string.Compare(publicAgentList[i].AgentName, text, StringComparison.InvariantCultureIgnoreCase) == 0) || (matchOptions == GetTransportAgent.MatchOptions.SubString && -1 != publicAgentList[i].AgentName.IndexOf(text, StringComparison.InvariantCultureIgnoreCase)) || (matchOptions == GetTransportAgent.MatchOptions.EndsWith && publicAgentList[i].AgentName.EndsWith(text, StringComparison.InvariantCultureIgnoreCase)) || (matchOptions == GetTransportAgent.MatchOptions.StartsWith && publicAgentList[i].AgentName.StartsWith(text, StringComparison.InvariantCultureIgnoreCase)))
                {
                    TransportAgent sendToPipeline = new TransportAgent(publicAgentList[i].AgentName, publicAgentList[i].Enabled, i + 1, publicAgentList[i].FactoryTypeName, publicAgentList[i].FactoryAssemblyPath);
                    base.WriteObject(sendToPipeline);
                }
            }
            TaskLogger.LogExit();
        }