diff --git a/HashingTool/ViewModel/HashComponentDataViewModel.cs b/HashingTool/ViewModel/HashComponentDataViewModel.cs index f8e1aab09a6008cd15f5883a3ad4a8fdd4030f3d..e65a6bb0f254f837f6b38b9d89ed0ba0ae1e1951 100644 --- a/HashingTool/ViewModel/HashComponentDataViewModel.cs +++ b/HashingTool/ViewModel/HashComponentDataViewModel.cs @@ -43,6 +43,7 @@ using HashingTool.Helper; using HashingTool.Util; using HashingTool.ViewModel.UserControl; using TUGraz.VectoHashing; +using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType; namespace HashingTool.ViewModel { @@ -60,7 +61,7 @@ namespace HashingTool.ViewModel private DateTime? _date; public HashComponentDataViewModel() - : base("Hash Component Data", false, HashingHelper.IsComponentFile) + : base("Hash Component Data", false, HashingHelper.IsComponentFile, XmlDocumentType.DeclarationComponentData) { _xmlFile.PropertyChanged += SourceChanged; _saveCommand = new RelayCommand(SaveDocument, diff --git a/HashingTool/ViewModel/UserControl/CustomerReportXMLFile.cs b/HashingTool/ViewModel/UserControl/CustomerReportXMLFile.cs index 659c73f7db894857b7bccaf37c84faf20de16b07..22fc7ba3282ff7593154660ac6da2d17e513af28 100644 --- a/HashingTool/ViewModel/UserControl/CustomerReportXMLFile.cs +++ b/HashingTool/ViewModel/UserControl/CustomerReportXMLFile.cs @@ -34,6 +34,7 @@ using System.ComponentModel; using System.Linq; using System.Xml; using TUGraz.VectoHashing; +using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType; namespace HashingTool.ViewModel.UserControl { @@ -48,7 +49,7 @@ namespace HashingTool.ViewModel.UserControl private bool _manufacturerReportDigestValid; public CustomerReportXMLFile(string name, Func<XmlDocument, IErrorLogger, bool?> contentCheck, - Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(name, contentCheck, hashValidation) + Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(name, contentCheck, XmlDocumentType.CustomerReport, hashValidation) { } diff --git a/HashingTool/ViewModel/UserControl/HashedXMLFile.cs b/HashingTool/ViewModel/UserControl/HashedXMLFile.cs index 1072a9caed32c0841318061c4e7b928cf66e5407..fa172c3614b1630cf90651122a72f1e02c81a729 100644 --- a/HashingTool/ViewModel/UserControl/HashedXMLFile.cs +++ b/HashingTool/ViewModel/UserControl/HashedXMLFile.cs @@ -33,6 +33,7 @@ using System; using System.Collections.ObjectModel; using System.ComponentModel; using System.Xml; +using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType; namespace HashingTool.ViewModel.UserControl { @@ -41,8 +42,10 @@ namespace HashingTool.ViewModel.UserControl protected string _digestValueRead; private DateTime? _date; - public HashedXMLFile(string name, Func<XmlDocument, IErrorLogger, bool?> contentCheck, - Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(name, true, contentCheck, hashValidation) {} + public HashedXMLFile( + string name, Func<XmlDocument, IErrorLogger, bool?> contentCheck, XmlDocumentType xmlDocumentType, + Action<XmlDocument, VectoXMLFile> hashValidation = null) : base( + name, true, contentCheck, xmlDocumentType, hashValidation) { } public string DigestValueRead { diff --git a/HashingTool/ViewModel/UserControl/ManufacturerReportXMLFile.cs b/HashingTool/ViewModel/UserControl/ManufacturerReportXMLFile.cs index a1fbbb883280bf5bbb4ffd2994ce5436b21e4e60..a612e475025e699311da331a2ddbc288ecb61306 100644 --- a/HashingTool/ViewModel/UserControl/ManufacturerReportXMLFile.cs +++ b/HashingTool/ViewModel/UserControl/ManufacturerReportXMLFile.cs @@ -40,6 +40,7 @@ using TUGraz.VectoCommon.Resources; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; using TUGraz.VectoHashing; +using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType; namespace HashingTool.ViewModel.UserControl { @@ -48,7 +49,7 @@ namespace HashingTool.ViewModel.UserControl private bool _manufacturerReportValid; public ManufacturerReportXMLFile(string name, Func<XmlDocument, IErrorLogger, bool?> contentCheck, - Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(name, contentCheck, hashValidation) + Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(name, contentCheck, XmlDocumentType.ManufacturerReport, hashValidation) { _xmlFile.PropertyChanged += UpdateComponents; } diff --git a/HashingTool/ViewModel/UserControl/ReportXMLFile.cs b/HashingTool/ViewModel/UserControl/ReportXMLFile.cs index dd4c831c8d1ef5fd0a9ab8b247b3bdecdc1d3beb..6c4c2496c1088e578a6a5e8122ce541574dd939c 100644 --- a/HashingTool/ViewModel/UserControl/ReportXMLFile.cs +++ b/HashingTool/ViewModel/UserControl/ReportXMLFile.cs @@ -37,6 +37,7 @@ using System.Xml; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCore.InputData.FileIO.XML.Declaration; using TUGraz.VectoHashing; +using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType; namespace HashingTool.ViewModel.UserControl { @@ -52,9 +53,8 @@ namespace HashingTool.ViewModel.UserControl protected VectoJobFile _jobData; private string _reportVin; - public ReportXMLFile(string name, Func<XmlDocument, IErrorLogger, bool?> contentCheck, - Action<XmlDocument, VectoXMLFile> hashValidation = null) - : base(name, contentCheck, hashValidation) + public ReportXMLFile(string name, Func<XmlDocument, IErrorLogger, bool?> contentCheck, XmlDocumentType xmlDocumentType, Action<XmlDocument, VectoXMLFile> hashValidation = null) + : base(name, contentCheck, xmlDocumentType, hashValidation) { _xmlFile.PropertyChanged += ReportChanged; } @@ -123,7 +123,8 @@ namespace HashingTool.ViewModel.UserControl JobDigestMatchesReport = vinMatch && digestMatch; - } catch (Exception) { + } catch (Exception e) { + _xmlFile.LogError(e.Message); JobDigestValueComputed = ""; JobDigestMatchesReport = false; } diff --git a/HashingTool/ViewModel/UserControl/VectoJobFile.cs b/HashingTool/ViewModel/UserControl/VectoJobFile.cs index 814b309bf3ad171a59d50782ff7e59ec7788dcb3..57fb7a4ae60b1418bc9acd0a2e9a9886eb2086df 100644 --- a/HashingTool/ViewModel/UserControl/VectoJobFile.cs +++ b/HashingTool/ViewModel/UserControl/VectoJobFile.cs @@ -38,6 +38,7 @@ using HashingTool.Helper; using TUGraz.VectoCommon.Hashing; using TUGraz.VectoCommon.Resources; using TUGraz.VectoHashing; +using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType; namespace HashingTool.ViewModel.UserControl { @@ -50,7 +51,7 @@ namespace HashingTool.ViewModel.UserControl public VectoJobFile(string name, Func<XmlDocument, IErrorLogger, bool?> contentCheck, - Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(name, true, contentCheck, hashValidation) + Action<XmlDocument, VectoXMLFile> hashValidation = null) : base(name, true, contentCheck, XmlDocumentType.DeclarationJobData, hashValidation) { _xmlFile.PropertyChanged += JobFilechanged; Components = new ObservableCollection<ComponentEntry>(); diff --git a/HashingTool/ViewModel/UserControl/VectoXMLFile.cs b/HashingTool/ViewModel/UserControl/VectoXMLFile.cs index 9eabe8527b5a1313cb4bba0cfbd66b95616f2b85..564582ca54b838b529c8412d9cf59ef0fd9d656b 100644 --- a/HashingTool/ViewModel/UserControl/VectoXMLFile.cs +++ b/HashingTool/ViewModel/UserControl/VectoXMLFile.cs @@ -35,6 +35,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Xml; using HashingTool.Helper; +using XmlDocumentType = TUGraz.VectoCore.Utils.XmlDocumentType; namespace HashingTool.ViewModel.UserControl { @@ -51,11 +52,10 @@ namespace HashingTool.ViewModel.UserControl private string _digestMethod; - public VectoXMLFile(string name, bool validate, Func<XmlDocument, IErrorLogger, bool?> contentCheck, - Action<XmlDocument, VectoXMLFile> hashValidation = null) + public VectoXMLFile(string name, bool validate, Func<XmlDocument, IErrorLogger, bool?> contentCheck, XmlDocumentType xmlDocumentType, Action<XmlDocument, VectoXMLFile> hashValidation = null) { _validateHashes = hashValidation; - _xmlFile = new XMLFileSelector(IoService, name, validate, contentCheck); + _xmlFile = new XMLFileSelector(IoService, name, xmlDocumentType, validate, contentCheck); _xmlFile.PropertyChanged += FileChanged; Name = name; CanonicalizationMethods = new ObservableCollection<string>(); diff --git a/HashingTool/ViewModel/VerifyComponentInputDataViewModel.cs b/HashingTool/ViewModel/VerifyComponentInputDataViewModel.cs index cd43531d6338b986f7eba58ac422d48b195bc3e2..16c45b4ec86a1564e46f8cd2101c8f0363910d1e 100644 --- a/HashingTool/ViewModel/VerifyComponentInputDataViewModel.cs +++ b/HashingTool/ViewModel/VerifyComponentInputDataViewModel.cs @@ -39,6 +39,7 @@ using System.Windows.Input; using HashingTool.Helper; using HashingTool.ViewModel.UserControl; using TUGraz.VectoCommon.Hashing; +using TUGraz.VectoCore.Utils; using TUGraz.VectoHashing; namespace HashingTool.ViewModel @@ -49,7 +50,7 @@ namespace HashingTool.ViewModel //private bool _componentDataValid; public VerifyComponentInputDataViewModel() - : base("Verify Component Data", HashingHelper.IsComponentFile, HashingHelper.ValidateDocumentHash) + : base("Verify Component Data", HashingHelper.IsComponentFile, XmlDocumentType.DeclarationComponentData, HashingHelper.ValidateDocumentHash) { _xmlFile.PropertyChanged += ComponentFilechanged; }