-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
711 additions
and
234 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/SIL.Machine/Corpora/FileParatextProjectSettingsParser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace SIL.Machine.Corpora | ||
{ | ||
public class FileParatextProjectSettingsParser : ParatextProjectSettingsParserBase | ||
{ | ||
private readonly string _projectDir; | ||
|
||
public FileParatextProjectSettingsParser(string projectDir) | ||
{ | ||
_projectDir = projectDir; | ||
} | ||
|
||
protected override UsfmStylesheet CreateStylesheet(string fileName) | ||
{ | ||
string customStylesheetFileName = Path.Combine(_projectDir, fileName); | ||
return new UsfmStylesheet( | ||
fileName, | ||
File.Exists(customStylesheetFileName) ? customStylesheetFileName : null | ||
); | ||
} | ||
|
||
protected override bool Exists(string fileName) | ||
{ | ||
return File.Exists(Path.Combine(_projectDir, fileName)); | ||
} | ||
|
||
protected override string Find(string extension) | ||
{ | ||
return Directory.EnumerateFiles(_projectDir, "*" + extension).FirstOrDefault(); | ||
} | ||
|
||
protected override Stream Open(string fileName) | ||
{ | ||
return File.OpenRead(Path.Combine(_projectDir, fileName)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Text; | ||
using SIL.Scripture; | ||
|
||
namespace SIL.Machine.Corpora | ||
{ | ||
public class ParatextProjectSettings | ||
{ | ||
public ParatextProjectSettings( | ||
string name, | ||
Encoding encoding, | ||
ScrVers versification, | ||
UsfmStylesheet stylesheet, | ||
string bookNamePrefix, | ||
string bookNameSuffix, | ||
string biblicalTermsListType, | ||
string biblicalTermsProjectName, | ||
string biblicalTermsFileName | ||
) | ||
{ | ||
Name = name; | ||
Encoding = encoding; | ||
Versification = versification; | ||
Stylesheet = stylesheet; | ||
BookNamePrefix = bookNamePrefix; | ||
BookNameSuffix = bookNameSuffix; | ||
BiblicalTermsListType = biblicalTermsListType; | ||
BiblicalTermsProjectName = biblicalTermsProjectName; | ||
BiblicalTermsFileName = biblicalTermsFileName; | ||
} | ||
|
||
public string Name { get; } | ||
public Encoding Encoding { get; } | ||
public ScrVers Versification { get; } | ||
public UsfmStylesheet Stylesheet { get; } | ||
public string BookNamePrefix { get; } | ||
public string BookNameSuffix { get; } | ||
public string BiblicalTermsListType { get; } | ||
public string BiblicalTermsProjectName { get; } | ||
public string BiblicalTermsFileName { get; } | ||
} | ||
} |
Oops, something went wrong.