Skip to content

Commit

Permalink
Get ready for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
CrendKing committed Jul 18, 2021
1 parent 1d32d24 commit 20b73fd
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 11 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
46 changes: 36 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,25 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Mono auto generated files
mono_crash.*

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand All @@ -39,9 +45,10 @@ Generated\ Files/
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml

# Build Results of an ATL Project
[Dd]ebugPS/
Expand All @@ -56,6 +63,9 @@ project.lock.json
project.fragment.lock.json
artifacts/

# ASP.NET Scaffolding
ScaffoldingReadMe.txt

# StyleCop
StyleCopReport.xml

Expand Down Expand Up @@ -122,9 +132,6 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

Expand All @@ -135,6 +142,11 @@ _TeamCity*
.axoCover/*
!.axoCover/settings.json

# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info

# Visual Studio code coverage results
*.coverage
*.coveragexml
Expand Down Expand Up @@ -182,6 +194,8 @@ PublishScripts/

# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
Expand All @@ -206,6 +220,8 @@ BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload

# Visual Studio cache files
# files ending in .cache can be ignored
Expand Down Expand Up @@ -255,7 +271,9 @@ ServiceFabricBackup/
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl

# Microsoft Fakes
FakesAssemblies/
Expand Down Expand Up @@ -291,10 +309,6 @@ paket-files/
# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush personal settings
.cr/personal

Expand Down Expand Up @@ -337,4 +351,16 @@ ASALocalRun/
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd

release*.bat
*.zip
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
# Compare Menu

A Windows context menu shell extension that proxies general comparison commands to any diff application.

While many popular comparison applications such as Beyond Compare come with their own such shell extensions help improve user experience, there are good ones that still do not have. Rather than requesting each developer team to come up with their own solution, why not build a general one that can work everywhere as long as their take standard input arguments?

The concept of such context menu is simple:

* When exactly two files or two directories are selected, a "Compare Two" command becomes available, sending the two paths to the configured diff application.
* If only one object is selected for the first time, the menu remembers its path.
* If another object is selected afterwards, the menu either sends both paths to the diff application and reset, or replaces the previously remembered path, depending on user choice.

Note that a file can't be compared to a directory. So if the types mismatch, "Compare Two" won't be available, and the only option for single select mode is replacement.

## Install

* Unpack the archive.
* Run install.bat to register the shell extension.
* Open config.reg and edit the application path. `\` in the path needs to be escaped as `\\`.
* The default arguments to the application is just the two paths. If a different one is needed, change the `ComparerArgs` value in config.reg.

## Build

A build script `build.ps1` is included to automate the process. It obtains dependencies and starts compilation. Before running `build.ps1`, make sure you have the latest Visual Studio installed. The script will automatically assume the Visual Studio developer environment and check out dependencies. To run the script, pass the target configuration and platform as arguments, e.g. `build.ps1 Debug x64` or `build.ps1 Release x86`.

## Screenshots

Compare Two
![Compare Two](screenshots/compare_two.webp)

Select First
![Select First](screenshots/select_first.webp)

Select Second
![Select Second](screenshots/select_second.webp)
11 changes: 11 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -nologo -utf8 -latest -property installationPath
Import-Module "${vsPath}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $vsPath -DevCmdArguments "-arch=amd64 -host_arch=amd64 -no_logo" -SkipAutomaticLocation

Set-Location $PSScriptRoot

$configuration = $args[0]
$platform = $args[1]

MSBuild.exe -property:"Configuration=${configuration};Platform=${platform}" -maxCpuCount -nologo compare_menu.sln
exit $LASTEXITCODE
50 changes: 49 additions & 1 deletion compare_menu.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,66 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<UseDebugLibraries Condition="'$(Configuration)' == 'Debug'">true</UseDebugLibraries>
<WholeProgramOptimization Condition="'$(Configuration)' == 'Release'">true</WholeProgramOptimization>
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<LinkIncremental Condition="'$(Configuration)' == 'Debug'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)' == 'Release'">false</LinkIncremental>
<TargetName>$(ProjectName)_$(PlatformArchitecture)</TargetName>
</PropertyGroup>
<PropertyGroup Label="Globals">
<Keyword>Win32Proj</Keyword>
<VCProjectVersion>16.0</VCProjectVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Label="Configuration">
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks Condition="'$(Configuration)' == 'Debug'">EnableFastChecks</BasicRuntimeChecks>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableParallelCodeGeneration Condition="'$(Configuration)' == 'Release'">true</EnableParallelCodeGeneration>
<FunctionLevelLinking Condition="'$(Configuration)' == 'Release'">true</FunctionLevelLinking>
<IntrinsicFunctions Condition="'$(Configuration)' == 'Release'">true</IntrinsicFunctions>
<LanguageStandard>stdcpplatest</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization Condition="'$(Configuration)' == 'Debug'">Disabled</Optimization>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary Condition="'$(Configuration)' == 'Debug'">MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeLibrary Condition="'$(Configuration)' == 'Release'">MultiThreadedDLL</RuntimeLibrary>
<SDLCheck>true</SDLCheck>
<StringPooling Condition="'$(Configuration)' == 'Release'">true</StringPooling>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<ModuleDefinitionFile>src\$(ProjectName).def</ModuleDefinitionFile>
<EnableCOMDATFolding Condition="'$(Configuration)' == 'Release'">true</EnableCOMDATFolding>
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
<OptimizeReferences Condition="'$(Configuration)' == 'Release'">true</OptimizeReferences>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
</Project>
Binary file added config.reg
Binary file not shown.
2 changes: 2 additions & 0 deletions install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
regsvr32 "%~dp0acompare_menu_64.dll"
regsvr32 "%~dp0acompare_menu_32.dll"
Binary file added screenshots/compare_two.webp
Binary file not shown.
Binary file added screenshots/select_first.webp
Binary file not shown.
Binary file added screenshots/select_second.webp
Binary file not shown.
2 changes: 2 additions & 0 deletions uninstall.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
regsvr32 /u "%~dp0compare_menu_64.dll"
regsvr32 /u "%~dp0compare_menu_32.dll"

0 comments on commit 20b73fd

Please sign in to comment.