Created FileList with ability to set used files

This commit is contained in:
schnulller
2022-06-07 16:14:27 +02:00
parent 715cf167a0
commit d8155e26f6
44 changed files with 1468 additions and 119 deletions

View File

@@ -14,4 +14,6 @@ public interface IXMLService {
public void AutoUse(string prefix);
public void AutoUse(FileList filelist);
public Dictionary<string, FileList?>? GetInProduction();
public void UnUse(string prefix);
public void UnUseProduction();
}

View File

@@ -34,6 +34,8 @@ public class XMLService : IXMLService {
public Dictionary<string, FileList?>? GetInProduction() => this._InProduction;
public void UnUseProduction() => this._InProduction = null;
public List<XMLRootDocument>? ProbeHamannFile(XDocument document, ModelStateDictionary ModelState) {
if (document.Root!.Name != "opus") {
ModelState.AddModelError("Error", "A valid Hamann-Docuemnt must begin with <opus>");
@@ -66,6 +68,11 @@ public class XMLService : IXMLService {
_Used[doc.Prefix]!.Add(doc);
}
public void UnUse(string prefix) {
if (_Used != null && _Used.ContainsKey(prefix)) _Used.Remove(prefix);
return;
}
// Performs detection of using on the specified document type
public void AutoUse(string prefix) {
if (_Used == null || !_Used.ContainsKey(prefix)) return;