1- //-----------------------------------------------------------------------------
2- // Copyright (c) Microsoft Corporation. All rights reserved.
3- //-----------------------------------------------------------------------------
1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+ // See the LICENSE file in the project root for more information.
4+
45namespace Microsoft . Tools . ServiceModel . SvcUtil
56{
67 using System ;
@@ -18,29 +19,29 @@ internal enum SwitchType
1819
1920 internal class CommandSwitch
2021 {
21- readonly string name ;
22- readonly string abbreviation ;
23- readonly SwitchType switchType ;
22+ private readonly string _name ;
23+ private readonly string _abbreviation ;
24+ private readonly SwitchType _switchType ;
2425
2526 internal CommandSwitch ( string name , string abbreviation , SwitchType switchType )
2627 {
2728 //ensure that either name doesn't start with '/' or '-'
2829 //also convert to lower-case
2930 if ( ( name [ 0 ] == '/' ) || ( name [ 0 ] == '-' ) )
30- this . name = ( name . Substring ( 1 ) ) . ToLower ( CultureInfo . InvariantCulture ) ;
31+ _name = ( name . Substring ( 1 ) ) . ToLower ( CultureInfo . InvariantCulture ) ;
3132 else
32- this . name = name . ToLower ( CultureInfo . InvariantCulture ) ;
33+ _name = name . ToLower ( CultureInfo . InvariantCulture ) ;
3334 if ( ( abbreviation [ 0 ] == '/' ) || ( abbreviation [ 0 ] == '-' ) )
34- this . abbreviation = ( abbreviation . Substring ( 1 ) ) . ToLower ( CultureInfo . InvariantCulture ) ;
35+ _abbreviation = ( abbreviation . Substring ( 1 ) ) . ToLower ( CultureInfo . InvariantCulture ) ;
3536 else
36- this . abbreviation = abbreviation . ToLower ( CultureInfo . InvariantCulture ) ;
37+ _abbreviation = abbreviation . ToLower ( CultureInfo . InvariantCulture ) ;
3738
38- this . switchType = switchType ;
39+ _switchType = switchType ;
3940 }
4041
4142 internal string Name
4243 {
43- get { return name ; }
44+ get { return _name ; }
4445 }
4546
4647#if NotUsed
@@ -52,7 +53,7 @@ internal string Abbreviation
5253
5354 internal SwitchType SwitchType
5455 {
55- get { return switchType ; }
56+ get { return _switchType ; }
5657 }
5758
5859 internal bool Equals ( string other )
@@ -67,10 +68,10 @@ internal bool Equals(string other)
6768 temp = other . ToLower ( CultureInfo . InvariantCulture ) ;
6869
6970 //if equal to name, then return the OK
70- if ( name . Equals ( temp ) )
71+ if ( _name . Equals ( temp ) )
7172 return true ;
7273 //now check abbreviation
73- return abbreviation . Equals ( temp ) ;
74+ return _abbreviation . Equals ( temp ) ;
7475 }
7576
7677 internal static CommandSwitch FindSwitch ( string name , CommandSwitch [ ] switches )
@@ -85,11 +86,11 @@ internal static CommandSwitch FindSwitch(string name, CommandSwitch[] switches)
8586
8687 internal class ArgumentDictionary
8788 {
88- Dictionary < string , IList < string > > contents ;
89+ private Dictionary < string , IList < string > > _contents ;
8990
9091 internal ArgumentDictionary ( int capacity )
9192 {
92- contents = new Dictionary < string , IList < string > > ( capacity ) ;
93+ _contents = new Dictionary < string , IList < string > > ( capacity ) ;
9394 }
9495
9596 internal void Add ( string key , string value )
@@ -109,7 +110,7 @@ internal void Add(string key, string value)
109110 internal string GetArgument ( string key )
110111 {
111112 IList < string > values ;
112- if ( contents . TryGetValue ( key . ToLower ( CultureInfo . InvariantCulture ) , out values ) )
113+ if ( _contents . TryGetValue ( key . ToLower ( CultureInfo . InvariantCulture ) , out values ) )
113114 {
114115#if SM_TOOL
115116 Tool . Assert ( ( values . Count == 1 ) , "contains more than one argument please call GetArguments" ) ;
@@ -126,32 +127,29 @@ internal string GetArgument(string key)
126127 internal IList < string > GetArguments ( string key )
127128 {
128129 IList < string > result ;
129- if ( ! contents . TryGetValue ( key . ToLower ( CultureInfo . InvariantCulture ) , out result ) )
130+ if ( ! _contents . TryGetValue ( key . ToLower ( CultureInfo . InvariantCulture ) , out result ) )
130131 result = new List < string > ( ) ;
131132 return result ;
132133 }
133134
134135 internal bool ContainsArgument ( string key )
135136 {
136- return contents . ContainsKey ( key . ToLower ( CultureInfo . InvariantCulture ) ) ;
137+ return _contents . ContainsKey ( key . ToLower ( CultureInfo . InvariantCulture ) ) ;
137138 }
138139
139140 internal void Add ( string key , IList < string > values )
140141 {
141- contents . Add ( key . ToLower ( CultureInfo . InvariantCulture ) , values ) ;
142+ _contents . Add ( key . ToLower ( CultureInfo . InvariantCulture ) , values ) ;
142143 }
143144
144145 internal int Count
145146 {
146- get { return contents . Count ; }
147+ get { return _contents . Count ; }
147148 }
148-
149149 }
150150
151151 internal static class CommandParser
152152 {
153-
154-
155153 internal static ArgumentDictionary ParseCommand ( string [ ] cmd , CommandSwitch [ ] switches )
156154 {
157155 ArgumentDictionary arguments ; //switches/values from cmd line
@@ -242,7 +240,5 @@ internal static ArgumentDictionary ParseCommand(string[] cmd, CommandSwitch[] sw
242240
243241 return arguments ;
244242 }
245-
246243 }
247-
248244}
0 commit comments