Skip to content

Commit

Permalink
version 1.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbarry committed Jan 21, 2019
0 parents commit bd53fe0
Show file tree
Hide file tree
Showing 15 changed files with 592 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
165 changes: 165 additions & 0 deletions .gitignore
@@ -0,0 +1,165 @@
#################
## Eclipse
#################

*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath


#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover

## TODO: If you have NuGet Package Restore enabled, uncomment this
packages/

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp
.vs/

# ReSharper is a .NET coding add-in
_ReSharper*

# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
.vs/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML



############
## Windows
############

# Windows image file caches
Thumbs.db

# Folder config file
Desktop.ini


#############
## Python
#############

*.py[co]

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox

#Translations
*.mo

#Mr Developer
.mr.developer.cfg

# Mac crap
.DS_Store
25 changes: 25 additions & 0 deletions MscVersion.sln
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2035
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MscVersion", "MscVersion\MscVersion.csproj", "{2A7D71D9-F346-45E4-A4AE-552CA466B118}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A7D71D9-F346-45E4-A4AE-552CA466B118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A7D71D9-F346-45E4-A4AE-552CA466B118}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A7D71D9-F346-45E4-A4AE-552CA466B118}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A7D71D9-F346-45E4-A4AE-552CA466B118}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F8AD992E-B10D-475E-9740-49B69B071300}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions MscVersion/ArchType.cs
@@ -0,0 +1,10 @@
namespace MscVersion
{
public enum ArchType
{
// ReSharper disable InconsistentNaming
x86,
x64,
IA64
}
}
37 changes: 37 additions & 0 deletions MscVersion/MscVer.cs
@@ -0,0 +1,37 @@
namespace MscVersion
{
public enum MscVer
{
// ReSharper disable InconsistentNaming
//
// MSC 1.0 _MSC_VER == 100
// MSC 2.0 _MSC_VER == 200
// MSC 3.0 _MSC_VER == 300
// MSC 4.0 _MSC_VER == 400
// MSC 5.0 _MSC_VER == 500
// MSC 6.0 _MSC_VER == 600
// MSC 7.0 _MSC_VER == 700
// MSVC++ 1.0 _MSC_VER == 800
// MSVC++ 2.0 _MSC_VER == 900
// MSVC++ 4.0 _MSC_VER == 1000 (Developer Studio 4.0)
// MSVC++ 4.2 _MSC_VER == 1020 (Developer Studio 4.2)
// MSVC++ 5.0 _MSC_VER == 1100 (Visual Studio 97 version 5.0)
// MSVC++ 6.0 _MSC_VER == 1200 (Visual Studio 6.0 version 6.0)
// MSVC++ 7.0 _MSC_VER == 1300 (Visual Studio .NET 2002 version 7.0)
// MSVC++ 7.1 _MSC_VER == 1310 (Visual Studio .NET 2003 version 7.1)

Vs_2005 = 1400, // MSVC++ 8.0
Vs_2008 = 1500, // MSVC++ 9.0
Vs_2010 = 1600, // MSVC++ 10.0
Vs_2012 = 1700, // MSVC++ 11.0
Vs_2013 = 1800, // MSVC++ 12.0
Vs_2015 = 1900, // MSVC++ 14.0
Vs_2017_15_0 = 1910, // MSVC++ 14.10
Vs_2017_15_3 = 1911, // MSVC++ 14.11
Vs_2017_15_5 = 1912, // MSVC++ 14.12
Vs_2017_15_6 = 1913, // MSVC++ 14.13
Vs_2017_15_7 = 1914, // MSVC++ 14.14
Vs_2017_15_8 = 1915, // MSVC++ 14.15
Vs_2017_15_9 = 1916 // MSVC++ 14.16
}
}
Binary file added MscVersion/MscVersion.1.0.0.nupkg
Binary file not shown.
48 changes: 48 additions & 0 deletions MscVersion/MscVersion.csproj
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2A7D71D9-F346-45E4-A4AE-552CA466B118}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MscVersion</RootNamespace>
<AssemblyName>MscVersion</AssemblyName>
<TargetFrameworkVersion>v4.5</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="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="ArchType.cs" />
<Compile Include="Msi.cs" />
<Compile Include="MscVer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VcRuntime.cs" />
<Compile Include="VcRuntimeVersion.cs" />
</ItemGroup>
<ItemGroup>
<None Include="MscVersion.nuspec" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 2 additions & 0 deletions MscVersion/MscVersion.csproj.DotSettings
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=interop/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
17 changes: 17 additions & 0 deletions MscVersion/MscVersion.nuspec
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>https://github.com/enclave-networks/MscVersion/blob/master/license.txt</licenseUrl>
<projectUrl>https://github.com/enclave-networks/MscVersion/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<releaseNotes></releaseNotes>
<copyright>Copyright 2019</copyright>
<tags>_MSC_VER VC++</tags>
</metadata>
</package>
55 changes: 55 additions & 0 deletions MscVersion/Msi.cs
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

namespace MscVersion
{
public static class Msi
{
[DllImport("msi.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern InstallState MsiQueryProductState(string product);

public static bool Any(IEnumerable<Guid> productCodes)
{
return productCodes.Any(IsInstalled);
}

public static bool IsInstalled(Guid productCode)
{
var state = MsiQueryProductState($"{{{productCode}}}");

return state == InstallState.INSTALLSTATE_LOCAL ||
state == InstallState.INSTALLSTATE_DEFAULT;
}

public static bool IsInstalled(IEnumerable<string> productCodes)
{
return productCodes.Select(MsiQueryProductState).Any(state => state == InstallState.INSTALLSTATE_LOCAL || state == InstallState.INSTALLSTATE_DEFAULT);
}

public static IEnumerable<Guid> Where(IEnumerable<Guid> productCodes)
{
return productCodes.Where(IsInstalled);
}
}

public enum InstallState
{
// ReSharper disable InconsistentNaming
INSTALLSTATE_NOTUSED = -7, // component disabled
INSTALLSTATE_BADCONFIG = -6, // configuration datacorrupt
INSTALLSTATE_INCOMPLETE = -5, // installationsuspended or in progress
INSTALLSTATE_SOURCEABSENT = -4, // run from source,source is unavailable
INSTALLSTATE_MOREDATA = -3, // return bufferoverflow
INSTALLSTATE_INVALIDARG = -2, // invalid functionargument
INSTALLSTATE_UNKNOWN = -1, // unrecognized productor feature
INSTALLSTATE_BROKEN = 0, // broken
INSTALLSTATE_ADVERTISED = 1, // advertised feature
INSTALLSTATE_REMOVED = 1, // component being removed(action state, not settable)
INSTALLSTATE_ABSENT = 2, // uninstalled (or actionstate absent but clients remain)
INSTALLSTATE_LOCAL = 3, // installed on local drive
INSTALLSTATE_SOURCE = 4, // run from source, CD ornet
INSTALLSTATE_DEFAULT = 5, // use default, local orsource
}
}

0 comments on commit bd53fe0

Please sign in to comment.