-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (36 loc) · 1.18 KB
/
Program.cs
File metadata and controls
42 lines (36 loc) · 1.18 KB
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
using System;
using System.IO;
using SIL.Scripture;
namespace MarkerCheck
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 2 || args.Length > 3)
BadArguments();
if (args.Length == 3 && args[0] != "-usfm2")
BadArguments();
int bookArg = args.Length == 2 ? 0 : 1;
int bookNum = Canon.BookIdToNumber(args[bookArg]);
if (bookNum <= 0)
BadArguments();
string textFile = args[bookArg + 1];
if (!File.Exists(textFile))
BadArguments();
// allow USFM 3 markers to be used if not turned off
MarkerCheck check = new MarkerCheck(args.Length == 2);
if (check.Run(bookNum, File.ReadAllText(textFile)))
{
Console.WriteLine("MarkerCheck: file had errors");
Environment.Exit(1);
}
}
private static void BadArguments()
{
Console.WriteLine("Unexpected arguments.");
Console.WriteLine("MarkerCheck [-usfm2] BookCode UsfmTextFileName");
Environment.Exit(1);
}
}
}