Datei: NDOPackage/MessageAdapter.cs

Last Commit (33e9857)
1 //
2 // Copyright ( c) 2002-2019 Mirko Matytschak
3 // (www.netdataobjects.de)
4 //
5 // Author: Mirko Matytschak
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
8 // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
10 // Software, and to permit persons to whom the Software is furnished to do so, subject to the following
11 // conditions:
12
13 // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 // of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 // DEALINGS IN THE SOFTWARE.
21
22
23 using System;
24 using Community.VisualStudio.Toolkit;
25
26 namespace NDOVsPackage
27 {
28 ····/// <summary>
29 ····/// Summary description for MessageAdapter.
30 ····/// </summary>
31 ····internal class MessageAdapter
32 ····{
33 ········int indent = 0;
34 ········bool success = true;
35 ········private OutputWindowPane········outputPane = null;
36
37 ········public MessageAdapter( )
38 ········{
39 ············ThreadHelper.JoinableTaskFactory.Run(async () =>
40 ············{
41 ················this.outputPane = await VS.Windows.GetOutputWindowPaneAsync(Community.VisualStudio.Toolkit.Windows.VSOutputWindowPane.Build);
42 ············});
43 ········}
44
45
46
47 ········public void Indent() { indent += 2; }
48 ········public void Unindent()
49 ········{
50 ············if (indent >= 2)
51 ················indent -= 2;
52 ········}
53
54 ········
55 ········public void
56 ········WriteInsertedLine( String text )
57 ········{
58 ············Indent();
59 ············WriteLine(text);
60 ············Unindent();
61 ········}
62 ········
63
64 ········public void
65 ········WriteLine( String text )
66 ········{
67 ············if (outputPane == null)
68 ················return;
69
70 ············string indentStr = string.Empty;
71 ············for (int i = 0; i < indent; i++)
72 ················indentStr += ' ';
73 ············
74 ············if ( null != outputPane )
75 ················outputPane.WriteLine( indentStr + text );
76 ········}
77 ····}
78 }
79
New Commit (aa458ff)
1 //
2 // Copyright ( c) 2002-2022 Mirko Matytschak
3 // (www.netdataobjects.de)
4 //
5 // Author: Mirko Matytschak
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
8 // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
10 // Software, and to permit persons to whom the Software is furnished to do so, subject to the following
11 // conditions:
12
13 // The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 // of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
17 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 // DEALINGS IN THE SOFTWARE.
21
22
23 using System;
24 using Community.VisualStudio.Toolkit;
25
26 namespace NDOVsPackage
27 {
28 ····/// <summary>
29 ····/// Summary description for MessageAdapter.
30 ····/// </summary>
31 ····internal class MessageAdapter
32 ····{
33 ········int indent = 0;
 
34 ········private OutputWindowPane········outputPane = null;
35
36 ········public MessageAdapter( )
37 ········{
38 ············ThreadHelper.JoinableTaskFactory.Run(async () =>
39 ············{
40 ················this.outputPane = await VS.Windows.GetOutputWindowPaneAsync(Community.VisualStudio.Toolkit.Windows.VSOutputWindowPane.Build);
41 ············});
42 ········}
43
44
45
46 ········public void Indent() { indent += 2; }
47 ········public void Unindent()
48 ········{
49 ············if (indent >= 2)
50 ················indent -= 2;
51 ········}
52
53 ········
54 ········public void
55 ········WriteInsertedLine( String text )
56 ········{
57 ············Indent();
58 ············WriteLine(text);
59 ············Unindent();
60 ········}
61 ········
62
63 ········public void
64 ········WriteLine( String text )
65 ········{
66 ············if (outputPane == null)
67 ················return;
68
69 ············string indentStr = string.Empty;
70 ············for (int i = 0; i < indent; i++)
71 ················indentStr += ' ';
72 ············
73 ············if ( null != outputPane )
74 ················outputPane.WriteLine( indentStr + text );
75 ········}
76 ····}
77 }
78