-
Notifications
You must be signed in to change notification settings - Fork 1
/
Options.cs
88 lines (81 loc) · 3.04 KB
/
Options.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//-----------------------------------------------------------------------
// <copyright file="Options.cs" company="Studio A&T s.r.l.">
// Copyright (c) Studio A&T s.r.l. All rights reserved.
// </copyright>
// <author>Nicogis</author>
//-----------------------------------------------------------------------
namespace Studioat.ArcGIS.Voronoi
{
using System.Collections.Generic;
using CommandLine;
using CommandLine.Text;
/// <summary>
/// class args parameter
/// </summary>
internal class Options
{
/// <summary>
/// Gets or sets file
/// </summary>
[Option('f', "file", Required = true, MutuallyExclusiveSet = "voronoi", HelpText = @"Path and file geodatabase. For instance 'c:\temp\demo.gdb'")]
public string PathAndFGDB
{
get;
set;
}
/// <summary>
/// Gets or sets name of feature class point
/// </summary>
[Option('i', "points", Required = false, MutuallyExclusiveSet = "voronoi", HelpText = "Name of feature class points. Default ('Points')")]
public string FeatureClassNameInput
{
get;
set;
}
/// <summary>
/// Gets or sets from of distance
/// </summary>
[Option('o', "polygons", Required = false, MutuallyExclusiveSet = "voronoi", HelpText = "Name of feature class polygons output. Default ('Polygons')")]
public string FeatureClassNameOutput
{
get;
set;
}
/// <summary>
/// Gets or sets LastParserState
/// </summary>
[ParserState]
public IParserState LastParserState
{
get;
set;
}
/// <summary>
/// help of application
/// </summary>
/// <returns>string of help</returns>
[HelpOption]
public string GetUsage()
{
return HelpText.AutoBuild(this, (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
}
/// <summary>
/// message of errors
/// </summary>
/// <returns>string of message of errors</returns>
public string GetUsageError()
{
var help = new HelpText();
if (this.LastParserState.Errors.Count > 0)
{
var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat("\n", "Error(s):"));
help.AddPreOptionsLine(errors);
}
}
return help;
}
}
}