PageRenderTime 26ms CodeModel.GetById 11ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/src/AddIns/Misc/PackageManagement/SharpDevelop.EnvDTE/Src/Globals.vb

https://github.com/ajadex/SharpDevelop
Visual Basic | 63 lines | 30 code | 7 blank | 26 comment | 0 complexity | 8654182b4c1e1d9820ecb088b46affcd MD5 | raw file
 1' Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
 2' 
 3' Permission is hereby granted, free of charge, to any person obtaining a copy of this
 4' software and associated documentation files (the "Software"), to deal in the Software
 5' without restriction, including without limitation the rights to use, copy, modify, merge,
 6' publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
 7' to whom the Software is furnished to do so, subject to the following conditions:
 8' 
 9' The above copyright notice and this permission notice shall be included in all copies or
10' substantial portions of the Software.
11' 
12' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13' INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14' PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15' FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16' OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17' DEALINGS IN THE SOFTWARE.
18
19Namespace EnvDTE
20	
21	''' <summary>
22	''' EnvDTE.Globals class defined in VB.NET so multiple parameterized properties can be defined
23	''' which are not supported in C#. This allows Powershell to use the properties as methods:
24	''' 
25	''' $dte.Solution.Globals.VariablePersists("MyVariable") = $true
26	''' $dte.Solution.Globals.VariablePersists("MyVariable")
27	''' $dte.Solution.Globals.VariableValue("MyVariable") = "path/to/tool"
28	''' $dte.Solution.Globals.VariablePersists("MyVariable") = $true
29	''' </summary>
30	Public MustInherit Class Globals
31		Public Property VariableValue(ByVal name As String) As Object
32			Get
33				Return GetVariableValue(name)
34			End Get
35			Set
36				SetVariableValue(name, value)
37			End Set
38		End Property
39		
40		Protected MustOverride Function GetVariableValue(ByVal name As String) As Object
41		Protected MustOverride Sub SetVariableValue(ByVal name As String, ByVal value As Object)
42		
43		Public Property VariablePersists(ByVal name As String) As Boolean
44			Get
45				Return GetVariablePersists(name)
46			End Get
47			Set
48				SetVariablePersists(name, value)
49			End Set
50		End Property
51		
52		Protected MustOverride Function GetVariablePersists(ByVal name As String) As Boolean
53		Protected MustOverride Sub SetVariablePersists(ByVal name As String, ByVal value As Boolean)
54		
55		Public ReadOnly Property VariableExists(ByVal name As string) As Boolean
56			Get
57				Return GetVariableExists(name)
58			End Get
59		End Property
60		
61		Protected MustOverride Function GetVariableExists(ByVal name As String) As Boolean
62	End Class
63End Namespace