/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. Namespace EnvDTE
  19. ''' <summary>
  20. ''' EnvDTE.Globals class defined in VB.NET so multiple parameterized properties can be defined
  21. ''' which are not supported in C#. This allows Powershell to use the properties as methods:
  22. '''
  23. ''' $dte.Solution.Globals.VariablePersists("MyVariable") = $true
  24. ''' $dte.Solution.Globals.VariablePersists("MyVariable")
  25. ''' $dte.Solution.Globals.VariableValue("MyVariable") = "path/to/tool"
  26. ''' $dte.Solution.Globals.VariablePersists("MyVariable") = $true
  27. ''' </summary>
  28. Public MustInherit Class Globals
  29. Public Property VariableValue(ByVal name As String) As Object
  30. Get
  31. Return GetVariableValue(name)
  32. End Get
  33. Set
  34. SetVariableValue(name, value)
  35. End Set
  36. End Property
  37. Protected MustOverride Function GetVariableValue(ByVal name As String) As Object
  38. Protected MustOverride Sub SetVariableValue(ByVal name As String, ByVal value As Object)
  39. Public Property VariablePersists(ByVal name As String) As Boolean
  40. Get
  41. Return GetVariablePersists(name)
  42. End Get
  43. Set
  44. SetVariablePersists(name, value)
  45. End Set
  46. End Property
  47. Protected MustOverride Function GetVariablePersists(ByVal name As String) As Boolean
  48. Protected MustOverride Sub SetVariablePersists(ByVal name As String, ByVal value As Boolean)
  49. Public ReadOnly Property VariableExists(ByVal name As string) As Boolean
  50. Get
  51. Return GetVariableExists(name)
  52. End Get
  53. End Property
  54. Protected MustOverride Function GetVariableExists(ByVal name As String) As Boolean
  55. End Class
  56. End Namespace