/// <summary> /// Creates a new Task instance. /// </summary> /// <param name="fileName">The file that the task refers to. Use null if the task does not refer to a file.</param> /// <param name="description">Description of the task. This parameter cannot be null.</param> /// <param name="column">Task column (1-based), use 0 if no column is known</param> /// <param name="line">Task line (1-based), use 0 if no line number is known</param> /// <param name="type">Type of the task</param> public SDTask(FileName fileName, string description, int column, int line, TaskType type) { if (description == null) throw new ArgumentNullException("description"); this.type = type; this.description = description.Trim(); if (fileName != null) { hasLocation = line >= 1; this.position = new PermanentAnchor(fileName, Math.Max(1, line), Math.Max(1, column)); position.Deleted += position_Deleted; } }
public SDTask(BuildError error) { if (error == null) throw new ArgumentNullException("error"); type = error.IsWarning ? TaskType.Warning : TaskType.Error; int line = Math.Max(error.Line, 1); int column = Math.Max(error.Column, 1); if (!string.IsNullOrEmpty(error.FileName)) { hasLocation = error.Line >= 1; this.position = new PermanentAnchor(FileName.Create(error.FileName), line, column); position.Deleted += position_Deleted; } if (string.IsNullOrEmpty(error.ErrorCode)) { description = error.ErrorText; } else { description = error.ErrorText + " (" + error.ErrorCode + ")"; } if (error.ContextMenuAddInTreeEntry != null) { ContextMenuAddInTreeEntry = error.ContextMenuAddInTreeEntry; } this.Tag = error.Tag; this.BuildError = error; }
public SDTask(Error error) { if (error == null) throw new ArgumentNullException("error"); switch (error.ErrorType) { case ErrorType.Error: type = TaskType.Error; break; case ErrorType.Warning: type = TaskType.Warning; break; } description = error.Message; //hasLocation = !error.Region.IsEmpty; }