private string getText(CacheBuildMessage message)
 {
     if (File.Exists(Path.Combine(Path.GetDirectoryName(message.Project), message.BuildItem.File)))
     {
         return(string.Format(
                    "Project: {0}{6}{6}" +
                    "File: {4}{1}:line {2}{5}{6}{6}" +
                    "Message:{6}{3}",
                    message.Project,
                    message.BuildItem.File,
                    message.BuildItem.LineNumber,
                    message.BuildItem.ErrorMessage,
                    LinkParser.TAG_START,
                    LinkParser.TAG_END,
                    Environment.NewLine));
     }
     else
     {
         return(string.Format(
                    "Project: {0}{4}" +
                    "File: {1}:line {2}{4}" +
                    "Message:{4}{3}",
                    message.Project,
                    message.BuildItem.File,
                    message.BuildItem.LineNumber,
                    message.BuildItem.ErrorMessage,
                    Environment.NewLine));
     }
 }
 private void onBuildMessage(CacheBuildMessage cacheBuildMessage, bool isRunning)
 {
     if (isRunning)
     {
         displayAndOrder(new string[] { _errorDescription.Name, _cancelRun.Name });
     }
     else
     {
         displayAndOrder(new string[] { _errorDescription.Name });
     }
 }
        public void Should_serialize_chache_build_message()
        {
            var item = new BuildMessage()
            {
                ErrorMessage = "message", File = "file", LineNumber = 1, LinePosition = 2
            };
            var message = new CacheBuildMessage("project", item);
            var output  = serializeDeserialize(message);

            Assert.AreEqual("project", output.Project);
            Assert.AreEqual("message", output.BuildItem.ErrorMessage);
            Assert.AreEqual("file", output.BuildItem.File);
            Assert.AreEqual(1, output.BuildItem.LineNumber);
            Assert.AreEqual(2, output.BuildItem.LinePosition);
        }
Beispiel #4
0
        private void parseLine(string line)
        {
            if (line.Contains("------ Build started: Project:"))
            {
                getProject(line);
            }
            if (line.StartsWith("Compile complete --"))
            {
                _currentWasCompiled = true;
            }
            if (line.StartsWith(string.Format("  {0} -> ", _currentProjectID)))
            {
                _currentAssembly = getAssembly(line);
            }
            string id = null;

            if (line.Contains(": error"))
            {
                id = ": error";
            }
            if (line.StartsWith("fatal error"))
            {
                id = "fatal error";
            }
            if (line.Contains(": warning"))
            {
                id = ": warning";
            }
            if (id == null)
            {
                return;
            }
            var    fileRaw    = line.Substring(0, line.IndexOf(id));
            string file       = "";
            int    lineNumber = 0;
            int    column     = 0;

            if (fileRaw.IndexOf("(") != -1)
            {
                file = fileRaw.Substring(0, fileRaw.IndexOf("("));
                var locationRaw = fileRaw.Substring(fileRaw.IndexOf("(") + 1, fileRaw.IndexOf(")") - (fileRaw.IndexOf("(") + 1));
                var location    = locationRaw.Split(new char[] { ',' });
                lineNumber = int.Parse(location[0]);
                column     = int.Parse(location[1]);
            }
            var message  = line.Substring(line.IndexOf(id) + id.Length, line.Length - (line.IndexOf(id) + id.Length)).Trim();
            var cacheMsg = new CacheBuildMessage(_currentProject, new Messages.BuildMessage()
            {
                File = file, LineNumber = lineNumber, LinePosition = column, ErrorMessage = message
            });

            if (id == ": error")
            {
                if (_currentErrors.Count(x => x.Equals(cacheMsg)) == 0)
                {
                    _currentErrors.Add(cacheMsg);
                }
            }
            else
            {
                if (_currentWarnings.Count(x => x.Equals(cacheMsg)) == 0)
                {
                    _currentWarnings.Add(cacheMsg);
                }
            }
        }
Beispiel #5
0
 private void onBuildMessage(CacheBuildMessage cacheBuildMessage)
 {
     displayAndOrder(new string[] { _control.linkLabelErrorDescription.Name });
     //displayAndOrder(new string[] { _control.linkLabelErrorDescription.Name, _control.linkLabelSystemMessages.Name });
 }
Beispiel #6
0
 private void goToBuildItemReference(CacheBuildMessage buildItem)
 {
     goToReference(buildItem.BuildItem.File, buildItem.BuildItem.LineNumber, buildItem.BuildItem.LinePosition);
 }
Beispiel #7
0
 private string formatBuildResult(CacheBuildMessage item)
 {
     return(string.Format("{0}, {1}", item.BuildItem.ErrorMessage, item.BuildItem.File));
 }
 public DetailBuilder(CacheBuildMessage message)
 {
     Text  = getText(message);
     Links = getLinks();
 }