added basic start page setup; began rewrite of parser

This commit is contained in:
schnulller
2022-06-14 00:31:52 +02:00
parent 6be85d495b
commit 9e53de8be3
61 changed files with 532745 additions and 661 deletions

View File

@@ -1,24 +1,20 @@
namespace HaDocument.Models {
public class Backlink {
public string Index { get; } = "";
namespace HaDocument.Models;
public string Letter { get; } = "";
public string Page { get; } = "";
public string Line { get; } = "";
public string MarginalIndex { get; } = "";
public class Backlink {
public string Letter { get; }
public string? Page { get; }
public string? Line { get; }
public string MarginalIndex { get; }
public Backlink(
string index,
string letter,
string page,
string line,
string marginalindex
) {
Index = index;
Letter = letter;
Page = page;
Line = line;
MarginalIndex = marginalindex;
}
public Backlink(
string letter,
string? page,
string? line,
string marginalindex
) {
Letter = letter;
Page = page;
Line = line;
MarginalIndex = marginalindex;
}
}

View File

@@ -1,36 +1,39 @@
namespace HaDocument.Models;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Xml.Linq;
namespace HaDocument.Models {
public class Comment{
public string Entry { get; } = "";
public string Index { get; } = "";
public string Type { get; } = "";
public string Lemma { get; } = "";
public string Parent { get; } = "";
public int Order { get; } = -1;
public ImmutableSortedDictionary<string, Comment> Kommentare { get; }
public class Comment {
public XElement Entry { get; }
public string Value { get; }
public string Index { get; }
public string? Type { get; }
public string? Lemma { get; }
public string? Parent { get; }
public int? Order { get; }
public ImmutableSortedDictionary<string, Comment>? SubComments { get; }
public Comment(
string entry,
string index,
string type,
string lemma,
int order,
SortedDictionary<string, Comment> subComments,
string parent=""
) {
Entry = entry;
Index = index;
Type = type;
Lemma = lemma;
Order = order;
Parent = parent;
if (subComments != null)
Kommentare = ImmutableSortedDictionary.ToImmutableSortedDictionary(subComments);
else
Kommentare = null;
}
public Comment(
XElement entry,
string value,
string index,
string? type,
string? lemma,
int? order,
SortedDictionary<string, Comment>? subComments,
string? parent
) {
Value = value;
Entry = entry;
Index = index;
Type = type;
Lemma = lemma;
Order = order;
Parent = parent;
if (subComments != null)
SubComments = ImmutableSortedDictionary.ToImmutableSortedDictionary(subComments);
else
SubComments = null;
}
}
}

View File

@@ -0,0 +1,23 @@
namespace HaDocument.Models;
public class Edit {
public string StartPage { get; }
public string StartLine { get; }
public string EndPage { get; }
public string EndLine { get; }
public string Reference { get; }
public Edit(
string reference,
string startpage,
string startline,
string endpage,
string endline
) {
StartPage = startpage;
StartLine = startline;
EndPage = endpage;
EndLine = endline;
Reference = reference;
}
}

View File

@@ -1,32 +1,21 @@
namespace HaDocument.Models {
public class Editreason {
public string Index { get; } = "";
public string Element { get; } = "";
public string Letter { get; } = "";
public string StartPage { get; } = "";
public string StartLine { get; } = "";
public string EndPage { get; } = "";
public string EndLine { get; } = "";
public string Reference { get; } = "";
public Editreason(
string index,
string element,
string letter = "",
string startpage = "",
string startline = "",
string endpage = "",
string endline = "",
string reference = ""
) {
Index = index;
Element = element;
Letter = letter;
StartPage = startpage;
StartLine = startline;
EndPage = endpage;
EndLine = endline;
Reference = reference;
}
namespace HaDocument.Models;
using System.Xml.Linq;
public class Editreason {
public string Index { get; }
public XElement Element { get; }
public string Value { get; }
public string Letter { get; }
public Editreason(
string index,
XElement element,
string value,
string letter
) {
Index = index;
Value = value;
Element = element;
Letter = letter;
}
}

View File

@@ -1,15 +0,0 @@
using System;
using HaXMLReader.EvArgs;
using System.Collections.Generic;
namespace HaDocument.Models {
public abstract class HaModel {
protected static List<(Func<Tag, bool>, Action<Tag>)> FieldActions = null;
internal static void AddAction(Func<Tag, bool> If, Action<Tag> Then) {
if (If == null || Then == null) throw new ArgumentNullException();
if (FieldActions == null) FieldActions = new List<(Func<Tag, bool>, Action<Tag>)>();
FieldActions.Add((If, Then));
}
}
}

View File

@@ -1,26 +1,26 @@
namespace HaDocument.Models {
public class Hand : HaModel {
public string Letter { get; } = "";
public string Person { get; } = "";
public string StartPage { get; } = "";
public string StartLine { get; } = "";
public string EndPage { get; } = "";
public string EndLine {get; } = "";
namespace HaDocument.Models;
public Hand(
string letter,
string person,
string startpage,
string startline,
string endpage,
string endline
) {
Letter = letter;
Person = person;
StartPage = startpage;
StartLine = startline;
EndPage = endpage;
EndLine = endline;
}
public class Hand {
public string Letter { get; }
public string Reference { get; }
public string StartPage { get; }
public string StartLine { get; }
public string EndPage { get; }
public string EndLine {get; }
public Hand(
string letter,
string reference,
string startpage,
string startline,
string endpage,
string endline
) {
Letter = letter;
Reference = reference;
StartPage = startpage;
StartLine = startline;
EndPage = endpage;
EndLine = endline;
}
}
}

View File

@@ -1,70 +1,70 @@
using System.Collections.Generic;
using HaDocument.Interfaces;
// using System.Collections.Generic;
// using HaDocument.Interfaces;
namespace HaDocument.Models
{
public class IntermediateLibrary
{
public Dictionary<string, Tradition> Traditions;
public Dictionary<string, Person> Persons;
public Dictionary<string, Meta> Metas;
public Dictionary<string, Marginal> Marginals;
public Dictionary<string, Location> Locations;
public Dictionary<string, Letter> Letters;
public Dictionary<string, Person> HandPersons;
public Dictionary<string, Editreason> Editreasons;
public Dictionary<string, Comment> Comments;
public Dictionary<string, List<Backlink>> Backlinks;
public Dictionary<string, List<Hand>> Hands;
// namespace HaDocument.Models
// {
// public class IntermediateLibrary
// {
// public Dictionary<string, Tradition> Traditions;
// public Dictionary<string, Person> Persons;
// public Dictionary<string, Meta> Metas;
// public Dictionary<string, Marginal> Marginals;
// public Dictionary<string, Location> Locations;
// public Dictionary<string, Letter> Letters;
// public Dictionary<string, Person> HandPersons;
// public Dictionary<string, Editreason> Editreasons;
// public Dictionary<string, Comment> Comments;
// public Dictionary<string, List<Backlink>> Backlinks;
// public Dictionary<string, List<Hand>> Hands;
// Helper Library for precalculationg the Structure of the Document:
public Dictionary<string, Dictionary<string, HashSet<string>>> LetterPageLines;
// // Helper Library for precalculationg the Structure of the Document:
// public Dictionary<string, Dictionary<string, HashSet<string>>> LetterPageLines;
public Library GetLibrary(IHaDocumentOptions options)
{
var Structure = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
foreach (var letter in LetterPageLines)
{
if (Metas.ContainsKey(letter.Key) &&
Metas[letter.Key].ZH != null)
{
if (!Structure.ContainsKey(Metas[letter.Key].ZH.Volume))
{
Structure.Add(Metas[letter.Key].ZH.Volume, new Dictionary<string, Dictionary<string, string>>());
}
foreach (var page in letter.Value)
{
if (!Structure[Metas[letter.Key].ZH.Volume].ContainsKey(page.Key))
{
Structure[Metas[letter.Key].ZH.Volume].Add(page.Key, new Dictionary<string, string>());
}
foreach (var line in page.Value)
{
if (!Structure[Metas[letter.Key].ZH.Volume][page.Key].ContainsKey(line))
{
Structure[Metas[letter.Key].ZH.Volume][page.Key].Add(line, letter.Key);
}
}
}
}
// public Library GetLibrary(IHaDocumentOptions options)
// {
// var Structure = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
// foreach (var letter in LetterPageLines)
// {
// if (Metas.ContainsKey(letter.Key) &&
// Metas[letter.Key].ZH != null)
// {
// if (!Structure.ContainsKey(Metas[letter.Key].ZH.Volume))
// {
// Structure.Add(Metas[letter.Key].ZH.Volume, new Dictionary<string, Dictionary<string, string>>());
// }
// foreach (var page in letter.Value)
// {
// if (!Structure[Metas[letter.Key].ZH.Volume].ContainsKey(page.Key))
// {
// Structure[Metas[letter.Key].ZH.Volume].Add(page.Key, new Dictionary<string, string>());
// }
// foreach (var line in page.Value)
// {
// if (!Structure[Metas[letter.Key].ZH.Volume][page.Key].ContainsKey(line))
// {
// Structure[Metas[letter.Key].ZH.Volume][page.Key].Add(line, letter.Key);
// }
// }
// }
// }
}
// }
return new Library(
Traditions,
Persons,
Metas,
Marginals,
Locations,
Letters,
HandPersons,
Editreasons,
Comments,
Backlinks,
Hands,
Structure,
options
);
}
}
}
// return new Library(
// Traditions,
// Persons,
// Metas,
// Marginals,
// Locations,
// Letters,
// HandPersons,
// Editreasons,
// Comments,
// Backlinks,
// Hands,
// Structure,
// options
// );
// }
// }
// }

View File

@@ -1,16 +1,19 @@
namespace HaDocument.Models {
public class Letter : HaModel {
public string Index { get; } = "";
public string Element { get; } = "";
public string Value { get; } = "";
namespace HaDocument.Models;
using System.Xml.Linq;
using System.Xml;
public Letter(
string index,
string element,
string value
) {
Index = index;
Element = element;
}
public class Letter {
public string Index { get; }
public XElement Element { get; }
public string Value { get; }
public Letter(
string index,
XElement element,
string value
) {
Index = index;
Element = element;
Value = value;
}
}

View File

@@ -1,150 +1,140 @@
using System;
using HaDocument.Interfaces;
using System.Collections.Immutable;
using System.Collections.Generic;
using HaDocument.Models;
using HaDocument.Comparers;
using System.Linq;
namespace HaDocument.Models
{
public class Library : ILibrary
{
public IHaDocumentOptions Options { get; }
public ImmutableDictionary<string, Tradition> Traditions { get; }
public ImmutableDictionary<string, Person> Persons { get; }
public ImmutableDictionary<string, Meta> Metas { get; }
public ImmutableDictionary<string, Marginal> Marginals { get; }
public ImmutableDictionary<string, Location> Locations { get; }
public ImmutableDictionary<string, Letter> Letters { get; }
public ImmutableDictionary<string, Person> HandPersons { get; }
public ImmutableDictionary<string, Editreason> Editreasons { get; }
public ImmutableDictionary<string, Comment> Comments { get; }
public ImmutableDictionary<string, ImmutableList<Backlink>> Backlinks { get; }
public ImmutableDictionary<string, ImmutableList<Hand>> Hands { get; }
// Structure for lookups from ZH:
public ImmutableDictionary<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>> Structure { get; }
// Lookups:
// Auswählen von Kommentaren nach (1) Kategorie, (2) Anfangsbuchstaben vom Lemma.
// So: _ = CommentsByCategoryLetter['neuzeit']['A']
public ImmutableDictionary<string, Lookup<string, Comment>> CommentsByCategoryLetter { get; }
public Lookup<string, Comment> CommentsByCategory { get; }
// Auswählen von Subkommentaren nach ID
public ImmutableDictionary<string, Comment> SubCommentsByID { get; }
// Auswählen von Marginalien nach Briefen
public Lookup<string, Marginal> MarginalsByLetter { get; }
// Ausw?hlen von Edits nach Briefen
public Lookup<string, Editreason> EditreasonsByLetter { get; }
// Auswählen von Briefen nach autoptischer Numemr und in zeitlich sortierter Reihenfolge.
public ImmutableSortedSet<Meta> MetasByDate { get; }
// Auswählen von Briefen nach dem Jahr, sortiert nach Datum
public ILookup<string, Meta> MetasByYear { get; }
// namespace HaDocument.Models;
// using System;
// using HaDocument.Interfaces;
// using System.Collections.Immutable;
// using System.Collections.Generic;
// using HaDocument.Models;
// using HaDocument.Comparers;
// using System.Linq;
public Library(
Dictionary<string, Tradition> traditions,
Dictionary<string, Person> persons,
Dictionary<string, Meta> meta,
Dictionary<string, Marginal> marginals,
Dictionary<string, Location> locations,
Dictionary<string, Letter> letters,
Dictionary<string, Person> handPersons,
Dictionary<string, Editreason> editReasons,
Dictionary<string, Comment> comments,
Dictionary<string, List<Backlink>> backlinks,
Dictionary<string, List<Hand>> hands,
Dictionary<string, Dictionary<string, Dictionary<string, string>>> Structure,
IHaDocumentOptions options
)
{
// Dictionaries
Traditions = ImmutableDictionary.ToImmutableDictionary(traditions);
Persons = ImmutableDictionary.ToImmutableDictionary(persons);
Metas = ImmutableDictionary.ToImmutableDictionary(meta);
Marginals = ImmutableDictionary.ToImmutableDictionary(marginals);
Locations = ImmutableDictionary.ToImmutableDictionary(locations);
Letters = ImmutableDictionary.ToImmutableDictionary(letters);
HandPersons = ImmutableDictionary.ToImmutableDictionary(handPersons);
Editreasons = ImmutableDictionary.ToImmutableDictionary(editReasons);
Comments = ImmutableDictionary.ToImmutableDictionary(comments);
// public class Library : ILibrary {
// public IHaDocumentOptions Options { get; }
// public ImmutableDictionary<string, Tradition> Traditions { get; }
// public ImmutableDictionary<string, Person> Persons { get; }
// public ImmutableDictionary<string, Meta> Metas { get; }
// public ImmutableDictionary<string, Marginal> Marginals { get; }
// public ImmutableDictionary<string, Location> Locations { get; }
// public ImmutableDictionary<string, Letter> Letters { get; }
// public ImmutableDictionary<string, Person> HandPersons { get; }
// public ImmutableDictionary<string, Editreason> Editreasons { get; }
// public ImmutableDictionary<string, Comment> Comments { get; }
// public ImmutableDictionary<string, ImmutableList<Backlink>> Backlinks { get; }
// public ImmutableDictionary<string, ImmutableList<Hand>> Hands { get; }
var backbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableList<Backlink>>();
foreach (var entry in backlinks)
backbuilder.Add(entry.Key, ImmutableList.ToImmutableList(entry.Value));
Backlinks = backbuilder.ToImmutableDictionary();
// // Structure for lookups from ZH:
// public ImmutableDictionary<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>> Structure { get; }
var handbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableList<Hand>>();
foreach (var entry in hands)
handbuilder.Add(entry.Key, ImmutableList.ToImmutableList(entry.Value));
Hands = handbuilder.ToImmutableDictionary();
// Lookups
CommentsByCategory = (Lookup<string, Comment>)Comments.Values.ToLookup(x => x.Type);
var CommentsByLetter_builder = ImmutableDictionary.CreateBuilder<string, Lookup<string, Comment>>();
foreach (var ts in CommentsByCategory)
{
CommentsByLetter_builder.Add(ts.Key, (Lookup<string, Comment>)ts.ToLookup(x => x.Index.Substring(0, 1).ToUpper()));
}
CommentsByCategoryLetter = CommentsByLetter_builder.ToImmutableDictionary();
MarginalsByLetter = (Lookup<string, Marginal>)Marginals.Values.ToLookup(x => x.Letter);
EditreasonsByLetter = (Lookup<string, Editreason>)Editreasons.Values.ToLookup(x => x.Letter);
MetasByDate = Metas.Values.ToImmutableSortedSet<Meta>(new DefaultComparer());
MetasByYear = Metas.Values.ToLookup(x => x.Sort.Year.ToString());
var tempbuilder = ImmutableDictionary.CreateBuilder<string, Comment>();
foreach (var comm in Comments)
if (comm.Value.Kommentare != null)
foreach (var subcomm in comm.Value.Kommentare)
if (!tempbuilder.ContainsKey(subcomm.Key))
tempbuilder.Add(subcomm.Key, subcomm.Value);
SubCommentsByID = tempbuilder.ToImmutableDictionary();
var tempstructurebuilder = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>>();
foreach (var volume in Structure)
{
if (volume.Value != null)
{
var tempvolbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, string>>();
foreach (var page in volume.Value)
{
if (page.Value != null)
{
tempvolbuilder.Add(page.Key, page.Value.ToImmutableDictionary());
}
}
if (tempvolbuilder.Any())
{
tempstructurebuilder.Add(volume.Key, tempvolbuilder.ToImmutableDictionary());
}
}
}
this.Structure = tempstructurebuilder.ToImmutableDictionary();
Options = options;
}
// public List<Meta> MetasByDate() {
// var ret = Metas.OrderBy(x => x.Value, new DefaultComparer()).ToLookup(x => x.Value.Autopsic, x => x.Value);
// ret.Sort(new DefaultComparer());
// return ret;
// }
public ImmutableList<Meta> MetasByZH()
{
return Metas.Values.ToImmutableList().Sort(new Comparers.ZHComparer());
}
public List<Person> PersonByAlphabet()
{
var ret = Persons.Values.ToList();
ret.Sort(new PersonComparer());
return ret;
}
// // Lookups:
// // Auswählen von Kommentaren nach (1) Kategorie, (2) Anfangsbuchstaben vom Lemma.
// // So: _ = CommentsByCategoryLetter['neuzeit']['A']
// public ImmutableDictionary<string, Lookup<string, Comment>> CommentsByCategoryLetter { get; }
// public Lookup<string, Comment> CommentsByCategory { get; }
// // Auswählen von Subkommentaren nach ID
// public ImmutableDictionary<string, Comment> SubCommentsByID { get; }
// // Auswählen von Marginalien nach Briefen
// public Lookup<string, Marginal> MarginalsByLetter { get; }
// // Ausw?hlen von Edits nach Briefen
// public Lookup<string, Editreason> EditreasonsByLetter { get; }
// // Auswählen von Briefen nach autoptischer Numemr und in zeitlich sortierter Reihenfolge.
// public ImmutableSortedSet<Meta> MetasByDate { get; }
// // Auswählen von Briefen nach dem Jahr, sortiert nach Datum
// public ILookup<string, Meta> MetasByYear { get; }
}
}
// public Library(
// Dictionary<string, Tradition> traditions,
// Dictionary<string, Person> persons,
// Dictionary<string, Meta> meta,
// Dictionary<string, Marginal> marginals,
// Dictionary<string, Location> locations,
// Dictionary<string, Letter> letters,
// Dictionary<string, Person> handPersons,
// Dictionary<string, Editreason> editReasons,
// Dictionary<string, Comment> comments,
// Dictionary<string, List<Backlink>> backlinks,
// Dictionary<string, List<Hand>> hands,
// Dictionary<string, Dictionary<string, Dictionary<string, string>>> Structure,
// IHaDocumentOptions options
// ) {
// // Dictionaries
// Traditions = ImmutableDictionary.ToImmutableDictionary(traditions);
// Persons = ImmutableDictionary.ToImmutableDictionary(persons);
// Metas = ImmutableDictionary.ToImmutableDictionary(meta);
// Marginals = ImmutableDictionary.ToImmutableDictionary(marginals);
// Locations = ImmutableDictionary.ToImmutableDictionary(locations);
// Letters = ImmutableDictionary.ToImmutableDictionary(letters);
// HandPersons = ImmutableDictionary.ToImmutableDictionary(handPersons);
// Editreasons = ImmutableDictionary.ToImmutableDictionary(editReasons);
// Comments = ImmutableDictionary.ToImmutableDictionary(comments);
// var backbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableList<Backlink>>();
// foreach (var entry in backlinks)
// backbuilder.Add(entry.Key, ImmutableList.ToImmutableList(entry.Value));
// Backlinks = backbuilder.ToImmutableDictionary();
// var handbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableList<Hand>>();
// foreach (var entry in hands)
// handbuilder.Add(entry.Key, ImmutableList.ToImmutableList(entry.Value));
// Hands = handbuilder.ToImmutableDictionary();
// // Lookups
// CommentsByCategory = (Lookup<string, Comment>)Comments.Values.ToLookup(x => x.Type);
// var CommentsByLetter_builder = ImmutableDictionary.CreateBuilder<string, Lookup<string, Comment>>();
// foreach (var ts in CommentsByCategory) {
// CommentsByLetter_builder.Add(ts.Key, (Lookup<string, Comment>)ts.ToLookup(x => x.Index.Substring(0, 1).ToUpper()));
// }
// CommentsByCategoryLetter = CommentsByLetter_builder.ToImmutableDictionary();
// MarginalsByLetter = (Lookup<string, Marginal>)Marginals.Values.ToLookup(x => x.Letter);
// EditreasonsByLetter = (Lookup<string, Editreason>)Editreasons.Values.ToLookup(x => x.Letter);
// MetasByDate = Metas.Values.ToImmutableSortedSet<Meta>(new DefaultComparer());
// MetasByYear = Metas.Values.ToLookup(x => x.Sort.Year.ToString());
// var tempbuilder = ImmutableDictionary.CreateBuilder<string, Comment>();
// foreach (var comm in Comments)
// if (comm.Value.SubComments != null)
// foreach (var subcomm in comm.Value.SubComments)
// if (!tempbuilder.ContainsKey(subcomm.Key))
// tempbuilder.Add(subcomm.Key, subcomm.Value);
// SubCommentsByID = tempbuilder.ToImmutableDictionary();
// var tempstructurebuilder = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>>();
// foreach (var volume in Structure) {
// if (volume.Value != null) {
// var tempvolbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, string>>();
// foreach (var page in volume.Value) {
// if (page.Value != null) {
// tempvolbuilder.Add(page.Key, page.Value.ToImmutableDictionary());
// }
// }
// if (tempvolbuilder.Any()) {
// tempstructurebuilder.Add(volume.Key, tempvolbuilder.ToImmutableDictionary());
// }
// }
// }
// this.Structure = tempstructurebuilder.ToImmutableDictionary();
// Options = options;
// }
// // public List<Meta> MetasByDate() {
// // var ret = Metas.OrderBy(x => x.Value, new DefaultComparer()).ToLookup(x => x.Value.Autopsic, x => x.Value);
// // ret.Sort(new DefaultComparer());
// // return ret;
// // }
// public ImmutableList<Meta> MetasByZH() {
// return Metas.Values.ToImmutableList().Sort(new Comparers.ZHComparer());
// }
// public List<Person> PersonByAlphabet() {
// var ret = Persons.Values.ToList();
// ret.Sort(new Comparers.PersonComparer());
// return ret;
// }
// }
// }

View File

@@ -1,14 +1,13 @@
namespace HaDocument.Models {
public class Location {
public string Index { get; } = "";
public string Name { get; } = "";
namespace HaDocument.Models;
public class Location {
public string Index { get; } = "";
public string Name { get; } = "";
public Location(
string index,
string name
) {
Index = index;
Name = name;
}
public Location(
string index,
string name
) {
Index = index;
Name = name;
}
}
}

View File

@@ -1,23 +1,27 @@
namespace HaDocument.Models {
public class Marginal {
public string Index { get; } = "";
public string Letter { get; } = "";
public string Page { get; } = "";
public string Line { get; } = "";
public string Element { get; } = "";
public Marginal(
string index,
string letter,
string page,
string line,
string elemnt
) {
Index = index;
Letter = letter;
Page = page;
Line = line;
Element = elemnt;
}
namespace HaDocument.Models;
using System.Xml.Linq;
public class Marginal {
public string Index { get; }
public string Letter { get; }
public string Page { get; }
public string Line { get; }
public XElement Element { get; }
public string Value { get; }
public Marginal(
XElement element,
string value,
string index,
string letter,
string page,
string line
) {
Index = index;
Letter = letter;
Page = page;
Line = line;
Element = element;
Value = value;
}
}
}

View File

@@ -1,49 +1,47 @@
namespace HaDocument.Models;
using System;
using System.Collections.Generic;
using HaXMLReader.EvArgs;
namespace HaDocument.Models {
public class Meta {
public string Index { get; } = "";
public string Autopsic { get; } = "";
public string Date { get; } = "";
public DateTime Sort { get; } = new DateTime(1700, 1, 1);
public int Order { get; } = -1;
public string Location { get; } = "";
public List<string> Senders { get; } = null;
public List<string> Receivers { get; } = null;
public OptionalBool hasOriginal { get; } = OptionalBool.None;
public OptionalBool isProofread { get; } = OptionalBool.None;
public OptionalBool isDraft { get; } = OptionalBool.None;
public ZHInfo ZH { get; } = null;
public Meta(
string index,
string autopsic,
string date,
DateTime sort,
int order,
OptionalBool hasOriginal,
OptionalBool isProofread,
OptionalBool isDraft,
string location,
List<string> senders,
List<string> receivers,
ZHInfo ZH
) {
Index = index;
Autopsic = autopsic;
Date = date;
Sort = sort;
Order = order;
Location = location;
Senders = senders;
Receivers = receivers;
this.hasOriginal = hasOriginal;
this.isProofread = isProofread;
this.isDraft = isDraft;
this.ZH = ZH;
}
public class Meta {
public string Index { get; }
public string Autopsic { get; }
public string Date { get; }
public DateTime Sort { get; }
public int? Order { get; }
public string Location { get; }
public List<string> Senders { get; }
public List<string> Receivers { get; }
public bool? hasOriginal { get; }
public bool? isProofread { get; }
public bool? isDraft { get; }
public ZHInfo? ZH { get; }
public Meta(
string index,
string autopsic,
string date,
DateTime sort,
int? order,
string location,
List<string> senders,
List<string> receivers,
bool? hasOriginal,
bool? isProofread,
bool? isDraft,
ZHInfo? ZH
) {
Index = index;
Autopsic = autopsic;
Date = date;
Sort = sort;
Order = order;
Location = location;
Senders = senders;
Receivers = receivers;
this.hasOriginal = hasOriginal;
this.isProofread = isProofread;
this.isDraft = isDraft;
this.ZH = ZH;
}
}
}

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace HaDocument.Models
{
public enum OptionalBool
{
True,
False,
None
}
}

View File

@@ -1,20 +1,20 @@
namespace HaDocument.Models {
public class Person {
public string Index { get; } = "";
public string Name { get; } = "";
public string Prename { get; } = "";
public string Surname { get; } = "";
namespace HaDocument.Models;
public Person(
string index,
string name,
string prename,
string surname
) {
Index = index;
Name = name;
Prename = prename;
Surname = surname;
}
public class Person {
public string Index { get; }
public string Name { get; }
public string? Prename { get; }
public string? Surname { get; }
public Person(
string index,
string name,
string? prename,
string? surname
) {
Index = index;
Name = name;
Prename = prename;
Surname = surname;
}
}
}

View File

@@ -1,14 +1,18 @@
namespace HaDocument.Models {
public class Tradition {
public string Index { get; } = "";
public string Element { get; } = "";
namespace HaDocument.Models;
using System.Xml.Linq;
public Tradition(
string index,
string element
) {
Index = index;
Element = element;
}
public class Tradition {
public string Index { get; }
public XElement Element { get; }
public string Value;
public Tradition(
string index,
XElement element,
string value
) {
Index = index;
Element = element;
Value = value;
}
}

View File

@@ -1,22 +1,19 @@
using System;
namespace HaDocument.Models;
using System;
using System.Collections.Generic;
using System.Text;
namespace HaDocument.Models
{
public class ZHInfo {
public bool? alternativeLineNumbering { get; }
public bool? dateChanged { get; }
public string Volume { get; }
public string Page { get; }
public class ZHInfo
{
public bool alternativeLineNumbering { get; } = false;
public bool dateChanged { get; } = false;
public string Volume { get; } = "";
public string Page { get; } = "";
public ZHInfo(bool alternativeLineNumbering, bool dateChanged, string Volume, string Page) {
this.alternativeLineNumbering = alternativeLineNumbering;
this.dateChanged = dateChanged;
this.Volume = Volume;
this.Page = Page;
}
public ZHInfo(string Volume, string Page, bool? alternativeLineNumbering, bool? dateChanged) {
this.alternativeLineNumbering = alternativeLineNumbering;
this.dateChanged = dateChanged;
this.Volume = Volume;
this.Page = Page;
}
}