Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianst85 committed Feb 8, 2016
0 parents commit 6ccb94e
Show file tree
Hide file tree
Showing 27 changed files with 1,680 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
QuickConnectPlugin.suo
QuickConnectPlugin.Tests/bin/
QuickConnectPlugin.Tests/obj/
QuickConnectPlugin/bin/
QuickConnectPlugin/obj/
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,3 @@
0.1.0

First version. No release history before this.
339 changes: 339 additions & 0 deletions COPYING

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions LICENSE
@@ -0,0 +1,18 @@
# Copyright (C) 2016, Cristian Stoica.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, version 2 or later.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# For more information on the GPL, please go to
# http://www.gnu.org/licenses/gpl-2.0.html, or see COPYING file
# included.
36 changes: 36 additions & 0 deletions QuickConnectPlugin.Tests/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QuickConnectPlugin.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cristian Stoica")]
[assembly: AssemblyProduct("QuickConnectPlugin.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016 Cristian Stoica")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f2df55cf-48db-4d0c-9192-94b6d4cbfd37")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
58 changes: 58 additions & 0 deletions QuickConnectPlugin.Tests/QuickConnectPlugin.Tests.csproj
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6B58F95D-3205-4B21-820F-87BD5FAF5F84}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>QuickConnectPlugin.Tests</RootNamespace>
<AssemblyName>QuickConnectPlugin.Tests</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="UtilsTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\QuickConnectPlugin\QuickConnectPlugin.csproj">
<Project>{6027B153-E1DA-4272-9F9D-D870C27DB630}</Project>
<Name>QuickConnectPlugin</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
18 changes: 18 additions & 0 deletions QuickConnectPlugin.Tests/UtilsTests.cs
@@ -0,0 +1,18 @@
using NUnit.Framework;

namespace QuickConnectPlugin.Tests {

[TestFixture]
public class UtilsTests {

[Test]
public void IsOlderRemoteDesktopConnectionVersion() {
Assert.IsFalse(Utils.IsOlderRemoteDesktopConnectionVersion());
}

[Test]
public void GetVMwareVSphereClientPath() {
Assert.AreEqual(@"C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe", Utils.GetVMwareVSphereClientPath());
}
}
}
34 changes: 34 additions & 0 deletions QuickConnectPlugin.sln
@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickConnectPlugin", "QuickConnectPlugin\QuickConnectPlugin.csproj", "{6027B153-E1DA-4272-9F9D-D870C27DB630}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickConnectPlugin.Tests", "QuickConnectPlugin.Tests\QuickConnectPlugin.Tests.csproj", "{6B58F95D-3205-4B21-820F-87BD5FAF5F84}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CAEB41BA-0F12-42EF-8D32-328F63A0C7D2}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
COPYING = COPYING
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6027B153-E1DA-4272-9F9D-D870C27DB630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6027B153-E1DA-4272-9F9D-D870C27DB630}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6027B153-E1DA-4272-9F9D-D870C27DB630}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6027B153-E1DA-4272-9F9D-D870C27DB630}.Release|Any CPU.Build.0 = Release|Any CPU
{6B58F95D-3205-4B21-820F-87BD5FAF5F84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B58F95D-3205-4B21-820F-87BD5FAF5F84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B58F95D-3205-4B21-820F-87BD5FAF5F84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B58F95D-3205-4B21-820F-87BD5FAF5F84}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
40 changes: 40 additions & 0 deletions QuickConnectPlugin/Commons/AssemblyUtils.cs
@@ -0,0 +1,40 @@
using System;
using System.IO;
using System.Reflection;

namespace QuickConnectPlugin.Commons {

public static class AssemblyUtils {

public static String GetApplicationPath() {
return new Uri(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
}

public static String GetApplicationDirPath() {
return Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath);
}

public static Version GetVersion() {
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
return assembly.GetName().Version;
}

public static Version GetVersion(String assemblyName) {
System.Reflection.Assembly assembly = System.Reflection.Assembly.Load(assemblyName);
return assembly.GetName().Version;
}

public static Assembly AssemblyResolver(object sender, ResolveEventArgs args) {
string resourceName = new AssemblyName(args.Name).Name + ".dll";
string resource = Array.Find(Assembly.GetExecutingAssembly().GetManifestResourceNames(), element => element.EndsWith(resourceName));
if (resource != null) {
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource)) {
Byte[] assemblyData = new Byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData);
}
}
return null;
}
}
}
10 changes: 10 additions & 0 deletions QuickConnectPlugin/OSType.cs
@@ -0,0 +1,10 @@
namespace QuickConnectPlugin {

public enum OSType {

Unknown = 0,
Windows = 1,
Linux = 2,
ESXi = 3,
}
}
25 changes: 25 additions & 0 deletions QuickConnectPlugin/OSTypeUtils.cs
@@ -0,0 +1,25 @@
using System;

namespace QuickConnectPlugin {

public static class OSTypeUtils {

public static OSType GetOSTypeFromString(String operatingSystem) {
if (String.IsNullOrEmpty(operatingSystem)) {
return OSType.Unknown;
}
else if (operatingSystem.ToLower().Contains("windows")) {
return OSType.Windows;
}
else if (operatingSystem.ToLower().Contains("esxi") || operatingSystem.ToLower().Contains("vcenter")) {
return OSType.ESXi;
}
else if (operatingSystem.ToLower().Contains("linux")) {
return OSType.Linux;
}
else {
return OSType.Unknown;
}
}
}
}
36 changes: 36 additions & 0 deletions QuickConnectPlugin/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QuickConnectPlugin")]
[assembly: AssemblyDescription("Quick connect to Windows/Linux/ESXi hosts.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cristian Stoica")]
[assembly: AssemblyProduct("KeePass Plugin")]
[assembly: AssemblyCopyright("Copyright © 2016 Cristian Stoica")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("be7b31aa-6cf2-4270-96ca-a45af059c114")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.*")]
[assembly: AssemblyFileVersion("0.1.0.0")]

0 comments on commit 6ccb94e

Please sign in to comment.