Beispiel #1
0
 /// <summary>
 /// Parse the comm message and create build request.
 /// </summary>
 /// <param name="msg"></param>
 private void ProcessbuildRequest(CommMessage msg)
 {
     if (msg != null)
     {
         string requestFile = msg.Arguments[CommCommands.BuildReqArguements.PROJECT];
         requestFile = Path.Combine(this.CommunicationObject.GetBaseDirectory(), requestFile);
         if (File.Exists(requestFile))
         {
             try
             {
                 ClientRequestDO requestDO = ClientRequestDO.GenerateClientRequestFromXML(requestFile);
                 if (requestDO != null)
                 {
                     BuildRequestDO request = new BuildRequestDO
                     {
                         ClientID          = msg.Arguments[CommCommands.CLIENTDETAILS],
                         Language          = ParseLanguage(requestDO.Language),
                         FilesToBuild      = requestDO.BuildFiles.ToList(),
                         CompilerOptions   = requestDO.CompilerOptions,
                         ClientRequestFile = Path.GetFileName(requestFile)
                     };
                     this.Compile(request);
                 }
             }
             catch (Exception) { }
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Get build request details to log to file.
        /// </summary>
        /// <param name="buildRequest"></param>
        /// <returns></returns>
        private string WriteBuildRequestLog(BuildRequestDO buildRequest)
        {
            StringBuilder logWriter = new StringBuilder();

            logWriter.Append("Build request - " + this.SessionID + Environment.NewLine).AppendLine();
            logWriter.Append("Language = C#").AppendLine();
            logWriter.Append("Compiler Flags = " + buildRequest.CompilerOptions).AppendLine();
            return(logWriter.ToString());
        }
Beispiel #3
0
        private void SendReadyMessage()
        {
            this.files.Clear();
            this.currentBuildRequest = null;
            this.CommunicationObject.SetBaseDirectory(this.directory);
            CommMessage readyMessage = new CommMessage(CommMessage.MessageType.Request)
            {
                Command = CommCommands.READY,
                To      = defaultConfigs[Identity.MotherProcess].ServiceURL
            };

            CommunicationObject.PostMessage(readyMessage);
        }
Beispiel #4
0
        /// <summary>
        /// Logic to compile c# code.
        /// </summary>
        /// <param name="sessionID"></param>
        /// <param name="buildRequestDO"></param>
        private void Compile(BuildRequestDO buildRequest)
        {
            this.SessionID           = "Change";
            this.currentBuildRequest = buildRequest;
            directory = CommunicationObject.GetBaseDirectory();
            string sessionDir = Path.GetFullPath(Directory.CreateDirectory(Path.Combine(CommunicationObject.GetBaseDirectory(), this.SessionID)).FullName);

            currentBuildRequest.SessionDir = sessionDir;
            currentBuildRequest.SessionId  = this.SessionID;
            CommunicationObject.SetBaseDirectory(sessionDir);
            Console.WriteLine("Build request received. RequestID - " + SessionID);
            List <string> projectFiles = buildRequest.FilesToBuild;

            GetFilesToBuild(projectFiles);
        }