Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit ca17537d authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

hashing tool: adding expected document type in viewmodels

parent c56b91c9
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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)
{
}
......
......@@ -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
{
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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>();
......
......@@ -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>();
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment