Skip to content

Commit 1cb423e

Browse files
committed
Initial source commit
1 parent b8674c3 commit 1cb423e

24 files changed

+830
-24
lines changed

Diff for: LICENSE

-21
This file was deleted.

Diff for: LICENSE.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The MIT License (MIT)
2+
Copyright (C) Microsoft Corporation. All rights reserved.
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
6+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
8+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Diff for: README.md

-3
This file was deleted.

Diff for: VSIXBootstrapper.sln

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26120.4
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VSIXBootstrapper", "src\VSIXBootstrapper\VSIXBootstrapper.vcxproj", "{22FFC1AB-F3E2-4379-B26E-67D67E2A1067}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3A5D9917-703F-4280-81ED-F2E2BA648CB8}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{168CF38F-E3C9-43E1-BEC9-101BC97E926F}"
11+
ProjectSection(SolutionItems) = preProject
12+
LICENSE.txt = LICENSE.txt
13+
EndProjectSection
14+
EndProject
15+
Global
16+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
17+
Debug|x86 = Debug|x86
18+
Release|x86 = Release|x86
19+
EndGlobalSection
20+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21+
{22FFC1AB-F3E2-4379-B26E-67D67E2A1067}.Debug|x86.ActiveCfg = Debug|Win32
22+
{22FFC1AB-F3E2-4379-B26E-67D67E2A1067}.Debug|x86.Build.0 = Debug|Win32
23+
{22FFC1AB-F3E2-4379-B26E-67D67E2A1067}.Release|x86.ActiveCfg = Release|Win32
24+
{22FFC1AB-F3E2-4379-B26E-67D67E2A1067}.Release|x86.Build.0 = Release|Win32
25+
EndGlobalSection
26+
GlobalSection(SolutionProperties) = preSolution
27+
HideSolutionNode = FALSE
28+
EndGlobalSection
29+
GlobalSection(NestedProjects) = preSolution
30+
{22FFC1AB-F3E2-4379-B26E-67D67E2A1067} = {3A5D9917-703F-4280-81ED-F2E2BA648CB8}
31+
EndGlobalSection
32+
EndGlobal

Diff for: inc/Common.Cpp.targets

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<BuildDependsOn>
5+
GenerateVersionInfo;
6+
$(BuildDependsOn)
7+
</BuildDependsOn>
8+
</PropertyGroup>
9+
<ItemDefinitionGroup>
10+
<ClCompile>
11+
<AdditionalIncludeDirectories>$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
12+
</ClCompile>
13+
<ResourceCompile>
14+
<AdditionalIncludeDirectories>$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
15+
</ResourceCompile>
16+
</ItemDefinitionGroup>
17+
<Target Name="GenerateVersionInfo" DependsOnTargets="GetBuildVersion">
18+
<PropertyGroup>
19+
<_MajorVersion>$([System.Version]::Parse('$(BuildVersion)').Major)</_MajorVersion>
20+
<_MinorVersion>$([System.Version]::Parse('$(BuildVersion)').Minor)</_MinorVersion>
21+
<_BuildVersion>$([System.Version]::Parse('$(BuildVersion)').Build)</_BuildVersion>
22+
<_Revision>$([System.Version]::Parse('$(BuildVersion)').Revision)</_Revision>
23+
<_VersionInfoFile>$(IntermediateOutputPath)VersionInfo.h</_VersionInfoFile>
24+
</PropertyGroup>
25+
<Message Text="Generating header &quot;$(_VersionInfoFile)&quot;."/>
26+
<ItemGroup>
27+
<_VersionInfoFile Include="$(_VersionInfoFile)"/>
28+
<_VersionInfoLines Include="
29+
// auto-generated
30+
#pragma once
31+
32+
#define MAJOR_VERSION $(_MajorVersion)
33+
#define MINOR_VERSION $(_MinorVersion)
34+
#define BUILD_VERSION $(_BuildVersion)
35+
#define BUILD_REVISION $(_Revision)
36+
37+
#define FILE_VERSION $(FileVersion)
38+
#define FILE_VERSION_STRUCT $(_MajorVersion), $(_MinorVersion), $(_BuildVersion), $(_Revision)
39+
#define FILE_VERSION_STRINGA &quot;$(PackageVersion)&quot;
40+
#define FILE_VERSION_STRINGW L&quot;$(PackageVersion)&quot;
41+
"/>
42+
</ItemGroup>
43+
<MakeDir Directories="@(_VersionInfoFile->'%(RootDir)%(Directory)')"/>
44+
<WriteLinesToFile Overwrite="true" File="$(_VersionInfoFile)" Lines="@(_VersionInfoLines)" ContinueOnError="WarnAndContinue"/>
45+
<ItemGroup>
46+
<FileWrites Include="$(_VersionInfoFile)"/>
47+
</ItemGroup>
48+
</Target>
49+
</Project>

Diff for: inc/Common.props

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ImportGroup Label="PropertySheets" />
4+
<PropertyGroup Label="UserMacros" />
5+
<PropertyGroup>
6+
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
7+
</PropertyGroup>
8+
<ItemDefinitionGroup>
9+
<Link>
10+
<AdditionalDependencies>shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
11+
</Link>
12+
</ItemDefinitionGroup>
13+
<ItemGroup />
14+
</Project>

Diff for: src/VSIXBootstrapper/CoInitializer.h

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// <copyright file="CoInitializer.h" company="Microsoft Corporation">
2+
// Copyright (C) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt in the project root for license information.
4+
// </copyright>
5+
6+
#pragma once
7+
8+
class CoInitializer
9+
{
10+
public:
11+
CoInitializer()
12+
{
13+
auto hr = ::CoInitialize(NULL);
14+
if (FAILED(hr))
15+
{
16+
throw win32_error(hr);
17+
}
18+
}
19+
20+
~CoInitializer()
21+
{
22+
::CoUninitialize();
23+
}
24+
25+
private:
26+
CoInitializer(const CoInitializer& obj)
27+
{
28+
}
29+
};

Diff for: src/VSIXBootstrapper/CommandLine.cpp

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// <copyright file="CommandLine.cpp" company="Microsoft Corporation">
2+
// Copyright (C) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt in the project root for license information.
4+
// </copyright>
5+
6+
#include "stdafx.h"
7+
8+
using namespace std;
9+
10+
CommandLine::CommandLine(_In_ LPWSTR wszCommandLine) :
11+
m_rgwszArgs(NULL),
12+
m_fQuiet(false)
13+
{
14+
if (!wszCommandLine)
15+
{
16+
return;
17+
}
18+
19+
int cArgs = 0;
20+
21+
m_rgwszArgs = ::CommandLineToArgvW(wszCommandLine, &cArgs);
22+
if (!m_rgwszArgs)
23+
{
24+
throw win32_error();
25+
}
26+
27+
vector<wstring> args(m_rgwszArgs, m_rgwszArgs + cArgs);
28+
for (const auto& arg : args)
29+
{
30+
if (!arg.empty() && (L'-' == arg[0] || L'/' == arg[0]))
31+
{
32+
const auto name = &arg.c_str()[1];
33+
if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, L"q", -1, name, -1) ||
34+
CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, L"quiet", -1, name, -1))
35+
{
36+
m_fQuiet = true;
37+
break;
38+
}
39+
}
40+
}
41+
}
42+
43+
CommandLine::~CommandLine()
44+
{
45+
if (m_rgwszArgs)
46+
{
47+
::LocalFree(m_rgwszArgs);
48+
}
49+
}

Diff for: src/VSIXBootstrapper/CommandLine.h

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// <copyright file="CommandLine.h" company="Microsoft Corporation">
2+
// Copyright (C) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt in the project root for license information.
4+
// </copyright>
5+
6+
#pragma once
7+
8+
class CommandLine
9+
{
10+
public:
11+
CommandLine(_In_ LPWSTR wszCommandLine);
12+
CommandLine(_In_ const CommandLine& obj) :
13+
m_fQuiet(obj.m_fQuiet)
14+
{
15+
// Original instance will free memory.
16+
}
17+
18+
~CommandLine();
19+
20+
bool IsQuiet() const
21+
{
22+
return m_fQuiet;
23+
}
24+
25+
private:
26+
LPWSTR* m_rgwszArgs;
27+
bool m_fQuiet;
28+
};

Diff for: src/VSIXBootstrapper/Exceptions.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// <copyright file="Exceptions.h" company="Microsoft Corporation">
2+
// Copyright (C) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt in the project root for license information.
4+
// </copyright>
5+
6+
#pragma once
7+
8+
class win32_error :
9+
public std::system_error
10+
{
11+
public:
12+
win32_error() :
13+
win32_error(::GetLastError())
14+
{
15+
}
16+
17+
win32_error(_In_ int code, _In_ const std::string message = "") :
18+
system_error(code, std::system_category(), message)
19+
{
20+
}
21+
};

0 commit comments

Comments
 (0)