Skip to content

Commit cd37221

Browse files
committed
Add to README and start on a CLI class
1 parent 757c67a commit cd37221

File tree

5 files changed

+83
-13
lines changed

5 files changed

+83
-13
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
c-sharp/obj
2-
build
2+
bin
33
.vs

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,27 @@ Download [TileMerger_rel_c1.zip](https://cdn.rawgit.com/Markavian/tile-merger/bb
2828
* **Process Images** - Attempts to merge the supplied images and save to the `Target file` path
2929
* **Quit** - Closes the application
3030

31+
32+
### Command Line Mode
33+
34+
New as of July 2023, you can use TilerMerger from the command line.
35+
36+
```
37+
>TileMerger.exe --help
38+
Tile Merger 1.0
39+
Supported arguments:
40+
41+
--src="<path>" Source folder to find files in
42+
--imgs="f1.png,f2.png" Comma separated list of files, overrides src, will still be filtered
43+
--dest="<path>" Destination file path to output to, defaults to ./TiledImages_x{cols}_{td|lr}.png
44+
--filter="string" Filter string, inclusive match
45+
--cols=6 Number of columns before wrapping
46+
--td=lr|tb Tiling Direction
47+
--help Show help and version info
48+
49+
Website: https://github.com/Markavian/tile-merger
50+
```
51+
3152
Version history
3253
---------------
3354

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Net.NetworkInformation;
5+
using System.Security.Cryptography;
6+
using System.Text;
7+
using System.Text.RegularExpressions;
8+
9+
namespace ImageMerger
10+
{
11+
internal class CommandLineInterface
12+
{
13+
private string[] args;
14+
15+
public CommandLineInterface(string[] args)
16+
{
17+
this.args = args;
18+
}
19+
20+
public void DisplayHelp()
21+
{
22+
var lines = new[] {
23+
"",
24+
"Tile Merger 1.0",
25+
"Supported arguments:",
26+
"",
27+
"--src=\"<path>\" Source folder to find files in",
28+
"--imgs=\"f1.png,f2.png\" Comma separated list of files, overrides src, will still be filtered",
29+
"--dest=\"<path>\" Destination file path to output to, defaults to./ TiledImages_x{ cols}_{ td | lr}.png",
30+
"--filter=\"string\" Filter string, inclusive match",
31+
"--cols=6 Number of columns before wrapping",
32+
"--td=lr|tb Tiling Direction - left-right (lr) or (top-bottom) (tb)",
33+
"--help Show help and version info",
34+
"",
35+
"Website: https://github.com/Markavian/tile-merger"
36+
};
37+
38+
WriteLines(lines);
39+
}
40+
41+
internal void ProcessArgs()
42+
{
43+
DisplayHelp();
44+
}
45+
46+
private void WriteLine(string line)
47+
{
48+
Console.WriteLine(line);
49+
}
50+
51+
private void WriteLines(string[] lines)
52+
{
53+
foreach (string line in lines) {
54+
WriteLine(line);
55+
}
56+
}
57+
}
58+
}

c-sharp/ImageMerger/Program.cs

+2-12
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,10 @@ private static void Main(string[] args)
2424
}
2525
else
2626
{
27-
WriteLine("");
28-
WriteLine("Tile Merger");
29-
// Process the arguments
30-
foreach (string arg in args)
31-
{
32-
WriteLine("Argument: " + arg);
33-
}
27+
var cli = new CommandLineInterface(args);
28+
cli.ProcessArgs();
3429
}
3530
}
36-
37-
private static void WriteLine(string line)
38-
{
39-
Console.WriteLine(line);
40-
}
4131
}
4232
}
4333

c-sharp/TileMerger.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<Reference Include="System.Drawing" />
5858
<Compile Include="AssemblyInfo.cs" />
5959
<Compile Include="Global.cs" />
60+
<Compile Include="ImageMerger\CommandLineInterface.cs" />
6061
<Compile Include="ImageMerger\Program.cs" />
6162
<Compile Include="ImageMerger\MainForm.cs">
6263
<SubType>Form</SubType>

0 commit comments

Comments
 (0)