Datei: NDOPackage/TabProperties.cs

Last Commit (3030986)
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 EnvDTE;
25
26 namespace NETDataObjects. NDOVSPackage
27 {
28 ····internal class TabProperty
29 ····{
30 ········short indentSize;
31 ········public short IndentSize
32 ········{
33 ············get { return indentSize; }
34 ········}
35 ········bool useSpaces;
36 ········public bool UseSpaces
37 ········{
38 ············get { return useSpaces; }
39 ········}
40 ········public string Indent
41 ········{
42 ············get
43 ············{
44 ················if (!useSpaces)
45 ················{
46 ····················return "\t";
47 ················}
48 ················else
49 ················{
50 ····················string spc = string.Empty;
51 ····················for(int count = 0; count < this.indentSize; count++)
52 ························spc += " ";
53 ····················return spc;
54 ················}
55
56 ············}
57 ········}
58
59 ········public TabProperty(Properties props)
60 ········{
61 ············string s = string.Empty;
62 ············useSpaces = !((bool)props.Item("InsertTabs").Value);
63 ············indentSize = (short) props.Item("IndentSize").Value;
64 ········}
65 ····}
66
67 ····/// <summary>
68 ····/// Zusammenfassung für TabProperties.
69 ····/// </summary>
70 ····internal class TabProperties
71 ····{
72 //········static TabProperties instance = new TabProperties();
73
74 ········public static TabProperties Instance
75 ········{
76 ············get { return new TabProperties(); }
77 ········}
78
79 ········TabProperty cSharp;
80 ········public TabProperty CSharp
81 ········{
82 ············get { return cSharp; }
83 ········}
84 ········
85 ········TabProperty vBasic;
86 ········public TabProperty VBasic
87 ········{
88 ············get { return vBasic; }
89 ········}
90 ········
91 ········TabProperties()
92 ········{
93 ············try
94 ············{
95 ················_DTE app = ApplicationObject.VisualStudioApplication;
96 ················Properties props = app.get_Properties("TextEditor", "Basic");
97 ················vBasic = new TabProperty(props);
98 ················props = app.get_Properties("TextEditor", "CSharp");
99 ················cSharp = new TabProperty(props);
100 ············}
101 ············catch (Exception ex)
102 ············{
103 ················System.Windows.Forms.MessageBox.Show(ex.ToString());
 
 
 
 
 
104 ············}
105 ········}
106 ····}
107
108 ····
109 }
110
New Commit (ed9120d)
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 EnvDTE;
25
26 namespace NDOVsPackage
27 {
28 ····internal class TabProperty
29 ····{
30 ········short indentSize;
31 ········public short IndentSize
32 ········{
33 ············get { return indentSize; }
34 ········}
35 ········bool useSpaces;
36 ········public bool UseSpaces
37 ········{
38 ············get { return useSpaces; }
39 ········}
40 ········public string Indent
41 ········{
42 ············get
43 ············{
44 ················if (!useSpaces)
45 ················{
46 ····················return "\t";
47 ················}
48 ················else
49 ················{
50 ····················string spc = string.Empty;
51 ····················for(int count = 0; count < this.indentSize; count++)
52 ························spc += " ";
53 ····················return spc;
54 ················}
55
56 ············}
57 ········}
58
59 ········public TabProperty(Properties props)
60 ········{
61 ············string s = string.Empty;
62 ············useSpaces = !((bool)props.Item("InsertTabs").Value);
63 ············indentSize = (short) props.Item("IndentSize").Value;
64 ········}
65 ····}
66
67 ····/// <summary>
68 ····/// Zusammenfassung für TabProperties.
69 ····/// </summary>
70 ····internal class TabProperties
71 ····{
72 //········static TabProperties instance = new TabProperties();
73
74 ········public static TabProperties Instance
75 ········{
76 ············get { return new TabProperties(); }
77 ········}
78
79 ········TabProperty cSharp;
80 ········public TabProperty CSharp
81 ········{
82 ············get { return cSharp; }
83 ········}
84 ········
85 ········TabProperty vBasic;
86 ········public TabProperty VBasic
87 ········{
88 ············get { return vBasic; }
89 ········}
90 ········
91 ········TabProperties()
92 ········{
93 ············try
94 ············{
95 ················_DTE app = ApplicationObject.VisualStudioApplication;
96 ················Properties props = app.get_Properties("TextEditor", "Basic");
97 ················vBasic = new TabProperty(props);
98 ················props = app.get_Properties("TextEditor", "CSharp");
99 ················cSharp = new TabProperty(props);
100 ············}
101 ············catch (Exception ex)
102 ············{
103 ················System.Windows.Forms.MessageBox.Show(ex.ToString());
104 ············}
105 ········}
106 ····}
107
108 ····
109 }
110 }
111 ····}
112
113 ····
114 }
115