Added support for CLI-less execution, Switched licenses to PDF in MSI, Bumped version to 3.0.0/3.0.0.0
Update Program.cs, ListComPort.wxs, and 4 more files...
This commit is contained in:
@@ -4,7 +4,7 @@ using NibblePoker.Library.ComPortWatcher;
|
||||
namespace NibblePoker.Application.ListComPort;
|
||||
|
||||
internal static class Program {
|
||||
private const string Version = "3.0.0-indev";
|
||||
private const string Version = "3.0.0";
|
||||
|
||||
private static readonly Verb RootVerb = new Verb("");
|
||||
|
||||
@@ -32,6 +32,15 @@ internal static class Program {
|
||||
|
||||
private static int _exitCode = ErrorCodes.NoError;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the program is the only owner of its console.
|
||||
/// This check is used to detect if the program was run from the exe/lnk or via a console.
|
||||
/// </summary>
|
||||
/// <returns><c>True</c> if the process is the console's sole owner, <c>False</c> otherwise</returns>
|
||||
private static bool IsProgramRunDirectly() {
|
||||
return GetConsoleProcessList(new int[2], 2) <= 1;
|
||||
}
|
||||
|
||||
private static int Main(string[] args) {
|
||||
try {
|
||||
ArgumentsParser.ParseArguments(RootVerb.RegisterOption(OptionShowAll).RegisterOption(OptionShowDevice)
|
||||
@@ -52,6 +61,7 @@ internal static class Program {
|
||||
Console.WriteLine("\nRemarks:");
|
||||
Console.WriteLine(" * If '-d' or '-f' is used, the raw name will not be shown unless '-n' is used.");
|
||||
Console.WriteLine(" * If '-D', '-t' or '-p' are used, the special separator between the raw and friendly name and the square brackets are not shown.");
|
||||
Console.WriteLine(" * If the program is raw without going through a console, the options '-n' and '-f' will be used.");
|
||||
Console.WriteLine(" * By default, the ports are sorted in the order they are provided by the registry, which is often chronological.");
|
||||
Console.WriteLine(" * The 'raw name' refers to a port name. (e.g.: COM1, COM2, ...)");
|
||||
Console.WriteLine(" * The 'device name' refers to a port device path. (e.g.: \\Device\\Serial1, ...)");
|
||||
@@ -90,12 +100,12 @@ internal static class Program {
|
||||
_shouldPrintDeviceNames = true;
|
||||
}
|
||||
|
||||
if(OptionShowFriendly.WasUsed()) {
|
||||
if(OptionShowFriendly.WasUsed() || IsProgramRunDirectly()) {
|
||||
_shouldPrintRawNames = false;
|
||||
_shouldPrintFriendlyNames = true;
|
||||
}
|
||||
|
||||
if(OptionShowNameRaw.WasUsed()) {
|
||||
if(OptionShowNameRaw.WasUsed() || IsProgramRunDirectly()) {
|
||||
_shouldPrintRawNames = true;
|
||||
}
|
||||
|
||||
@@ -178,6 +188,17 @@ internal static class Program {
|
||||
_exitCode = ErrorCodes.NoComPorts;
|
||||
}
|
||||
|
||||
// Allows the program to be ran from a shortcut without closing the console instantly.
|
||||
if(IsProgramRunDirectly()) {
|
||||
Console.Write("\nPress any key to continue...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
return _exitCode;
|
||||
}
|
||||
|
||||
// Imports "GetConsoleProcessList(...)" in order to know if the program was ran via a shortcut or CLI.
|
||||
// See: https://learn.microsoft.com/en-us/windows/console/getconsoleprocesslist
|
||||
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
|
||||
private static extern int GetConsoleProcessList(int[] buffer, int size);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<!--
|
||||
See: https://wixtoolset.org/documentation/manual/v3/xsd/wix/product.html
|
||||
-->
|
||||
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="1.0.0.0"
|
||||
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="3.0.0.0"
|
||||
Manufacturer="$(var.ProductManufacturer)" UpgradeCode="$(var.ProductUpgradeCode)">
|
||||
|
||||
<!--
|
||||
@@ -83,12 +83,12 @@
|
||||
<File KeyPath="yes" Source="$(var.FilePathExecutable)" Name="lscom.exe" />
|
||||
</Component>
|
||||
<Component Id="Licenses" Guid="5aa34a6f-2b5c-4544-8979-a20d6c1d3f3c" Directory="LICENSESFOLDER" Feature="FeatureLicenses" Win64="$(var.Win64)">
|
||||
<File Source="Licenses\License_DotNetCore.rtf" Name="License_DotNetCore.rtf" />
|
||||
<File Source="Licenses\License_Microsoft_DotNet.rtf" Name="License_Microsoft_DotNet.rtf" />
|
||||
<File Source="Licenses\License_Microsoft_VisualStudio.rtf" Name="License_Microsoft_VisualStudio.rtf" />
|
||||
<File Source="Licenses\License_NibblePoker.rtf" Name="License_NibblePoker.rtf" />
|
||||
<File Source="Licenses\License_WindowsSDK.rtf" Name="License_WindowsSDK.rtf" />
|
||||
<File Source="Licenses\PrivacyNotice_Microsoft_2022-09.rtf" Name="PrivacyNotice_Microsoft_2022-09.rtf" />
|
||||
<File Source="Licenses\License_DotNetCore.pdf" Name="License_DotNetCore.pdf" />
|
||||
<File Source="Licenses\License_Microsoft_DotNet.pdf" Name="License_Microsoft_DotNet.pdf" />
|
||||
<File Source="Licenses\License_Microsoft_VisualStudio.pdf" Name="License_Microsoft_VisualStudio.pdf" />
|
||||
<File Source="Licenses\License_NibblePoker.pdf" Name="License_NibblePoker.pdf" />
|
||||
<File Source="Licenses\License_WindowsSDK.pdf" Name="License_WindowsSDK.pdf" />
|
||||
<File Source="Licenses\PrivacyNotice_Microsoft_2022-09.pdf" Name="PrivacyNotice_Microsoft_2022-09.pdf" />
|
||||
</Component>
|
||||
<Component Id="Registry" Guid="73b5468a-97b3-4469-a95d-70330ed229e6" Directory="INSTALLFOLDER" Feature="FeatureRegistryPath" Win64="$(var.Win64)">
|
||||
<Environment Id="UpdatePath" Name="PATH" Part="last" Action="set" Permanent="yes" System="yes" Value="[INSTALLFOLDER]" />
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<Include>
|
||||
<!-- Shared variables -->
|
||||
<?define ProductManufacturer = "Herwin Bozet" ?>
|
||||
<?define PackageDescription = "Installer for "lscom.exe"." ?>
|
||||
<?define PackageComments = "Insert a comment here !" ?>
|
||||
<?define PackageDescription = "ListComPort / lscom" ?> <!-- Also reffered to as 'Subject' ! -->
|
||||
<?define PackageComments = "This installer database contains the logic and data required to install ListComPort." ?>
|
||||
|
||||
<!-- TODO: Add contact, support and help fields ! -->
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
|
||||
<!--
|
||||
Custom string for the license agreement.
|
||||
-->
|
||||
<String Id="LicenseAgreementDlgLicenseAcceptedCheckBox">I accept the terms in these License Agreements and Privacy Statement</String>
|
||||
</WixLocalization>
|
||||
@@ -12,7 +12,7 @@ echo Executing "candle.exe" for x64...
|
||||
"C:\Program Files (x86)\WiX Toolset v3.14\bin\candle.exe" -nologo "ListComPort.wxs" -out "ListComPort_x64.wixobj" -ext WixUIExtension
|
||||
|
||||
echo Executing "light.exe" for x64...
|
||||
"C:\Program Files (x86)\WiX Toolset v3.14\bin\light.exe" "ListComPort_x64.wixobj" -out "ListComPort_x64.msi" -ext WixUIExtension -cultures:en-us
|
||||
"C:\Program Files (x86)\WiX Toolset v3.14\bin\light.exe" "ListComPort_x64.wixobj" -loc en-us.wxl -out "ListComPort_x64.msi" -ext WixUIExtension -cultures:en-us
|
||||
|
||||
set WixTargetPlatform=x86
|
||||
|
||||
@@ -20,7 +20,7 @@ echo Executing "candle.exe" for x86...
|
||||
"C:\Program Files (x86)\WiX Toolset v3.14\bin\candle.exe" -nologo "ListComPort.wxs" -out "ListComPort_x86.wixobj" -ext WixUIExtension
|
||||
|
||||
echo Executing "light.exe" for x86...
|
||||
"C:\Program Files (x86)\WiX Toolset v3.14\bin\light.exe" "ListComPort_x86.wixobj" -out "ListComPort_x86.msi" -ext WixUIExtension -cultures:en-us
|
||||
"C:\Program Files (x86)\WiX Toolset v3.14\bin\light.exe" "ListComPort_x86.wixobj" -loc en-us.wxl -out "ListComPort_x86.msi" -ext WixUIExtension -cultures:en-us
|
||||
|
||||
del *.wixobj
|
||||
del *.wixpdb
|
||||
|
||||
@@ -20,7 +20,8 @@ The latest releases can be found here: "*[Release page](https://github.com/azias
|
||||
* Switched from *PureBasic* to *.NET 6.0*.
|
||||
* Improved **a lot** of the program's logic.
|
||||
* Added the `-h`/`--short-help`.
|
||||
* Added support for Windows ARM & ARM64
|
||||
* Added support for Windows ARM & ARM64.
|
||||
* Support for running without a console. (See [remarks](#remarks) #3)
|
||||
|
||||
## Usage
|
||||
```
|
||||
@@ -47,6 +48,7 @@ Launch arguments:
|
||||
## Remarks
|
||||
* If '-d' or '-f' is used, the raw name will not be shown unless '-n' is used.
|
||||
* If '-D', '-t' or '-p' are used, the special separator between the raw and friendly name and the square brackets are not shown.
|
||||
* If the program is raw without going through a console, the options '-n' and '-f' will be used
|
||||
* By default, the ports are sorted in the order they are provided by the registry, which is often chronological.
|
||||
* The 'raw name' refers to a port name. (e.g.: COM1, COM2, ...)
|
||||
* The 'device name' refers to a port device path. (e.g.: \Device\Serial1, ...)
|
||||
@@ -91,9 +93,14 @@ You can simply clone the repository with the following command:
|
||||
git clone https://github.com/aziascreations/DotNet-ListComPort.git
|
||||
```
|
||||
|
||||
Once this is done, you can compile it with the [compile.bat](compile.bat) script file.
|
||||
Once this is done, you can compile it with the [make.bat](make.bat) script file.
|
||||
|
||||
Please note that you may need to have to edit your `PATH` or the aforementioned script
|
||||
so that 7-Zip and Wix Toolset v3.14 can be used by it.
|
||||
|
||||
Finally, you should be able to find the executables in the "[Builds](Builds/)" folder,
|
||||
and the distributable packages in the "[Packages](Packages/)" folder.
|
||||
|
||||
Finally, you should be able to find the executables in the "[Builds](Builds/)" folder.
|
||||
|
||||
## License
|
||||
This project and all the libraries it uses are licensed under the [MIT](LICENSE) license.
|
||||
|
||||
Reference in New Issue
Block a user