Skip to content

Commit 3d62b4c

Browse files
committed
Public release
1 parent 4072914 commit 3d62b4c

17 files changed

+1184
-1
lines changed

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
github: p0dalirius
4+
patreon: Podalirius

.github/banner.png

6.57 KB
Loading

.github/example.png

33 KB
Loading

.github/workflows/commit.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build on commit
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
runs-on: windows-latest
11+
12+
strategy:
13+
matrix:
14+
binaryname: [FindProcessesWithNamedPipes]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Setup MSBuild
20+
uses: microsoft/setup-msbuild@v1.1
21+
22+
- name: Setup NuGet
23+
uses: NuGet/setup-nuget@v1.1.1
24+
25+
- name: Restore NuGet packages
26+
run: nuget restore
27+
28+
- name: Build Solution
29+
run: |
30+
MSBuild.exe /p:Configuration=Release
31+
32+
- name: dir
33+
run: dir

.github/workflows/release.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release Build
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
runs-on: windows-latest
10+
11+
strategy:
12+
matrix:
13+
binaryname: [FindProcessesWithNamedPipes]
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Setup MSBuild
19+
uses: microsoft/setup-msbuild@v1.1
20+
21+
- name: Setup NuGet
22+
uses: NuGet/setup-nuget@v1.1.1
23+
24+
- name: Restore NuGet packages
25+
run: nuget restore
26+
27+
- name: Build Solution
28+
run: MSBuild.exe /p:Configuration=Release
29+
30+
- name: dir
31+
run: dir ./x64/Release/
32+
33+
- name: Upload the Release binaries
34+
uses: svenstaro/upload-release-action@v2
35+
with:
36+
repo_token: ${{ secrets.GITHUB_TOKEN }}
37+
tag: ${{ github.ref }}
38+
file: ./x64/Release/*.exe
39+
file_glob: true
40+

.gitignore

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.sln.docstates
8+
9+
# Build results
10+
11+
[Dd]ebug/
12+
[Rr]elease/
13+
x64/
14+
[Bb]in/
15+
[Oo]bj/
16+
17+
# MSTest test Results
18+
[Tt]est[Rr]esult*/
19+
[Bb]uild[Ll]og.*
20+
21+
*_i.c
22+
*_p.c
23+
*_i.h
24+
*.ilk
25+
*.meta
26+
*.obj
27+
*.pch
28+
*.pdb
29+
*.pgc
30+
*.pgd
31+
*.rsp
32+
*.sbr
33+
*.tlb
34+
*.tli
35+
*.tlh
36+
*.tmp
37+
*.tmp_proj
38+
*.log
39+
*.vspscc
40+
*.vssscc
41+
.builds
42+
*.pidb
43+
*.log
44+
*.svclog
45+
*.scc
46+
47+
# Visual C++ cache files
48+
ipch/
49+
*.aps
50+
*.ncb
51+
*.opensdf
52+
*.sdf
53+
*.cachefile
54+
55+
# Visual Studio profiler
56+
*.psess
57+
*.vsp
58+
*.vspx
59+
60+
# Guidance Automation Toolkit
61+
*.gpState
62+
63+
# ReSharper is a .NET coding add-in
64+
_ReSharper*/
65+
*.[Rr]e[Ss]harper
66+
*.DotSettings.user
67+
68+
# Click-Once directory
69+
publish/
70+
71+
# Publish Web Output
72+
*.Publish.xml
73+
*.pubxml
74+
*.azurePubxml
75+
76+
# NuGet Packages Directory
77+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
78+
packages/
79+
## TODO: If the tool you use requires repositories.config, also uncomment the next line
80+
!packages/repositories.config
81+
82+
# Windows Azure Build Output
83+
csx/
84+
*.build.csdef
85+
86+
# Windows Store app package directory
87+
AppPackages/
88+
89+
# Others
90+
sql/
91+
*.Cache
92+
ClientBin/
93+
[Ss]tyle[Cc]op.*
94+
![Ss]tyle[Cc]op.targets
95+
~$*
96+
*~
97+
*.dbmdl
98+
*.[Pp]ublish.xml
99+
100+
*.publishsettings
101+
102+
# RIA/Silverlight projects
103+
Generated_Code/
104+
105+
# Backup & report files from converting an old project file to a newer
106+
# Visual Studio version. Backup files are not needed, because we have git ;-)
107+
_UpgradeReport_Files/
108+
Backup*/
109+
UpgradeLog*.XML
110+
UpgradeLog*.htm
111+
112+
# SQL Server files
113+
App_Data/*.mdf
114+
App_Data/*.ldf
115+
116+
# =========================
117+
# Windows detritus
118+
# =========================
119+
120+
# Windows image file caches
121+
Thumbs.db
122+
ehthumbs.db
123+
124+
# Folder config file
125+
Desktop.ini
126+
127+
# Recycle Bin used on file shares
128+
$RECYCLE.BIN/
129+
130+
# Mac desktop service store files
131+
.DS_Store
132+
133+
_NCrunch*

FindProcessesWithNamedPipes.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.13.35825.156 d17.13
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindProcessesWithNamedPipes", "FindProcessesWithNamedPipes\FindProcessesWithNamedPipes.vcxproj", "{6CC62BAC-7D1A-43E3-8A32-9CA86A5080AF}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{6CC62BAC-7D1A-43E3-8A32-9CA86A5080AF}.Debug|x64.ActiveCfg = Debug|x64
17+
{6CC62BAC-7D1A-43E3-8A32-9CA86A5080AF}.Debug|x64.Build.0 = Debug|x64
18+
{6CC62BAC-7D1A-43E3-8A32-9CA86A5080AF}.Debug|x86.ActiveCfg = Debug|Win32
19+
{6CC62BAC-7D1A-43E3-8A32-9CA86A5080AF}.Debug|x86.Build.0 = Debug|Win32
20+
{6CC62BAC-7D1A-43E3-8A32-9CA86A5080AF}.Release|x64.ActiveCfg = Release|x64
21+
{6CC62BAC-7D1A-43E3-8A32-9CA86A5080AF}.Release|x64.Build.0 = Release|x64
22+
{6CC62BAC-7D1A-43E3-8A32-9CA86A5080AF}.Release|x86.ActiveCfg = Release|Win32
23+
{6CC62BAC-7D1A-43E3-8A32-9CA86A5080AF}.Release|x86.Build.0 = Release|Win32
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {2BDB0840-8895-46B9-ADD7-7C3E07209EA5}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#include "Argument.h"
2+
#include <iostream>
3+
4+
Argument::Argument() {}
5+
6+
Argument::Argument(const std::string& name, ArgumentType argumentType, const std::string& shortoption, const std::string& longoption, const type_of_arguments_value& defaultValue, bool required, const std::string& help)
7+
: name(name),
8+
argumentType(argumentType),
9+
shortoption(shortoption),
10+
longoption(longoption),
11+
defaultValue(defaultValue),
12+
required(required),
13+
value(defaultValue),
14+
help(help)
15+
{
16+
17+
}
18+
19+
20+
int Argument::parse(int argc, char* argv[], int current_index) {
21+
if (this->argumentType == ArgumentType::BooleanSwitchArgument) {
22+
// Parsing BooleanSwitchArgument
23+
if (current_index <= (argc-1)) {
24+
if ((argv[current_index] == this->shortoption) || (argv[current_index] == this->longoption)) {
25+
current_index += 1;
26+
this->value = true;
27+
}
28+
else {
29+
this->value = false;
30+
}
31+
//std::cout << "Parsed BooleanSwitchArgument " << this->name << "\n";
32+
}
33+
}
34+
else if (this->argumentType == ArgumentType::StringArgument) {
35+
// Parsing StringArgument
36+
37+
if (current_index <= (argc-2)) {
38+
if ((argv[current_index] == this->shortoption) || (argv[current_index] == this->longoption)) {
39+
this->value = std::string(argv[current_index + 1]);
40+
current_index += 2;
41+
//std::cout << "Parsed StringArgument " << this->name << "\n";
42+
}
43+
}
44+
}
45+
else if (this->argumentType == ArgumentType::IntegerArgument) {
46+
// Parsing IntegerArgument
47+
if (current_index <= (argc - 2)) {
48+
if ((argv[current_index] == this->shortoption) || (argv[current_index] == this->longoption)) {
49+
this->value = std::stoi(argv[current_index + 1]);
50+
current_index += 2;
51+
//std::cout << "Parsed IntegerArgument " << this->name << "\n";
52+
}
53+
}
54+
}
55+
else if (this->argumentType == ArgumentType::PositionalIntegerArgument) {
56+
// Parsing PositionalIntegerArgument
57+
if (current_index <= (argc - 1)) {
58+
this->value = std::stoi(argv[current_index]);
59+
current_index += 1;
60+
//std::cout << "Parsed PositionalIntegerArgument " << this->name << "\n";
61+
}
62+
}
63+
else if (this->argumentType == ArgumentType::PositionalStringArgument) {
64+
// Parsing PositionalStringArgument
65+
if (current_index <= (argc - 1)) {
66+
this->value = std::string(argv[current_index]);
67+
current_index += 1;
68+
//std::cout << "Parsed PositionalStringArgument " << this->name << "\n";
69+
}
70+
}
71+
return current_index;
72+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#ifndef ARGUMENT_H
2+
#define ARGUMENT_H
3+
4+
#include <string>
5+
#include <variant>
6+
#include "ArgumentType.h"
7+
8+
using type_of_arguments_value = std::variant<bool, int, std::string>;
9+
10+
11+
class Argument
12+
{
13+
public:
14+
std::string name;
15+
ArgumentType argumentType;
16+
std::string shortoption;
17+
std::string longoption;
18+
type_of_arguments_value value;
19+
type_of_arguments_value defaultValue;
20+
bool required;
21+
std::string help;
22+
23+
Argument();
24+
25+
Argument(const std::string& name, ArgumentType argumentType, const std::string& shortoption, const std::string& longoption, const type_of_arguments_value& defaultValue, bool required, const std::string& help);
26+
27+
virtual int parse(int argc, char* argv[], int current_index);
28+
29+
/* Comparison operators */
30+
31+
bool operator==(const Argument& arg) const {
32+
return (this->name == arg.name);
33+
}
34+
35+
bool operator<(const Argument& arg) const {
36+
return (this->name < arg.name);
37+
}
38+
39+
bool operator>(const Argument& arg) const {
40+
return (this->name > arg.name);
41+
}
42+
43+
bool operator>=(const Argument& arg) const {
44+
return (this->name >= arg.name);
45+
}
46+
47+
bool operator<=(const Argument& arg) const {
48+
return (this->name <= arg.name);
49+
}
50+
51+
bool operator!=(const Argument& arg) const {
52+
return (this->name != arg.name);
53+
}
54+
};
55+
56+
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "ArgumentType.h"

0 commit comments

Comments
 (0)