-
Notifications
You must be signed in to change notification settings - Fork 0
/
Arguments.cs
45 lines (40 loc) · 1.58 KB
/
Arguments.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using CommandLineParser.Arguments;
using System.IO;
using static System.Console;
namespace NovoRender.PDFReader
{
class Arguments
{
public static Arguments Parse(string[] args)
{
var parser = new CommandLineParser.CommandLineParser();
parser.ShowUsageOnEmptyCommandline = true;
parser.ShowUsageHeader = "OctreeCreator.exe";
var arguments = new Arguments();
parser.ExtractArgumentAttributes(arguments);
try
{
parser.ParseCommandLine(args);
if (parser.ParsingSucceeded)
{
return arguments;
}
}
catch (Exception e)
{
WriteLine(e.Message);
parser.ShowUsage();
}
return null;
}
[FileArgument('i', "input", Optional = false, Example = "Document.pdf", FileMustExist = true, Description = "Input PDF-file")]
public FileInfo File { get; set; }
[DirectoryArgument('o', "output", Optional = false, Example = "outdir", DirectoryMustExist = false, Description = "Output directory")]
public DirectoryInfo OutputFolder { get; set; }
[ValueArgument(typeof(int), "tile-size", Optional = true, Example = "256", DefaultValue = 256, Description = "Tile size")]
public int TileSize { get; set; }
[ValueArgument(typeof(double), "density", Optional = true, Example = "500", DefaultValue = 500, Description = "PDF density")]
public double Density { get; set; }
}
}