mirror of
				https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
				synced 2025-10-31 10:15:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			70 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 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;
 | |
| 
 | |
|         // 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);
 | |
|                             }
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
| 
 | |
|             }
 | |
| 
 | |
|             return new Library(
 | |
|                 Traditions,
 | |
|                 Persons,
 | |
|                 Metas,
 | |
|                 Marginals,
 | |
|                 Locations,
 | |
|                 Letters,
 | |
|                 HandPersons,
 | |
|                 Editreasons,
 | |
|                 Comments,
 | |
|                 Backlinks,
 | |
|                 Hands,
 | |
|                 Structure,
 | |
|                 options
 | |
|             );
 | |
|         }
 | |
|     }
 | |
| } | 
