Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Select Git revision
  • 63f0d770be42d9b0b8213e72c1f2acde1cf1874d
  • stable default
  • feat-fchv-bus
  • fix-h2-ice-bus
  • powertrains-multiple-axles
  • amdm3/develop
  • issue-1039
  • amdm3/main
  • test/nuget_publish
  • IEPC-experiments
  • amdm2/main
  • amdm2/develop
  • aptngearbox-not-auto
  • playground
  • official/main
  • official/develop
  • issue-templates
  • pdf-reports
  • HEV-timeruns-dev
  • timerun-empower-hybrids
  • timerun-pwheel-hybrids
  • Release/v5.0.3
  • Release/v5.0.1
  • Release/5.0.0-RC
  • Nuget/v0.11.4-DEV
  • Release/v0.11.4-DEV
  • Release/4.3.4-DEV
  • Release/4.3.3
  • Release/4.3.2-RC
  • Release/v4.3.0-DEV
  • Release/4.2.7
  • XMLConverterTool/4.2.6.0
  • Release/4.2.6-RC
  • Release/v4.2.5
  • Release/v4.2.3
  • Release/v4.2.2.3539-RC
  • Release/v4.2.1.3469
  • Release/v0.11.2.3456-DEV
  • Release/v4.2.0.3448-RC
  • Release/v4.1.3.3415
  • Release/v4.1.1.3413
41 results

HashingHelper.cs

Blame
  • Forked from VECTO / VECTO Sim
    7756 commits behind the upstream repository.
    Markus QUARITSCH's avatar
    Markus Quaritsch authored
    add certification number and digest values output and check to verify results view, splitting up into multiple files
    63f0d770
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    HashingHelper.cs 4.39 KiB
    using System;
    using System.Collections.ObjectModel;
    using System.Linq;
    using System.Xml;
    using HashingTool.ViewModel;
    using HashingTool.ViewModel.UserControl;
    using TUGraz.VectoCommon.Resources;
    using TUGraz.VectoHashing;
    
    namespace HashingTool.Helper
    {
    	public static class HashingHelper
    	{
    		public const string ToolTipInvalidFileType = "Invalid File type!";
    		public const string ToolTipXMLValidationFailed = "XML validation failed!";
    		public const string ToolTipOk = "Correct file selected";
    		public const string ToolTipHashInvalid = "Incorrect digest value!";
    		public const string ToolTipNone = "";
    		public static string ToolTipComponentHashInvalid = "Job-Data validation failed!";
    
    		public static bool? IsManufacturerReport(XmlDocument x, Collection<string> errorLog)
    		{
    			if (x == null || x.DocumentElement == null) {
    				return null;
    			}
    			var valid = x.DocumentElement.LocalName == XMLNames.VectoManufacturerReport;
    			if (!valid) {
    				errorLog.Add(String.Format("Invalid XML file given ({0}). Expected Manufacturer Report XML ({1})!",
    					x.DocumentElement.LocalName, XMLNames.VectoManufacturerReport));
    			}
    			return valid;
    		}
    
    		public static bool? IsCustomerReport(XmlDocument x, Collection<string> errorLog)
    		{
    			if (x == null || x.DocumentElement == null) {
    				return null;
    			}
    			var valid = x.DocumentElement != null && x.DocumentElement.LocalName == XMLNames.VectoCustomerReport;
    			if (!valid) {
    				errorLog.Add(String.Format("Invalid XML file given ({0}). Expected Customer Report XML ({1})!",
    					x.DocumentElement.LocalName, XMLNames.VectoCustomerReport));
    			}
    			return valid;
    		}
    
    		public static bool? IsJobFile(XmlDocument x, Collection<string> errorLog)
    		{
    			if (x == null || x.DocumentElement == null) {
    				return null;
    			}
    			var valid = x.DocumentElement.LocalName == XMLNames.VectoInputDeclaration &&
    						x.DocumentElement.FirstChild.LocalName == XMLNames.Component_Vehicle;
    			if (!valid) {
    				errorLog.Add(String.Format("Invalid XML file given ({0}/{1}). Expected Vehicle XML ({2}/{3})!",
    					x.DocumentElement.LocalName, x.DocumentElement.FirstChild.LocalName, XMLNames.VectoInputDeclaration,
    					XMLNames.Component_Vehicle));
    			}
    			return valid;
    		}
    
    		public static bool? IsComponentFile(XmlDocument x, Collection<string> errorLog)
    		{
    			if (x.DocumentElement == null) {
    				return null;
    			}
    
    			if (x.DocumentElement.LocalName != XMLNames.VectoInputDeclaration) {
    				errorLog.Add(String.Format("Invalid XML file given ({0}). Expected Component XML ({1})!",
    					x.DocumentElement.LocalName, XMLNames.VectoInputDeclaration));