diff --git a/.editorconfig b/.editorconfig
index cab8f8e..d014775 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,3 +7,6 @@ insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
+
+[*.{xml,wxs,cspro,yaml,props}]
+indent_size = 2
diff --git a/.github/workflows/build.ps1 b/.github/workflows/build.ps1
index de755c4..ef586b7 100644
--- a/.github/workflows/build.ps1
+++ b/.github/workflows/build.ps1
@@ -22,13 +22,13 @@ Function CreateZipArchive($dir) {
Function GetVersion() {
$gitCommand = Get-Command -Name git
- $nearestTag = & "$gitCommand" describe --exact-match --tags HEAD
+ $nearestTag = & $gitCommand describe --exact-match --tags HEAD
if(-Not $?) {
- Info "The commit is not tagged. Use 'v0.0-dev' as a version instead"
+ Info "The commit is not tagged. Use 'v0.0-dev' as a tag instead"
$nearestTag = "v0.0-dev"
}
- $commitHash = & "$gitCommand" rev-parse --short HEAD
+ $commitHash = & $gitCommand rev-parse --short HEAD
CheckReturnCodeOfPreviousCommand "Failed to get git commit hash"
return "$($nearestTag.Substring(1))-$commitHash"
@@ -45,7 +45,7 @@ Function Publish($slnFile, $version, $outDir) {
--configuration Release `
--output $outDir `
/property:PublishSingleFile=true `
- /property:IncludeNativeLibrariesForSelfExtract=true `
+ /property:IncludeAllContentForSelfExtract=true `
/property:PublishTrimmed=true `
/property:TrimMode=link `
/property:DebugType=None `
@@ -65,4 +65,4 @@ $projectName = "BluetoothDevicePairing"
Publish `
-slnFile $root/$projectName.sln `
-version (GetVersion) `
- -outDir $root/Build/Publish/$projectName
+ -outDir $root/build/Publish/$projectName
diff --git a/.github/workflows/continuous-integration-workflow.yaml b/.github/workflows/continuous-integration-workflow.yaml
index c938474..51214a6 100644
--- a/.github/workflows/continuous-integration-workflow.yaml
+++ b/.github/workflows/continuous-integration-workflow.yaml
@@ -2,9 +2,9 @@ on: push
jobs:
build:
- runs-on: windows-latest
+ runs-on: windows-2022
steps:
- - uses: actions/checkout@v2.3.4
+ - uses: actions/checkout@v2
- run: .github/workflows/build.ps1
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
@@ -14,3 +14,7 @@ jobs:
draft: true
files: Build/Publish/*.zip
fail_on_unmatched_files: true
+ - uses: actions/upload-artifact@v2
+ with:
+ name: Build artifacts
+ path: Build/Publish/*.zip
diff --git a/.gitignore b/.gitignore
index f79eb2c..923d7c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,364 +1,2 @@
-/Build
-
-###### https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
-
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-##
-## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
-
-# User-specific files
-*.rsuser
-*.suo
-*.user
-*.userosscache
-*.sln.docstates
-
-# 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/
-[Ll]og/
-[Ll]ogs/
-
-# Visual Studio 2015/2017 cache/options directory
-.vs/
-# Uncomment if you have tasks that create the project's static files in wwwroot
-#wwwroot/
-
-# Visual Studio 2017 auto generated files
-Generated\ Files/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUnit
-*.VisualState.xml
-TestResult.xml
-nunit-*.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-# Benchmark Results
-BenchmarkDotNet.Artifacts/
-
-# .NET Core
-project.lock.json
-project.fragment.lock.json
-artifacts/
-
-# ASP.NET Scaffolding
-ScaffoldingReadMe.txt
-
-# StyleCop
-StyleCopReport.xml
-
-# Files built by Visual Studio
-*_i.c
-*_p.c
-*_h.h
-*.ilk
-*.meta
-*.obj
-*.iobj
-*.pch
-*.pdb
-*.ipdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*_wpftmp.csproj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opendb
-*.opensdf
-*.sdf
-*.cachefile
-*.VC.db
-*.VC.VC.opendb
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-*.sap
-
-# Visual Studio Trace Files
-*.e2e
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# AxoCover is a Code Coverage Tool
-.axoCover/*
-!.axoCover/settings.json
-
-# Coverlet is a free, cross platform Code Coverage Tool
-coverage*[.json, .xml, .info]
-
-# Visual Studio code coverage results
-*.coverage
-*.coveragexml
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-nCrunchTemp_*
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# 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/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-# Note: Comment the next line if you want to checkin your web deploy settings,
-# but database connection strings (with potential passwords) will be unencrypted
-*.pubxml
-*.publishproj
-
-# Microsoft Azure Web App publish settings. Comment the next line if you want to
-# checkin your Azure Web App publish settings, but sensitive information contained
-# in these scripts will be unencrypted
-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.
-!**/[Pp]ackages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/[Pp]ackages/repositories.config
-# NuGet v3's project.json files produces more ignorable files
-*.nuget.props
-*.nuget.targets
-
-# Microsoft Azure Build Output
-csx/
-*.build.csdef
-
-# Microsoft Azure Emulator
-ecf/
-rcf/
-
-# Windows Store app package directories and files
-AppPackages/
-BundleArtifacts/
-Package.StoreAssociation.xml
-_pkginfo.txt
-*.appx
-*.appxbundle
-*.appxupload
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!?*.[Cc]ache/
-
-# Others
-ClientBin/
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.jfm
-*.pfx
-*.publishsettings
-orleans.codegen.cs
-
-# Including strong name files can present a security risk
-# (https://github.com/github/gitignore/pull/2483#issue-259490424)
-#*.snk
-
-# Since there are multiple workflows, uncomment next line to ignore bower_components
-# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
-#bower_components/
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# 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
-UpgradeLog*.htm
-ServiceFabricBackup/
-*.rptproj.bak
-
-# SQL Server files
-*.mdf
-*.ldf
-*.ndf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-*.rptproj.rsuser
-*- [Bb]ackup.rdl
-*- [Bb]ackup ([0-9]).rdl
-*- [Bb]ackup ([0-9][0-9]).rdl
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# GhostDoc plugin setting file
-*.GhostDoc.xml
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-node_modules/
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
-*.vbw
-
-# Visual Studio LightSwitch build output
-**/*.HTMLClient/GeneratedArtifacts
-**/*.DesktopClient/GeneratedArtifacts
-**/*.DesktopClient/ModelManifest.xml
-**/*.Server/GeneratedArtifacts
-**/*.Server/ModelManifest.xml
-_Pvt_Extensions
-
-# Paket dependency manager
-.paket/paket.exe
-paket-files/
-
-# FAKE - F# Make
-.fake/
-
-# CodeRush personal settings
-.cr/personal
-
-# Python Tools for Visual Studio (PTVS)
-__pycache__/
-*.pyc
-
-# Cake - Uncomment if you are using it
-# tools/**
-# !tools/packages.config
-
-# Tabs Studio
-*.tss
-
-# Telerik's JustMock configuration file
-*.jmconfig
-
-# BizTalk build output
-*.btp.cs
-*.btm.cs
-*.odx.cs
-*.xsd.cs
-
-# OpenCover UI analysis results
-OpenCover/
-
-# Azure Stream Analytics local run output
-ASALocalRun/
-
-# MSBuild Binary and Structured Log
-*.binlog
-
-# NVidia Nsight GPU debugger configuration file
-*.nvuser
-
-# MFractors (Xamarin productivity tool) working folder
-.mfractor/
-
-# Local History for Visual Studio
-.localhistory/
-
-# BeatPulse healthcheck temp database
-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
+/build/
+.vs/
diff --git a/BluetoothDevicePairing.sln b/BluetoothDevicePairing.sln
index a28e75f..86b1c5b 100644
--- a/BluetoothDevicePairing.sln
+++ b/BluetoothDevicePairing.sln
@@ -1,9 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30114.105
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BluetoothDevicePairing", "Src\BluetoothDevicePairing.csproj", "{728939B3-82EA-4471-9CC7-3403EAD1E537}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BluetoothDevicePairing", "src\BluetoothDevicePairing.csproj", "{728939B3-82EA-4471-9CC7-3403EAD1E537}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files", "Files", "{F4EA3749-BB28-4437-8AD6-137D5EBC09DD}"
+ ProjectSection(SolutionItems) = preProject
+ .editorconfig = .editorconfig
+ .gitattributes = .gitattributes
+ .gitignore = .gitignore
+ .github\workflows\build.ps1 = .github\workflows\build.ps1
+ .github\workflows\continuous-integration-workflow.yaml = .github\workflows\continuous-integration-workflow.yaml
+ README.md = README.md
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/README.md b/README.md
index ab5023f..2980603 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,49 @@
# BluetoothDevicePairing
-Console utility to discover and pair/connect Bluetooth and Bluetooth LE devices.
-The main reason to create this utility was to be able to pair Bluetooth devices from console in the same way it is done by built in into Windows "Bluetooth & other devices" dialog.
+Console utility to discover and pair/connect Bluetooth and Bluetooth LE devices.
# System requirements
-Windows 10 1809 (10.0.17763) or higher
+Windows 10 1809 (10.0.17763) or higher
# How to use
* Download and unpack the latest [release](https://github.com/PolarGoose/BluetoothDevicePairing/releases).
-* Run `BluetoothDevicePairing.exe --help` and `BluetoothDevicePairing.exe --help` to get usage information and see the `Examples` section bellow.
+* Run `BluetoothDevicePairing.exe --help` and `BluetoothDevicePairing.exe --help` to get usage information and check the `Examples` section bellow.
# Examples
-* Discover devices: `BluetoothDevicePairing.exe discover`
-* Pair and connect to a device using its mac address: `BluetoothDevicePairing.exe pair --mac 12:34:56:78:9A:BC`
-* Pair and connect to a device using its name: `BluetoothDevicePairing.exe pair --name "name of device"`
-* Pair and connect to a device using its name/mac and device type: `BluetoothDevicePairing.exe pair --name "name of device" --type BluetoothLE`
-* Pair and connect to a device using its name/mac and pin code: `BluetoothDevicePairing.exe pair --mac 12:34:56:78:9A:BC --pin 1234`
-* Unpair a device using its mac address: `BluetoothDevicePairing.exe unpair --mac 12:34:56:78:9A:BC`
-* Unpair a device using its name: `BluetoothDevicePairing.exe unpair --name "name of device"`
-* Unpair a device using its name/mac and device type: `BluetoothDevicePairing.exe unpair --mac 12:34:56:78:9A:BC --type Bluetooth`
+* Discover devices:
+```
+BluetoothDevicePairing.exe discover
+```
+* Pair and connect to a device using its mac address:
+```
+BluetoothDevicePairing.exe pair --mac 12:34:56:78:9A:BC
+```
+* Pair and connect to a device using its name:
+```
+BluetoothDevicePairing.exe pair --name "name of device"
+```
+* Pair and connect to a device using its name/mac and device type:
+```
+BluetoothDevicePairing.exe pair --name "name of device" --type BluetoothLE
+```
+* Pair and connect to a device using its name/mac and pin code:
+```
+BluetoothDevicePairing.exe pair --mac 12:34:56:78:9A:BC --pin 1234
+```
+* Unpair a device using its mac address:
+```
+BluetoothDevicePairing.exe unpair --mac 12:34:56:78:9A:BC
+```
+* Unpair a device using its name:
+```
+BluetoothDevicePairing.exe unpair --name "name of device"
+```
+* Unpair a device using its name/mac and device type:
+```
+BluetoothDevicePairing.exe unpair --mac 12:34:56:78:9A:BC --type Bluetooth
+```
+
+# How it works
+The program uses [Windows.Devices.Enumeration API](https://docs.microsoft.com/en-us/uwp/api/Windows.Devices.Enumeration?redirectedfrom=MSDN&view=winrt-22000) to work with Bluetooth.
# Tips and tricks
* Bluetooth LE devices use mac address randomisation, therefore it is not reliable to pair them using mac address. Use pairing by name instead.
@@ -25,5 +51,8 @@ Windows 10 1809 (10.0.17763) or higher
* Some device require pin code to be paired, use `--pin` parameter to provide PIN code. By default this programm will try to use `0000` as a pin code.
# Build
-* Use `Visual Studio 2019` to open the solution file and work with the code
+* Use `Visual Studio 2022` to open the solution file and work with the code
* Run `.github/workflows/build.ps1` to build a release (to run this script `git.exe` should be in your PATH)
+
+# References
+* [Windows.Devices.Enumeration API usage examples](https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/DeviceEnumerationAndPairing)
diff --git a/Src/BluetoothDevicePairing.csproj b/Src/BluetoothDevicePairing.csproj
deleted file mode 100644
index 98e5c13..0000000
--- a/Src/BluetoothDevicePairing.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- Exe
- net5.0
- x86
- disable
- net5.0-windows10.0.17763.0
-
-
-
-
-
diff --git a/Src/Directory.Build.props b/Src/Directory.Build.props
deleted file mode 100644
index 7c32d4e..0000000
--- a/Src/Directory.Build.props
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- $(MSBuildThisFileDirectory)..\Build\
- $(BuildFolder)$(Configuration)\
- $(BuildFolder)obj\$(MSBuildProjectName)\
- 5
- true
- 0.0-dev
-
-
diff --git a/Src/Bluetooth/AsqFilter.cs b/src/Bluetooth/AsqFilter.cs
similarity index 100%
rename from Src/Bluetooth/AsqFilter.cs
rename to src/Bluetooth/AsqFilter.cs
diff --git a/Src/Bluetooth/Device.cs b/src/Bluetooth/Device.cs
similarity index 92%
rename from Src/Bluetooth/Device.cs
rename to src/Bluetooth/Device.cs
index 97e1c92..8f63643 100644
--- a/Src/Bluetooth/Device.cs
+++ b/src/Bluetooth/Device.cs
@@ -52,7 +52,10 @@ public override string ToString()
private static DeviceType GetDeviceType(DeviceInformation device)
{
var match = Regex.Match(device.Id, @"(^\w*)(#)");
- if (!match.Success) throw new Exception($"Failed to extract the device type from the string '{device.Id}'");
+ if (!match.Success)
+ {
+ throw new Exception($"Failed to extract the device type from the string '{device.Id}'");
+ }
var type = match.Groups[1].Value;
switch (type)
diff --git a/Src/Bluetooth/DeviceDiscoverer.cs b/src/Bluetooth/DeviceDiscoverer.cs
similarity index 94%
rename from Src/Bluetooth/DeviceDiscoverer.cs
rename to src/Bluetooth/DeviceDiscoverer.cs
index b57ff49..77dab96 100644
--- a/Src/Bluetooth/DeviceDiscoverer.cs
+++ b/src/Bluetooth/DeviceDiscoverer.cs
@@ -6,7 +6,7 @@
namespace BluetoothDevicePairing.Bluetooth
{
- internal sealed class DeviceDiscoverer
+ internal static class DeviceDiscoverer
{
public static List DiscoverBluetoothDevices(int timeoutInSec)
{
@@ -45,12 +45,16 @@ private static DeviceWatcher CreateWatcher(AsqFilter filter, List device
watcher.Removed += (s, removedDevice) =>
{
foreach (var device in devices.Where(device => device.Info.Id == removedDevice.Id))
+ {
devices.Remove(device);
+ }
};
watcher.Updated += (s, updatedDevice) =>
{
foreach (var device in devices.Where(device => device.Info.Id == updatedDevice.Id))
+ {
device.Info.Update(updatedDevice);
+ }
};
watcher.Stopped += (s, o) => { stoppedEvent.Set(); };
diff --git a/Src/Bluetooth/DevicePairer.cs b/src/Bluetooth/DevicePairer.cs
similarity index 99%
rename from Src/Bluetooth/DevicePairer.cs
rename to src/Bluetooth/DevicePairer.cs
index ef32a85..ec61c52 100644
--- a/Src/Bluetooth/DevicePairer.cs
+++ b/src/Bluetooth/DevicePairer.cs
@@ -3,7 +3,7 @@
namespace BluetoothDevicePairing.Bluetooth
{
- internal sealed class DevicePairer
+ internal static class DevicePairer
{
public static void PairDevice(Device device, string pin)
{
diff --git a/Src/Bluetooth/MacAddress.cs b/src/Bluetooth/MacAddress.cs
similarity index 63%
rename from Src/Bluetooth/MacAddress.cs
rename to src/Bluetooth/MacAddress.cs
index c03910f..e6a7959 100644
--- a/Src/Bluetooth/MacAddress.cs
+++ b/src/Bluetooth/MacAddress.cs
@@ -9,14 +9,20 @@ internal sealed class MacAddress : IEquatable
public MacAddress(DeviceInformation device)
{
var match = Regex.Match(device.Id, @"(..:){5}(..)$");
- if (!match.Success) throw new Exception($"Failed to extract mac address from the string '{device.Id}'");
+ if (!match.Success)
+ {
+ throw new Exception($"Failed to extract mac address from the string '{device.Id}'");
+ }
Address = match.Value.ToUpper();
}
public MacAddress(string mac)
{
var match = Regex.Match(mac, @"^(..:){5}(..)$");
- if (!match.Success) throw new Exception($"MacAddress address '{mac}' is not a valid mac address");
+ if (!match.Success)
+ {
+ throw new Exception($"MacAddress address '{mac}' is not a valid mac address");
+ }
Address = mac;
}
@@ -29,8 +35,16 @@ public override string ToString()
public bool Equals(MacAddress other)
{
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
+ if (other is null)
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
return Address == other.Address;
}
@@ -41,7 +55,7 @@ public override bool Equals(object obj)
public override int GetHashCode()
{
- return (Address != null ? Address.GetHashCode() : 0);
+ return Address != null ? Address.GetHashCode() : 0;
}
}
}
diff --git a/src/BluetoothDevicePairing.csproj b/src/BluetoothDevicePairing.csproj
new file mode 100644
index 0000000..0e72449
--- /dev/null
+++ b/src/BluetoothDevicePairing.csproj
@@ -0,0 +1,11 @@
+
+
+ Exe
+ x86
+ disable
+ net6.0-windows10.0.17763.0
+
+
+
+
+
diff --git a/Src/Command/DiscoverDevices.cs b/src/Command/DiscoverDevices.cs
similarity index 91%
rename from Src/Command/DiscoverDevices.cs
rename to src/Command/DiscoverDevices.cs
index a6068eb..8d6d131 100644
--- a/Src/Command/DiscoverDevices.cs
+++ b/src/Command/DiscoverDevices.cs
@@ -1,7 +1,7 @@
-using System;
using BluetoothDevicePairing.Bluetooth;
using BluetoothDevicePairing.Command.Utils;
using CommandLine;
+using System;
namespace BluetoothDevicePairing.Command
{
@@ -13,13 +13,16 @@ internal sealed class DiscoverDevicesOptions : CommonOptions
public int DiscoveryTime { get; set; }
}
- internal sealed class DiscoverDevices
+ internal static class DiscoverDevices
{
public static void Execute(DiscoverDevicesOptions opts)
{
var devices = DeviceDiscoverer.DiscoverBluetoothDevices(opts.DiscoveryTime);
Console.WriteLine("----------------------------------------------------------");
- foreach (var d in devices) PrintDevice(d);
+ foreach (var d in devices)
+ {
+ PrintDevice(d);
+ }
Console.WriteLine("----------------------------------------------------------");
}
diff --git a/Src/Command/PairDevice.cs b/src/Command/PairDevice.cs
similarity index 99%
rename from Src/Command/PairDevice.cs
rename to src/Command/PairDevice.cs
index ca82c5e..e3625c3 100644
--- a/Src/Command/PairDevice.cs
+++ b/src/Command/PairDevice.cs
@@ -1,7 +1,7 @@
-using System;
using BluetoothDevicePairing.Bluetooth;
using BluetoothDevicePairing.Command.Utils;
using CommandLine;
+using System;
namespace BluetoothDevicePairing.Command
{
@@ -18,7 +18,7 @@ internal sealed class PairDeviceOptions : PairAndUnpairDeviceOptions
public string Pin { get; set; }
}
- internal sealed class PairDevice
+ internal static class PairDevice
{
public static void Execute(PairDeviceOptions opts)
{
diff --git a/Src/Command/UnPairDevice.cs b/src/Command/UnPairDevice.cs
similarity index 98%
rename from Src/Command/UnPairDevice.cs
rename to src/Command/UnPairDevice.cs
index ef34eb6..9e113da 100644
--- a/Src/Command/UnPairDevice.cs
+++ b/src/Command/UnPairDevice.cs
@@ -1,7 +1,7 @@
-using System;
using BluetoothDevicePairing.Bluetooth;
using BluetoothDevicePairing.Command.Utils;
using CommandLine;
+using System;
namespace BluetoothDevicePairing.Command
{
@@ -13,7 +13,7 @@ internal sealed class UnpairDeviceOptions : PairAndUnpairDeviceOptions
public int DiscoveryTime { get; set; }
}
- internal sealed class UnPairDevice
+ internal static class UnPairDevice
{
public static void Execute(UnpairDeviceOptions opts)
{
diff --git a/Src/Command/Utils/CommonOptions.cs b/src/Command/Utils/CommonOptions.cs
similarity index 100%
rename from Src/Command/Utils/CommonOptions.cs
rename to src/Command/Utils/CommonOptions.cs
diff --git a/Src/Command/Utils/DeviceFinder.cs b/src/Command/Utils/DeviceFinder.cs
similarity index 96%
rename from Src/Command/Utils/DeviceFinder.cs
rename to src/Command/Utils/DeviceFinder.cs
index f819c58..753896d 100644
--- a/Src/Command/Utils/DeviceFinder.cs
+++ b/src/Command/Utils/DeviceFinder.cs
@@ -1,10 +1,10 @@
+using BluetoothDevicePairing.Bluetooth;
using System;
using System.Collections.Generic;
-using BluetoothDevicePairing.Bluetooth;
namespace BluetoothDevicePairing.Command.Utils
{
- internal sealed class DeviceFinder
+ internal static class DeviceFinder
{
public static List FindDevicesByMac(List devices, MacAddress mac, DeviceType deviceType)
{
diff --git a/Src/Command/Utils/DeviceType.cs b/src/Command/Utils/DeviceType.cs
similarity index 75%
rename from Src/Command/Utils/DeviceType.cs
rename to src/Command/Utils/DeviceType.cs
index c6b8d6c..b18f62c 100644
--- a/Src/Command/Utils/DeviceType.cs
+++ b/src/Command/Utils/DeviceType.cs
@@ -1,13 +1,13 @@
namespace BluetoothDevicePairing.Command.Utils
{
- enum DeviceType
+ internal enum DeviceType
{
Bluetooth,
BluetoothLE,
Any
}
- static class DeviceTypeExtensions
+ internal static class DeviceTypeExtensions
{
public static bool Equals(DeviceType type1, Bluetooth.DeviceType type2)
{
@@ -16,7 +16,7 @@ public static bool Equals(DeviceType type1, Bluetooth.DeviceType type2)
return true;
}
- if ( type1 == DeviceType.Bluetooth && type2 == Bluetooth.DeviceType.Bluetooth
+ if (type1 == DeviceType.Bluetooth && type2 == Bluetooth.DeviceType.Bluetooth
|| type1 == DeviceType.BluetoothLE && type2 == Bluetooth.DeviceType.BluetoothLE)
{
return true;
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
new file mode 100644
index 0000000..01cd1f7
--- /dev/null
+++ b/src/Directory.Build.props
@@ -0,0 +1,16 @@
+
+
+ $(MSBuildThisFileDirectory)..\build\
+ $(BuildFolder)$(Configuration)\
+ $(BuildFolder)obj\$(MSBuildProjectName)\
+ 5
+ true
+ 0.0-dev
+
+
+ IL2104
+
+
diff --git a/Src/Program.cs b/src/Program.cs
similarity index 97%
rename from Src/Program.cs
rename to src/Program.cs
index c42e8bf..ac6b848 100644
--- a/Src/Program.cs
+++ b/src/Program.cs
@@ -1,11 +1,11 @@
-using System;
using BluetoothDevicePairing.Command;
using BluetoothDevicePairing.Command.Utils;
using CommandLine;
+using System;
namespace BluetoothDevicePairing
{
- internal sealed class Program
+ internal static class Program
{
private static bool WaitOnError;