-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.vb
More file actions
42 lines (41 loc) · 2.09 KB
/
Copy pathProgram.vb
File metadata and controls
42 lines (41 loc) · 2.09 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
Imports System
Imports System.IO
Module Program
Private MarkDownFolder As String = "md" ' this is the subfolder to hold the markdown files
Private HelpText As String = "\nKT_Markdown.exe [fprFileName] [subfolderName]\n If [fprFileName] is missing then look in current folder.\n If [subFolderName] is missing then output to folder 'md'."
Sub Main(args As String())
Dim fprFilename As String = ""
Dim V As String = FileVersionInfo.GetVersionInfo(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName).FileVersion()
Console.WriteLine("Kofax Transformation Markdown Version " & V)
Console.WriteLine("https://github.com/KofaxTransformation/KT_Markdown")
'Dim Dir As New DirectoryInfo(System.IO.Path.GetDirectoryName(Reflection.Assembly.GetEntryAssembly().Location))
Dim Dir As New DirectoryInfo(Directory.GetCurrentDirectory)
If args.Length > 1 Then 'both fpr and folder given
fprFilename = args(0)
MarkDownFolder = args(1)
ElseIf args.Length > 0 AndAlso args(0).EndsWith(".fpr") Then 'fpr filename only
fprFilename = args(0)
ElseIf args.Length > 0 Then 'outputfoldername only
MarkDownFolder = args(0)
End If
If fprFilename = "" Then
'look in current folder for fpr file
For Each FileInfo In Dir.GetFiles("*.fpr")
fprFilename = FileInfo.FullName
Next
If fprFilename = "" Then
Console.WriteLine("give path to fpr file or put exe into project folder" & HelpText)
Exit Sub
End If
End If
If Not File.Exists(fprFilename) Then
Console.WriteLine("Cannot find " & fprFilename & HelpText)
Exit Sub
End If
Console.WriteLine("dir " & MarkDownFolder)
Console.WriteLine("using " + fprFilename)
Dim xdoc As New XDoc(fprFilename)
Dim MarkDown As New MarkDown(xdoc)
MarkDown.WriteAll(IO.Path.GetDirectoryName(fprFilename) & IO.Path.DirectorySeparatorChar & MarkDownFolder)
End Sub
End Module