Fixed a bug where the last modiefied Date would be in UTC

This commit is contained in:
schnulller
2022-06-05 17:22:48 +02:00
parent c95059b2e8
commit 0d33dcd4e5
3 changed files with 13 additions and 10 deletions

View File

@@ -21,7 +21,6 @@ namespace HaDocument
private static ILibrary _library; private static ILibrary _library;
public static ILibrary Create(IHaDocumentOptions Settings) { public static ILibrary Create(IHaDocumentOptions Settings) {
Console.WriteLine("PARSING");
SettingsValidator.Validate(Settings); SettingsValidator.Validate(Settings);
_settings = Settings; _settings = Settings;
_createReader(); _createReader();

View File

@@ -13,6 +13,11 @@ public class XMLProvider : IXMLProvider {
_fileProvider = provider; _fileProvider = provider;
_Roots = xmlservice.GetRootsDictionary(); _Roots = xmlservice.GetRootsDictionary();
_Files = _ScanFiles(); _Files = _ScanFiles();
if (_Files != null)
foreach(var category in _Files)
if (category.Value != null)
xmlservice.AutoUse(category.Value);
} }
public FileList? GetFiles(string prefix) public FileList? GetFiles(string prefix)
@@ -41,7 +46,7 @@ public class XMLProvider : IXMLProvider {
return; return;
} }
doc.SetFile(info); doc.File = info;
if (_Files == null) _Files = new Dictionary<string, FileList?>(); if (_Files == null) _Files = new Dictionary<string, FileList?>();
if (!_Files.ContainsKey(doc.Prefix)) _Files.Add(doc.Prefix, new FileList(doc.XMLRoot)); if (!_Files.ContainsKey(doc.Prefix)) _Files.Add(doc.Prefix, new FileList(doc.XMLRoot));

View File

@@ -8,6 +8,8 @@ using HaWeb.XMLParser;
public class XMLRootDocument { public class XMLRootDocument {
private XElement? _Element; private XElement? _Element;
private string? _filename; private string? _filename;
[JsonIgnore]
public IXMLRoot XMLRoot { get; private set; } public IXMLRoot XMLRoot { get; private set; }
[JsonIgnore] [JsonIgnore]
@@ -29,7 +31,7 @@ public class XMLRootDocument {
} }
[JsonIgnore] [JsonIgnore]
public IFileInfo? File { get; private set; } public IFileInfo? File { get; set; }
public string Prefix { get; private set; } public string Prefix { get; private set; }
public DateTime Date { get; private set; } public DateTime Date { get; private set; }
@@ -40,7 +42,10 @@ public class XMLRootDocument {
public XMLRootDocument(IXMLRoot xmlRoot, IFileInfo file) { public XMLRootDocument(IXMLRoot xmlRoot, IFileInfo file) {
XMLRoot = xmlRoot; XMLRoot = xmlRoot;
Prefix = xmlRoot.Prefix; Prefix = xmlRoot.Prefix;
SetFile(file); File = file;
Date = file.LastModified.LocalDateTime;
_filename = file.Name;
_GenerateFieldsFromFilename(file.Name);
} }
// Entry point for XML upload reading // Entry point for XML upload reading
@@ -52,12 +57,6 @@ public class XMLRootDocument {
_Element = element; _Element = element;
} }
public void SetFile(IFileInfo file) {
File = file;
Date = file.LastModified.DateTime;
_GenerateFieldsFromFilename(file.Name);
}
private string _CreateFilename() { private string _CreateFilename() {
var filename = _removeInvalidChars(Prefix) + "_"; var filename = _removeInvalidChars(Prefix) + "_";
if (!String.IsNullOrWhiteSpace(IdentificationString.Item1)) { if (!String.IsNullOrWhiteSpace(IdentificationString.Item1)) {