コード例 #1
0
 public void ProcessMsBuildLoggerMessage(ConcurrentQueue<MessageArgsLogger> messagesToBeSend, IpAddressSettings settings)
 {
     TcpListener agentMsBuildListener = null;
     TcpClient agentTcpMsbuildReader = null;
     try
     {
         agentMsBuildListener = new TcpListener(settings.GetIPAddress(), settings.Port);
         agentMsBuildListener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
         agentTcpMsbuildReader = default(TcpClient);
         agentMsBuildListener.Start();
           agentTcpMsbuildReader = agentMsBuildListener.AcceptTcpClient();
         do
         {
             string dataFromClient = ATACore.TcpWrapperProcessor.TcpClientWrapper.ReadSimpleClientMessage(agentTcpMsbuildReader);
             if (!String.IsNullOrEmpty(dataFromClient))
                 ATACore.CommandExecutor.EnqueueNewMessage(dataFromClient, MessageSource.MsBuildLogger, messagesToBeSend);
             else if (dataFromClient == null)
                 agentTcpMsbuildReader = agentMsBuildListener.AcceptTcpClient();
         } while (true);
     }
     catch (Exception ex)
     {
         Log.Error("Exception in ProcessClientMessge", ex);
     }
     finally
     {
         ATACore.TcpWrapperProcessor.TcpListenerWrapper.CloseTcpMsLogger(agentMsBuildListener, agentTcpMsbuildReader);
     }
 }    
コード例 #2
0
        public void ProcessMsBuildLoggerMessage(ConcurrentQueue <MessageArgsLogger> messagesToBeSend, IpAddressSettings settings)
        {
            TcpListener agentMsBuildListener  = null;
            TcpClient   agentTcpMsbuildReader = null;

            try
            {
                agentMsBuildListener = new TcpListener(settings.GetIPAddress(), settings.Port);
                agentMsBuildListener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
                agentTcpMsbuildReader = default(TcpClient);
                agentMsBuildListener.Start();
                agentTcpMsbuildReader = agentMsBuildListener.AcceptTcpClient();
                do
                {
                    string dataFromClient = ATACore.TcpWrapperProcessor.TcpClientWrapper.ReadSimpleClientMessage(agentTcpMsbuildReader);
                    if (!String.IsNullOrEmpty(dataFromClient))
                    {
                        ATACore.CommandExecutor.EnqueueNewMessage(dataFromClient, MessageSource.MsBuildLogger, messagesToBeSend);
                    }
                    else if (dataFromClient == null)
                    {
                        agentTcpMsbuildReader = agentMsBuildListener.AcceptTcpClient();
                    }
                } while (true);
            }
            catch (Exception ex)
            {
                Log.Error("Exception in ProcessClientMessge", ex);
            }
            finally
            {
                ATACore.TcpWrapperProcessor.TcpListenerWrapper.CloseTcpMsLogger(agentMsBuildListener, agentTcpMsbuildReader);
            }
        }
コード例 #3
0
        private string BuildMsBuildAdditionalArguments(string msbuildProjPath, IpAddressSettings ipAddressSettings, string additionalArgs, string currentAssemblyFullpath)
        {
            string additionalArguments = String.Concat(msbuildProjPath, " ", additionalArgs, " ", "/fileLoggerParameters:LogFile=MsBuildLog.txt;append=true;Verbosity=normal;Encoding=UTF-8 /l:AutomationTestAssistantCore.MsBuildLogger.TcpIpLogger,",
                                                       currentAssemblyFullpath, ";Ip=", ipAddressSettings.GetIPAddress(), ";Port=", ipAddressSettings.Port, ";");

            return(additionalArguments);
        }
コード例 #4
0
private string BuildMsBuildAdditionalArguments(string msbuildProjPath, IpAddressSettings ipAddressSettings, string additionalArgs, string currentAssemblyFullpath)
{
    string additionalArguments = String.Concat(msbuildProjPath, " ", additionalArgs, " ", "/fileLoggerParameters:LogFile=MsBuildLog.txt;append=true;Verbosity=normal;Encoding=UTF-8 /l:AutomationTestAssistantCore.MsBuildLogger.TcpIpLogger,",
        currentAssemblyFullpath, ";Ip=", ipAddressSettings.GetIPAddress(), ";Port=", ipAddressSettings.Port, ";");

    return additionalArguments;
}
コード例 #5
0
 private static void InitializeSettings()
 {
     clientSettings = new IpAddressSettings(ConfigurationManager.AppSettings["clientIp"], ConfigurationManager.AppSettings["clientPort"]);
     agentSettings = new IpAddressSettings(ConfigurationManager.AppSettings["agentIp"], ConfigurationManager.AppSettings["agentPort"]);
     msBuildLogSettings = new IpAddressSettings(ConfigurationManager.AppSettings["agentIp"], ConfigurationManager.AppSettings["msBuildAgentPort"]);
     Console.BackgroundColor = ConsoleColor.DarkGreen;
     commandsToBeExecuted = new ConcurrentQueue<string>();
     messagesToBeSend = new ConcurrentQueue<MessageArgsLogger>();
     cts = new CancellationTokenSource();
     token = cts.Token;
     currentlyExecutedProc = null;
     lockObject = new Object();         
     agentListener = new TcpListener(agentSettings.GetIPAddress(), clientSettings.Port);
     agentListener.Start();
     BaseLogger.Log.Info(AgentSettingsInitializedMsg);
     Console.WriteLine(AgentSettingsInitializedMsg);
 }