First working version of drugs formatting.

This commit is contained in:
Daniel Kraus
2015-11-26 21:33:10 +01:00
parent bcbed5bca3
commit 21e7d44187
13 changed files with 207 additions and 20 deletions

View File

@ -36,7 +36,7 @@ namespace zaaReloaded2.Medication
/// The detected block is selected.
/// </summary>
/// <returns>True if a block was detected, false if not.</returns>
public bool AutoDetect(Document document)
public static bool AutoDetect(Document document)
{
Paragraph start = null;
Paragraph end = null;
@ -47,20 +47,20 @@ namespace zaaReloaded2.Medication
string line = document.Paragraphs[i].Range.Text;
if (Prescription.IsPrescriptionLine(line))
{
start = document.Paragraphs[i];
end = document.Paragraphs[i];
break;
}
i--;
}
if (start != null)
if (end != null)
{
end = start;
while (i > 1)
start = end;
while (i > 2)
{
if (!Prescription.IsPrescriptionLine(document.Paragraphs[i - 1].Range.Text))
{
end = document.Paragraphs[i];
start = document.Paragraphs[i];
break;
}
i--;
@ -102,7 +102,7 @@ namespace zaaReloaded2.Medication
{
if (Prescription.IsPrescriptionLine(line))
{
Prescriptions.Add(Prescription.FromLine(line));
Prescriptions.AddRange(Prescription.ManyFromLine(line));
}
}
}