Browse Source
Added a VB.NET Globals class which implements multiple parameterised properties which are not supported in C#. This allows Powershell to use properties on the Globals class as though they were methods: $dte.Solution.Globals.VariableValue("MyValue") = "value" Write-Host $dte.Solution.Globals.VariableValue("MyValue") $dte.Solution.Globals.VariablePersists("MyValue") = $true Write-Host $dte.Solution.Globals.VariablePersists("MyValue")pull/28/head
11 changed files with 232 additions and 76 deletions
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
Imports System.Reflection |
||||
Imports System.Runtime.CompilerServices |
||||
Imports System.Runtime.InteropServices |
||||
|
||||
' Information about this assembly is defined by the following |
||||
' attributes. |
||||
' |
||||
' change them to the information which is associated with the assembly |
||||
' you compile. |
||||
|
||||
<assembly: AssemblyTitle("PackageManagement.EnvDTEHelpers")> |
||||
<assembly: AssemblyDescription("EnvDTE helpers for SharpDevelop")> |
||||
<assembly: AssemblyConfiguration("")> |
||||
<assembly: AssemblyCompany("ic#code")> |
||||
<assembly: AssemblyProduct("SharpDevelop")> |
||||
<assembly: AssemblyCopyright("2000-2012 AlphaSierraPapa for the SharpDevelop Team")> |
||||
<assembly: AssemblyTrademark("")> |
||||
<assembly: AssemblyCulture("")> |
||||
|
||||
' This sets the default COM visibility of types in the assembly to invisible. |
||||
' If you need to expose a type to COM, use <ComVisible(true)> on that type. |
||||
<assembly: ComVisible(False)> |
||||
|
||||
' The assembly version has following format : |
||||
' |
||||
' Major.Minor.Build.Revision |
||||
' |
||||
' You can specify all values by your own or you can build default build and revision |
||||
' numbers with the '*' character (the default): |
||||
|
||||
<assembly: AssemblyVersion("4.3.0")> |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
' Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) |
||||
' This code is distributed under the GNU LGPL (for details please see \doc\license.txt) |
||||
|
||||
''' <summary> |
||||
''' EnvDTE.Globals class defined in VB.NET so multiple parameterized properties can be defined |
||||
''' which are not supported in C#. This allows Powershell to use the properties as methods: |
||||
''' |
||||
''' $dte.Solution.Globals.VariablePersists("MyVariable") = $true |
||||
''' $dte.Solution.Globals.VariablePersists("MyVariable") |
||||
''' $dte.Solution.Globals.VariableValue("MyVariable") = "path/to/tool" |
||||
''' $dte.Solution.Globals.VariablePersists("MyVariable") = $true |
||||
''' </summary> |
||||
Public MustInherit Class Globals |
||||
Public Property VariableValue(ByVal name As String) As Object |
||||
Get |
||||
Return GetVariableValue(name) |
||||
End Get |
||||
Set |
||||
SetVariableValue(name, value) |
||||
End Set |
||||
End Property |
||||
|
||||
Protected MustOverride Function GetVariableValue(ByVal name As String) As Object |
||||
Protected MustOverride Sub SetVariableValue(ByVal name As String, ByVal value As Object) |
||||
|
||||
Public Property VariablePersists(ByVal name As String) As Boolean |
||||
Get |
||||
Return GetVariablePersists(name) |
||||
End Get |
||||
Set |
||||
SetVariablePersists(name, value) |
||||
End Set |
||||
End Property |
||||
|
||||
Protected MustOverride Function GetVariablePersists(ByVal name As String) As Boolean |
||||
Protected MustOverride Sub SetVariablePersists(ByVal name As String, ByVal value As Boolean) |
||||
|
||||
Public ReadOnly Property VariableExists(ByVal name As string) As Boolean |
||||
Get |
||||
Return GetVariableExists(name) |
||||
End Get |
||||
End Property |
||||
|
||||
Protected MustOverride Function GetVariableExists(ByVal name As String) As Boolean |
||||
End Class |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{F7886FB7-3764-4574-B981-25EB164B532E}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<MyType>Windows</MyType> |
||||
<RootNamespace>ICSharpCode.PackageManagement.EnvDTE</RootNamespace> |
||||
<AssemblyName>PackageManagement.EnvDTEHelpers</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<OptionInfer>On</OptionInfer> |
||||
<OutputPath>..\..\..\..\..\..\AddIns\Misc\PackageManagement\</OutputPath> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>True</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<DefineConstants>DEBUG=1,TRACE=1</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<DefineConstants>TRACE=1</DefineConstants> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core" /> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Xml" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Import Include="Microsoft.VisualBasic" /> |
||||
<Import Include="System" /> |
||||
<Import Include="System.Collections" /> |
||||
<Import Include="System.Collections.Generic" /> |
||||
<Import Include="System.Data" /> |
||||
<Import Include="System.Diagnostics" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="Globals.vb" /> |
||||
<Compile Include="Configuration\AssemblyInfo.vb" /> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> |
||||
</Project> |
Loading…
Reference in new issue