mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 01:35:32 +00:00
added basic start page setup; began rewrite of parser
This commit is contained in:
17
HaDocumentNew/Comparers/CommentComparer.cs
Normal file
17
HaDocumentNew/Comparers/CommentComparer.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using HaDocument.Models;
|
||||
|
||||
// namespace HaDocument.Comparers {
|
||||
// public class CommentComparer : IComparer<Comment> {
|
||||
// public CommentComparer() : base() { }
|
||||
|
||||
// public int Compare(Comment first, Comment second) {
|
||||
// if (first.Order != second.Order)
|
||||
// return first.Order.CompareTo(second.Order);
|
||||
// else
|
||||
// return first.Index.CompareTo(second.Index);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
22
HaDocumentNew/Comparers/DefaultComparer.cs
Normal file
22
HaDocumentNew/Comparers/DefaultComparer.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// using HaDocument.Models;
|
||||
|
||||
// namespace HaDocument.Comparers
|
||||
// {
|
||||
// public class DefaultComparer : IComparer<Meta>
|
||||
// {
|
||||
// public int Compare(Meta first, Meta second)
|
||||
// {
|
||||
// if (first.Sort != second.Sort)
|
||||
// return System.DateTime.Compare(first.Sort, second.Sort);
|
||||
// else if (first.Order != second.Order)
|
||||
// return first.Order.CompareTo(second.Order);
|
||||
// else
|
||||
// return String.Compare(first.Index, second.Index);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
13
HaDocumentNew/Comparers/PersonComparer.cs
Normal file
13
HaDocumentNew/Comparers/PersonComparer.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
// using System;
|
||||
// using HaDocument.Models;
|
||||
// using System.Collections.Generic;
|
||||
|
||||
// namespace HaDocument.Comparers {
|
||||
// public class PersonComparer : IComparer<Person> {
|
||||
// public int Compare(Person first, Person second) {
|
||||
// var cmp = String.Compare(first.Surname, second.Surname);
|
||||
// if (cmp == 0) cmp = String.Compare(first.Name, second.Name);
|
||||
// return cmp;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
41
HaDocumentNew/Comparers/ZHComparer.cs
Normal file
41
HaDocumentNew/Comparers/ZHComparer.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// using HaDocument.Models;
|
||||
|
||||
// namespace HaDocument.Comparers
|
||||
// {
|
||||
// public class ZHComparer : IComparer<Meta>
|
||||
// {
|
||||
// public int Compare(Meta first, Meta second)
|
||||
// {
|
||||
// var firstNumber = 0;
|
||||
// var secondNumber = 0;
|
||||
// Int32.TryParse(first.Index, out firstNumber);
|
||||
// Int32.TryParse(second.Index, out secondNumber);
|
||||
// return firstNumber.CompareTo(secondNumber);
|
||||
|
||||
// //var firstIndex = from c in first.Meta.Autopsic
|
||||
// // where char.IsDigit(c)
|
||||
// // select c;
|
||||
// //var secondIndex = from c in second.Meta.Autopsic
|
||||
// // where char.IsDigit(c)
|
||||
// // select c;
|
||||
// //int firstNumber = 0;
|
||||
// //int secondNumber = 0;
|
||||
// //Int32.TryParse(String.Join("", firstIndex), out firstNumber);
|
||||
// //Int32.TryParse(String.Join("", secondIndex), out secondNumber);
|
||||
// //if (firstNumber.CompareTo(secondNumber) != 0)
|
||||
// // return firstNumber.CompareTo(secondNumber);
|
||||
// //var firstChar = from c in first.Meta.Autopsic
|
||||
// // where char.IsMeta(c)
|
||||
// // select c;
|
||||
// //var secondChar = from c in first.Meta.Autopsic
|
||||
// // where char.IsMeta(c)
|
||||
// // select c;
|
||||
// //return String.Compare(String.Join("", firstChar), String.Join("", secondChar));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -1,5 +1,4 @@
|
||||
namespace HaDocument;
|
||||
public class Document
|
||||
{
|
||||
public class Document {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace HaDocument.Interfaces;
|
||||
|
||||
public interface IDocument {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace HaDocument.Interfaces;
|
||||
namespace HaDocument.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Immutable;
|
||||
using HaDocument.Models;
|
||||
@@ -18,7 +18,7 @@ public interface ILibrary {
|
||||
ImmutableDictionary<string, ImmutableList<Backlink>> Backlinks { get; }
|
||||
ImmutableDictionary<string, ImmutableList<Hand>> Hands { get; }
|
||||
ImmutableDictionary<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>> Structure { get; }
|
||||
|
||||
|
||||
ImmutableDictionary<string, Lookup<string, Comment>> CommentsByCategoryLetter { get; }
|
||||
Lookup<string, Comment> CommentsByCategory { get; }
|
||||
Lookup<string, Marginal> MarginalsByLetter { get; }
|
||||
|
||||
64
HaDocumentNew/Interfaces/IXMLRoot.cs
Normal file
64
HaDocumentNew/Interfaces/IXMLRoot.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
namespace HaDocument.Interfaces;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using HaDocument.Models;
|
||||
|
||||
public interface IXMLRoot {
|
||||
// Name of the IXMLRoot
|
||||
public abstract string Type { get; }
|
||||
|
||||
// Name of the file prefix
|
||||
public abstract string Prefix { get; }
|
||||
|
||||
// XPaths to determine if container is present
|
||||
public abstract string[] XPathContainer { get; }
|
||||
|
||||
// Tag Name of child objects to be collected
|
||||
public abstract Predicate<XElement> IsCollectedObject { get; }
|
||||
|
||||
// Gets the Key of a collected object
|
||||
// public abstract Func<XElement, string?> GetKey { get; }
|
||||
|
||||
// Can the Root be found within that document?
|
||||
public List<XElement>? IsTypeOf(XElement root) {
|
||||
List<XElement>? ret = null;
|
||||
foreach (var p in XPathContainer) {
|
||||
var elements = root.XPathSelectElements(p);
|
||||
if (elements != null && elements.Any()) {
|
||||
if (ret == null) ret = new List<XElement>();
|
||||
foreach (var e in elements)
|
||||
if (!ret.Contains(e)) ret.Add(e);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Generate certain metadata fields to display about this root
|
||||
// public abstract List<(string, string?)>? GenerateFields(XMLRootDocument document);
|
||||
|
||||
// Generate an identification string of which the hash will be the filename.
|
||||
// The second string will be appended literally for convenience.
|
||||
// If the queries of two document are equal they replace each other
|
||||
// If the queries and the date of two documents are equal the later one gets deleted
|
||||
public abstract (string?, string?) GenerateIdentificationString(XElement element);
|
||||
|
||||
// Further deciding which of two documents replaces which
|
||||
// public abstract bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2);
|
||||
|
||||
// public Dictionary<string, XElement>? GetCollectedObjects(XMLRootDocument document) {
|
||||
// Dictionary<string, XElement>? ret = null;
|
||||
// var root = document.GetElement();
|
||||
// root.Elements().Where(x => this.IsCollectedObject(x)).ToList().ForEach(x => {
|
||||
// var id = this.GetKey(x);
|
||||
// if (id != null) {
|
||||
// if (ret == null) ret = new Dictionary<string, XElement>();
|
||||
// ret.Add(id, x);
|
||||
// }
|
||||
// });
|
||||
// return ret;
|
||||
// }
|
||||
|
||||
public abstract XElement CreateHamannDocument(XElement element);
|
||||
|
||||
// public abstract void MergeIntoFile(XElement file, XMLRootDocument document);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
HaDocumentNew/Models/Edit.cs
Normal file
23
HaDocumentNew/Models/Edit.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace HaDocument.Models
|
||||
{
|
||||
public enum OptionalBool
|
||||
{
|
||||
True,
|
||||
False,
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace HaDocument.Settings.XMLRoots;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
public class CommentRoot : HaDocument.Interfaces.IXMLRoot {
|
||||
public string Type { get; } = "Register";
|
||||
public string Prefix { get; } = "register";
|
||||
public string[] XPathContainer { get; } = { ".//data//kommentare/kommcat", ".//kommentare/kommcat" };
|
||||
@@ -18,9 +18,9 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
else return null;
|
||||
};
|
||||
|
||||
public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
return null;
|
||||
}
|
||||
// public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public (string?, string?) GenerateIdentificationString(XElement element) {
|
||||
var kat = element.Attribute("value");
|
||||
@@ -29,9 +29,9 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
return true;
|
||||
}
|
||||
// public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public XElement CreateHamannDocument(XElement element) {
|
||||
var opus = new XElement("opus");
|
||||
@@ -41,10 +41,10 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("kommentare") == null)
|
||||
file.AddFirst(new XElement("kommentare"));
|
||||
file.Element("kommentare")!.AddFirst(document.Root);
|
||||
}
|
||||
// public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
// if (file.Element("kommentare") == null)
|
||||
// file.AddFirst(new XElement("kommentare"));
|
||||
// file.Element("kommentare")!.AddFirst(document.Root);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace HaDocument.Settings.XMLRoots;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
public class DescriptionsRoot : HaDocument.Interfaces.IXMLRoot {
|
||||
public string Type { get; } = "Metadaten";
|
||||
public string Prefix { get; } = "metadaten";
|
||||
public string[] XPathContainer { get; } = { ".//data/descriptions", ".//descriptions" };
|
||||
@@ -18,17 +18,17 @@ public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
// else return null;
|
||||
// };
|
||||
|
||||
public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
return null;
|
||||
}
|
||||
// public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public (string?, string?) GenerateIdentificationString(XElement element) {
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
return true;
|
||||
}
|
||||
// public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public XElement CreateHamannDocument(XElement element) {
|
||||
var opus = new XElement("opus");
|
||||
@@ -36,14 +36,14 @@ public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("descriptions") == null)
|
||||
file.AddFirst(new XElement("descriptions"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("descriptions");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
// public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
// if (file.Element("descriptions") == null)
|
||||
// file.AddFirst(new XElement("descriptions"));
|
||||
// var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
// var root = file.Element("descriptions");
|
||||
// foreach (var element in elements) {
|
||||
// root!.Add(element);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ namespace HaDocument.Settings.XMLRoots;
|
||||
using System.Xml.Linq;
|
||||
|
||||
|
||||
public class DocumentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
public class DocumentRoot : HaDocument.Interfaces.IXMLRoot {
|
||||
public string Type { get; } = "Brieftext";
|
||||
public string Prefix { get; } = "brieftext";
|
||||
public string[] XPathContainer { get; } = { ".//data/document", ".//document" };
|
||||
@@ -19,17 +19,17 @@ public class DocumentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
else return null;
|
||||
};
|
||||
|
||||
public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
return null;
|
||||
}
|
||||
// public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public (string?, string?) GenerateIdentificationString(XElement element) {
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
return true;
|
||||
}
|
||||
// public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public XElement CreateHamannDocument(XElement element) {
|
||||
var opus = new XElement("opus");
|
||||
@@ -37,14 +37,14 @@ public class DocumentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("document") == null)
|
||||
file.AddFirst(new XElement("document"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("document");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
// public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
// if (file.Element("document") == null)
|
||||
// file.AddFirst(new XElement("document"));
|
||||
// var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
// var root = file.Element("document");
|
||||
// foreach (var element in elements) {
|
||||
// root!.Add(element);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ namespace HaDocument.Settings.XMLRoots;
|
||||
using System.Xml.Linq;
|
||||
|
||||
|
||||
public class EditsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
public class EditsRoot : HaDocument.Interfaces.IXMLRoot {
|
||||
public string Type { get; } = "Texteingriffe";
|
||||
public string Prefix { get; } = "texteingriffe";
|
||||
public string[] XPathContainer { get; } = { ".//data/edits", ".//edits" };
|
||||
@@ -19,17 +19,17 @@ public class EditsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
else return null;
|
||||
};
|
||||
|
||||
public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
return null;
|
||||
}
|
||||
// public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public (string?, string?) GenerateIdentificationString(XElement element) {
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
return true;
|
||||
}
|
||||
// public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public XElement CreateHamannDocument(XElement element) {
|
||||
var opus = new XElement("opus");
|
||||
@@ -37,14 +37,14 @@ public class EditsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("edits") == null)
|
||||
file.AddFirst(new XElement("edits"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("edits");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
// public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
// if (file.Element("edits") == null)
|
||||
// file.AddFirst(new XElement("edits"));
|
||||
// var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
// var root = file.Element("edits");
|
||||
// foreach (var element in elements) {
|
||||
// root!.Add(element);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace HaDocument.Settings.XMLRoots;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
public class MarginalsRoot : HaDocument.Interfaces.IXMLRoot {
|
||||
public string Type { get; } = "Stellenkommentar";
|
||||
public string Prefix { get; } = "stellenkommentar";
|
||||
public string[] XPathContainer { get; } = { ".//data/marginalien", ".//marginalien" };
|
||||
@@ -18,17 +18,17 @@ public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
else return null;
|
||||
};
|
||||
|
||||
public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
return null;
|
||||
}
|
||||
// public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public (string?, string?) GenerateIdentificationString(XElement element) {
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
return true;
|
||||
}
|
||||
// public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public XElement CreateHamannDocument(XElement element) {
|
||||
var opus = new XElement("opus");
|
||||
@@ -36,14 +36,14 @@ public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("marginalien") == null)
|
||||
file.AddFirst(new XElement("marginalien"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("marginalien");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
// public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
// if (file.Element("marginalien") == null)
|
||||
// file.AddFirst(new XElement("marginalien"));
|
||||
// var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
// var root = file.Element("marginalien");
|
||||
// foreach (var element in elements) {
|
||||
// root!.Add(element);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ namespace HaDocument.Settings.XMLRoots;
|
||||
using System.Xml.Linq;
|
||||
|
||||
|
||||
public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
public class ReferencesRoot : HaDocument.Interfaces.IXMLRoot {
|
||||
public string Type { get; } = "Personen / Orte";
|
||||
public string Prefix { get; } = "personenorte";
|
||||
public string[] XPathContainer { get; } = { ".//data/definitions", ".//definitions" };
|
||||
@@ -17,17 +17,17 @@ public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return elem.Name.ToString();
|
||||
};
|
||||
|
||||
public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
return null;
|
||||
}
|
||||
// public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public (string?, string?) GenerateIdentificationString(XElement element) {
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
return true;
|
||||
}
|
||||
// public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public XElement CreateHamannDocument(XElement element) {
|
||||
var opus = new XElement("opus");
|
||||
@@ -35,14 +35,14 @@ public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("definitions") == null)
|
||||
file.AddFirst(new XElement("definitions"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("definitions");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
// public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
// if (file.Element("definitions") == null)
|
||||
// file.AddFirst(new XElement("definitions"));
|
||||
// var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
// var root = file.Element("definitions");
|
||||
// foreach (var element in elements) {
|
||||
// root!.Add(element);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ namespace HaDocument.Settings.XMLRoots;
|
||||
using System.Xml.Linq;
|
||||
|
||||
|
||||
public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
public class TraditionsRoot : HaDocument.Interfaces.IXMLRoot {
|
||||
public string Type { get; } = "Überlieferung";
|
||||
public string Prefix { get; } = "ueberlieferung";
|
||||
public string[] XPathContainer { get; } = { ".//data/traditions", ".//traditions" };
|
||||
@@ -19,17 +19,17 @@ public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
else return null;
|
||||
};
|
||||
|
||||
public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
return null;
|
||||
}
|
||||
// public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public (string?, string?) GenerateIdentificationString(XElement element) {
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
return true;
|
||||
}
|
||||
// public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
public XElement CreateHamannDocument(XElement element) {
|
||||
var opus = new XElement("opus");
|
||||
@@ -37,13 +37,13 @@ public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("traditions") == null)
|
||||
file.AddFirst(new XElement("traditions"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("traditions");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
// public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
// if (file.Element("traditions") == null)
|
||||
// file.AddFirst(new XElement("traditions"));
|
||||
// var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
// var root = file.Element("traditions");
|
||||
// foreach (var element in elements) {
|
||||
// root!.Add(element);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
16
HaDocumentNew/omnisharp.json
Normal file
16
HaDocumentNew/omnisharp.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"FormattingOptions": {
|
||||
"NewLinesForBracesInLambdaExpressionBody": false,
|
||||
"NewLinesForBracesInAnonymousMethods": false,
|
||||
"NewLinesForBracesInAnonymousTypes": false,
|
||||
"NewLinesForBracesInControlBlocks": false,
|
||||
"NewLinesForBracesInTypes": false,
|
||||
"NewLinesForBracesInMethods": false,
|
||||
"NewLinesForBracesInProperties": false,
|
||||
"NewLinesForBracesInObjectCollectionArrayInitializers": false,
|
||||
"NewLinesForBracesInAccessors": false,
|
||||
"NewLineForElse": false,
|
||||
"NewLineForCatch": false,
|
||||
"NewLineForFinally": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user