1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using Microsoft.Build.Execution;
|
---|
7 | using Microsoft.Build.Framework;
|
---|
8 |
|
---|
9 | namespace SvnForm {
|
---|
10 | class BuildLogger:ILogger {
|
---|
11 | private IEventSource eventSource;
|
---|
12 | private SvnMain buildSolution;
|
---|
13 |
|
---|
14 | public BuildLogger(SvnMain form) {
|
---|
15 | buildSolution = form;
|
---|
16 | }
|
---|
17 |
|
---|
18 | #region ILogger Members
|
---|
19 | public void Initialize(Microsoft.Build.Framework.IEventSource eventSource) {
|
---|
20 | this.eventSource = eventSource;
|
---|
21 | //eventSource.MessageRaised += new Microsoft.Build.Framework.BuildMessageEventHandler(eventSource_MessageRaised);
|
---|
22 | //eventSource.ProjectStarted += new ProjectStartedEventHandler(eventSource_ProjectStarted);
|
---|
23 | //eventSource.WarningRaised += new BuildWarningEventHandler(eventSource_WarningRaised);
|
---|
24 | //eventSource.ProjectStarted +=new ProjectStartedEventHandler(eventSource_ProjectStarted);
|
---|
25 | //eventSource.ProjectFinished += new ProjectFinishedEventHandler(eventSource_ProjectFinished);
|
---|
26 | eventSource.ErrorRaised += new BuildErrorEventHandler(eventSource_ErrorRaised);
|
---|
27 | //eventSource.StatusEventRaised += new BuildStatusEventHandler();
|
---|
28 | //eventSource.TargetFinished += new TargetFinishedEventHandler(eventSource_TargetFinished);
|
---|
29 | }
|
---|
30 |
|
---|
31 | void eventSource_MessageRaised(object sender, BuildMessageEventArgs e) {
|
---|
32 |
|
---|
33 | buildSolution.AppendTextToBuildLog("MESSAGE: " + e.Message + Environment.NewLine);
|
---|
34 |
|
---|
35 | }
|
---|
36 |
|
---|
37 | void eventSource_TargetFinished(object sender, TargetFinishedEventArgs e) {
|
---|
38 |
|
---|
39 | buildSolution.AppendTextToBuildLog("MESSAGE: " + e.Message + Environment.NewLine);
|
---|
40 | }
|
---|
41 |
|
---|
42 | void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e) {
|
---|
43 | buildSolution.AppendTextToBuildLog("ERROR: " + e.Message + Environment.NewLine);
|
---|
44 | }
|
---|
45 | public string Parameters {
|
---|
46 | get {
|
---|
47 | throw new NotImplementedException();
|
---|
48 | }
|
---|
49 | set {
|
---|
50 | throw new NotImplementedException();
|
---|
51 | }
|
---|
52 | }
|
---|
53 |
|
---|
54 | void eventSource_WarningRaised(object sender, BuildWarningEventArgs e) {
|
---|
55 | // ProjectStartedEventArgs adds ProjectFile, TargetNames
|
---|
56 | // Just the regular message string is good enough here, so just display that.
|
---|
57 | buildSolution.AppendTextToBuildLog("WARNING: " + e.Message + Environment.NewLine);
|
---|
58 | }
|
---|
59 |
|
---|
60 | void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e) {
|
---|
61 | buildSolution.AppendTextToBuildLog("Project Started: " + e.ProjectFile + Environment.NewLine);
|
---|
62 | }
|
---|
63 |
|
---|
64 | void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e) {
|
---|
65 | // The regular message string is good enough here too.
|
---|
66 | buildSolution.AppendTextToBuildLog("project Finished: " + e.ProjectFile + Environment.NewLine);
|
---|
67 | }
|
---|
68 |
|
---|
69 | public void Shutdown() {
|
---|
70 | eventSource.MessageRaised -= new Microsoft.Build.Framework.BuildMessageEventHandler(eventSource_MessageRaised);
|
---|
71 | }
|
---|
72 | //public bool IsVerbosityAtLeast(LoggerVerbosity checkVerbosity);
|
---|
73 |
|
---|
74 | public LoggerVerbosity Verbosity {
|
---|
75 | get {
|
---|
76 | throw new NotImplementedException();
|
---|
77 | }
|
---|
78 | set {
|
---|
79 | throw new NotImplementedException();
|
---|
80 | }
|
---|
81 | }
|
---|
82 |
|
---|
83 | #endregion
|
---|
84 | }
|
---|
85 | }
|
---|