internal StepType GetEventSearchResultsTest(out FindEventResultList target, out SoapException ex, out int Timeout, string SearchToken, int MinResults, bool MinResultsSpecified, int MaxResults, bool MaxResultsSpecified, string WaitTime) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; string tmpCommandName = "GetEventSearchResults"; int tmpCommandNumber = GetEventSearchResults; //Get step list for command XmlNodeList m_testList = TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[CommandCount[tmpCommandNumber]]; #region Analyze request //SearchToken CommonCompare.StringCompare("RequestParameters/SearchToken", "SearchToken", SearchToken, ref logMessage, ref passed, test); //MinResults if (CommonCompare.Exist2("RequestParameters/MinResults", "MinResults", MinResultsSpecified, ref logMessage, ref passed, test)) { CommonCompare.IntCompare("RequestParameters/MinResults", "MinResults", MinResults, ref logMessage, ref passed, test); } //MaxResults if (CommonCompare.Exist2("RequestParameters/MaxResults", "MaxResults", MaxResultsSpecified, ref logMessage, ref passed, test)) { CommonCompare.IntCompare("RequestParameters/MaxResults", "MaxResults", MaxResults, ref logMessage, ref passed, test); } //WaitTime CommonCompare.StringCompare("RequestParameters/WaitTime", "WaitTime", WaitTime, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(FindEventResultList)); target = (FindEventResultList)targetObj; //Log message TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
//*************************************************************************************** #region DoorControl internal StepType AccessDoorTest(out SoapException ex, out int Timeout, string Token, bool UseExtendedTime, bool UseExtendedTimeSpecified, string AccessTime, string OpenTooLongTime, string PreAlarmTime, AccessDoorExtension Extension) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; string tmpCommandName = "AccessDoor"; int tmpCommandNumber = AccessDoor; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[m_commandCount[tmpCommandNumber]]; #region Analyze request //Token CommonCompare.StringCompare("RequestParameters/Token", "Token", Token, ref logMessage, ref passed, test); //UseExtendedTime if (CommonCompare.Exist2("RequestParameters/UseExtendedTime", "UseExtendedTime", UseExtendedTimeSpecified, ref logMessage, ref passed, test)) { CommonCompare.StringCompare("RequestParameters/UseExtendedTime", "UseExtendedTime", UseExtendedTime.ToString(), ref logMessage, ref passed, test); } //AccessTime CommonCompare.StringCompare("RequestParameters/AccessTime", "AccessTime", AccessTime, ref logMessage, ref passed, test); //OpenTooLongTime CommonCompare.StringCompare("RequestParameters/OpenTooLongTime", "OpenTooLongTime", OpenTooLongTime, ref logMessage, ref passed, test); //PreAlarmTime CommonCompare.StringCompare("RequestParameters/PreAlarmTime", "PreAlarmTime", PreAlarmTime, ref logMessage, ref passed, test); //Extension //TODO #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
internal StepType GetDoorInfoListTest(out DoorInfo[] target, out SoapException ex, out int Timeout, string[] TokenList, int Limit, bool LimitSpecified, int Offset, bool OffsetSpecified) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; string tmpCommandName = "GetDoorInfoList"; int tmpCommandNumber = GetDoorInfoList; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[m_commandCount[tmpCommandNumber]]; #region Analyze request //TokenList CommonCompare.StringArrayCompare("RequestParameters/Token", "Token", TokenList, ref logMessage, ref passed, test); //Limit if (CommonCompare.Exist2("RequestParameters/Limit", "Limit", LimitSpecified, ref logMessage, ref passed, test)) { CommonCompare.IntCompare("RequestParameters/Limit", "Limit", Limit, ref logMessage, ref passed, test); } //Offset if (CommonCompare.Exist2("RequestParameters/Offset", "Offset", OffsetSpecified, ref logMessage, ref passed, test)) { CommonCompare.IntCompare("RequestParameters/Offset", "Offset", Offset, ref logMessage, ref passed, test); } #endregion //Analyze request //Generate response object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(DoorInfo[])); target = (DoorInfo[])targetObj; //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
//*************************************************************************************** #region Recordings internal StepType FindRecordingsTest(out string target, out SoapException ex, out int Timeout, SearchScope Scope, int MaxMatches, bool MaxMatchesSpecified, string KeepAliveTime) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; string tmpCommandName = "FindRecordings"; int tmpCommandNumber = FindRecordings; //Get step list for command XmlNodeList m_testList = TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[CommandCount[tmpCommandNumber]]; #region Analyze request //KeepAliveTime CommonCompare.StringCompare("RequestParameters/KeepAliveTime", "KeepAliveTime", KeepAliveTime, ref logMessage, ref passed, test); //MaxMatches if (CommonCompare.Exist2("RequestParameters/MaxMatches", "MaxMatches", MaxMatchesSpecified, ref logMessage, ref passed, test)) { CommonCompare.IntCompare("RequestParameters/MaxMatches", "MaxMatches", MaxMatches, ref logMessage, ref passed, test); } //RecordingInformationFilter CommonCompare.StringCompare("RequestParameters/RecordingInformationFilter", "RecordingInformationFilter", Scope.RecordingInformationFilter, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(string)); target = (string)targetObj; //Log message TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
internal StepType MoveTest(out SoapException ex, out int Timeout, string VideoSourceToken, FocusMove Focus) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("Imaging20.Move"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[Move]]; #region Analyze request //VideoSourceToken CommonCompare.StringCompare("RequestParameters/VideoSourceToken", "VideoSourceToken", VideoSourceToken, ref logMessage, ref passed, test); //Focus if (Focus != null) { //Absolute if (Focus.Absolute != null) { CommonCompare.Exist("RequestParameters/Focus/Absolute", "Focus.Absolute", Focus.Absolute, ref logMessage, ref passed, test); if (passed) { //Position CommonCompare.FloatCompare("RequestParameters/Focus/Absolute/Position", "Focus.Absolute.Position", Focus.Absolute.Position, ref logMessage, ref passed, test); //Speed if (Focus.Absolute.SpeedSpecified) { CommonCompare.Exist2("RequestParameters/Focus/Absolute/Speed", "Focus.Absolute.Speed", Focus.Absolute.SpeedSpecified, ref logMessage, ref passed, test); if (passed) { CommonCompare.FloatCompare("RequestParameters/Focus/Absolute/Speed", "Focus.Absolute.Speed", Focus.Absolute.Speed, ref logMessage, ref passed, test); } } else { CommonCompare.Exist2("RequestParameters/Focus/Absolute/Speed", "Focus.Absolute.Speed", Focus.Absolute.SpeedSpecified, ref logMessage, ref passed, test); } } } else { CommonCompare.Exist("RequestParameters/Focus/Absolute", "Focus.Absolute", Focus.Absolute, ref logMessage, ref passed, test); } //Relative if (Focus.Relative != null) { CommonCompare.Exist("RequestParameters/Focus/Relative", "Focus.Relative", Focus.Relative, ref logMessage, ref passed, test); if (passed) { //Distance CommonCompare.FloatCompare("RequestParameters/Focus/Relative/Distance", "Focus.Relative.Distance", Focus.Relative.Distance, ref logMessage, ref passed, test); //Speed if (Focus.Relative.SpeedSpecified) { CommonCompare.Exist2("RequestParameters/Focus/Relative/Speed", "Focus.Relative.Speed", Focus.Relative.SpeedSpecified, ref logMessage, ref passed, test); if (passed) { CommonCompare.FloatCompare("RequestParameters/Focus/Relative/Speed", "Focus.Relative.Speed", Focus.Relative.Speed, ref logMessage, ref passed, test); } } else { CommonCompare.Exist2("RequestParameters/Focus/Relative/Speed", "Focus.Relative.Speed", Focus.Relative.SpeedSpecified, ref logMessage, ref passed, test); } } } else { CommonCompare.Exist("RequestParameters/Focus/Relative", "Focus.Relative", Focus.Relative, ref logMessage, ref passed, test); } //Continuous if (Focus.Continuous != null) { CommonCompare.Exist("RequestParameters/Focus/Continuous", "Focus.Continuous", Focus.Continuous, ref logMessage, ref passed, test); if (passed) { //Speed CommonCompare.FloatCompare("RequestParameters/Focus/Continuous/Speed", "Focus.Continuous.Speed", Focus.Continuous.Speed, ref logMessage, ref passed, test); } } else { CommonCompare.Exist("RequestParameters/Focus/Continuous", "Focus.Continuous", Focus.Continuous, ref logMessage, ref passed, test); } } else { passed = false; logMessage = logMessage + "No required tag Focus."; } #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, Move); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
internal StepType SetImagingSettingsTest(out SoapException ex, out int Timeout, string VideoSourceToken, ImagingSettings20 ImagingSettings, bool ForcePersistence, bool ForcePersistenceSpecified) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("Imaging20.SetImagingSettings"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[SetImagingSettings]]; #region Analyze request //VideoSourceToken CommonCompare.StringCompare("RequestParameters/VideoSourceToken", "VideoSourceToken", VideoSourceToken, ref logMessage, ref passed, test); //ImagingSettings if (CommonCompare.Exist("RequestParameters/ImagingSettings", "ImagingSettings", ImagingSettings, ref logMessage, ref passed, test)) { //BacklightCompensation if (CommonCompare.Exist("RequestParameters/ImagingSettings/BacklightCompensation", "BacklightCompensation", ImagingSettings.BacklightCompensation, ref logMessage, ref passed, test)) { //Mode CommonCompare.StringCompare("RequestParameters/ImagingSettings/BacklightCompensation/Mode", "Mode", ImagingSettings.BacklightCompensation.Mode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.BacklightCompensation.Mode == BacklightCompensationMode.ON) { //Level CommonCompare.FloatCompare("RequestParameters/ImagingSettings/BacklightCompensation/Level", "Level", ImagingSettings.BacklightCompensation.Level, ref logMessage, ref passed, test); } } //Brightness if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Brightness", "Brightness", ImagingSettings.BrightnessSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Brightness", "Brightness", ImagingSettings.Brightness, ref logMessage, ref passed, test); } //ColorSaturation if (CommonCompare.Exist2("RequestParameters/ImagingSettings/ColorSaturation", "ColorSaturation", ImagingSettings.ColorSaturationSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/ColorSaturation", "ColorSaturation", ImagingSettings.ColorSaturation, ref logMessage, ref passed, test); } //Contrast if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Contrast", "Contrast", ImagingSettings.ContrastSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Contrast", "Contrast", ImagingSettings.Contrast, ref logMessage, ref passed, test); } //Exposure if (CommonCompare.Exist("RequestParameters/ImagingSettings/Exposure", "Exposure", ImagingSettings.Exposure, ref logMessage, ref passed, test)) { //Mode CommonCompare.StringCompare("RequestParameters/ImagingSettings/Exposure/Mode", "Mode", ImagingSettings.Exposure.Mode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.Exposure.Mode == ExposureMode.AUTO) { //Priority if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/Priority", "Priority", ImagingSettings.Exposure.PrioritySpecified, ref logMessage, ref passed, test)) { CommonCompare.StringCompare("RequestParameters/ImagingSettings/Exposure/Priority", "Priority", ImagingSettings.Exposure.Priority.ToString(), ref logMessage, ref passed, test); } //MinExposureTime if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MinExposureTime", "MinExposureTime", ImagingSettings.Exposure.MinExposureTimeSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MinExposureTime", "MinExposureTime", ImagingSettings.Exposure.MinExposureTime, ref logMessage, ref passed, test); } //MaxExposureTime if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MaxExposureTime", "MaxExposureTime", ImagingSettings.Exposure.MaxExposureTimeSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MaxExposureTime", "MaxExposureTime", ImagingSettings.Exposure.MaxExposureTime, ref logMessage, ref passed, test); } //MinGain if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MinGain", "MinGain", ImagingSettings.Exposure.MinGainSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MinGain", "MinGain", ImagingSettings.Exposure.MinGain, ref logMessage, ref passed, test); } //MaxGain if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MaxGain", "MaxGain", ImagingSettings.Exposure.MaxGainSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MaxGain", "MaxGain", ImagingSettings.Exposure.MaxGain, ref logMessage, ref passed, test); } //MinIris if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MinIris", "MinIris", ImagingSettings.Exposure.MinIrisSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MinIris", "MinIris", ImagingSettings.Exposure.MinIris, ref logMessage, ref passed, test); } //MaxIris if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MaxIris", "MaxIris", ImagingSettings.Exposure.MaxIrisSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MaxIris", "MaxIris", ImagingSettings.Exposure.MaxIris, ref logMessage, ref passed, test); } } else if (ImagingSettings.Exposure.Mode == ExposureMode.MANUAL) { //ExposureTime if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/ExposureTime", "ExposureTime", ImagingSettings.Exposure.ExposureTimeSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/ExposureTime", "ExposureTime", ImagingSettings.Exposure.ExposureTime, ref logMessage, ref passed, test); } //Gain if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/Gain", "Gain", ImagingSettings.Exposure.GainSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/Gain", "Gain", ImagingSettings.Exposure.Gain, ref logMessage, ref passed, test); } //Iris if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/Iris", "Iris", ImagingSettings.Exposure.IrisSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/Iris", "Iris", ImagingSettings.Exposure.Iris, ref logMessage, ref passed, test); } } } //Focus if (CommonCompare.Exist("RequestParameters/ImagingSettings/Focus", "Focus", ImagingSettings.Focus, ref logMessage, ref passed, test)) { //AutoFocusMode CommonCompare.StringCompare("RequestParameters/ImagingSettings/Focus/AutoFocusMode", "AutoFocusMode", ImagingSettings.Focus.AutoFocusMode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.Focus.AutoFocusMode == AutoFocusMode.MANUAL) { //DefaultSpeed CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Focus/DefaultSpeed", "DefaultSpeed", ImagingSettings.Focus.DefaultSpeed, ref logMessage, ref passed, test); } else if (ImagingSettings.Focus.AutoFocusMode == AutoFocusMode.AUTO) { //NearLimit CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Focus/NearLimit", "NearLimit", ImagingSettings.Focus.NearLimit, ref logMessage, ref passed, test); //FarLimit CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Focus/FarLimit", "FarLimit", ImagingSettings.Focus.FarLimit, ref logMessage, ref passed, test); } } //IrCutFilter if (CommonCompare.Exist2("RequestParameters/ImagingSettings/IrCutFilter", "IrCutFilter", ImagingSettings.IrCutFilterSpecified, ref logMessage, ref passed, test)) { CommonCompare.StringCompare("RequestParameters/ImagingSettings/IrCutFilter", "IrCutFilter", ImagingSettings.IrCutFilter.ToString(), ref logMessage, ref passed, test); } //Sharpness if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Sharpness", "Sharpness", ImagingSettings.SharpnessSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Sharpness", "Sharpness", ImagingSettings.Sharpness, ref logMessage, ref passed, test); } //WideDynamicRange if (CommonCompare.Exist("RequestParameters/ImagingSettings/WideDynamicRange", "WideDynamicRange", ImagingSettings.WideDynamicRange, ref logMessage, ref passed, test)) { //Mode CommonCompare.StringCompare("RequestParameters/ImagingSettings/WideDynamicRange/Mode", "Mode", ImagingSettings.WideDynamicRange.Mode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.WideDynamicRange.Mode == WideDynamicMode.ON) { //Level CommonCompare.FloatCompare("RequestParameters/ImagingSettings/WideDynamicRange/Level", "Level", ImagingSettings.WideDynamicRange.Level, ref logMessage, ref passed, test); } } //WhiteBalance if (CommonCompare.Exist("RequestParameters/ImagingSettings/WhiteBalance", "WhiteBalance", ImagingSettings.WhiteBalance, ref logMessage, ref passed, test)) { //Mode CommonCompare.StringCompare("RequestParameters/ImagingSettings/WhiteBalance/Mode", "Mode", ImagingSettings.WhiteBalance.Mode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.WhiteBalance.Mode == WhiteBalanceMode.MANUAL) { //CrGain CommonCompare.FloatCompare("RequestParameters/ImagingSettings/WhiteBalance/CrGain", "CrGain", ImagingSettings.WhiteBalance.CrGain, ref logMessage, ref passed, test); //CbGain CommonCompare.FloatCompare("RequestParameters/ImagingSettings/WhiteBalance/CbGain", "CbGain", ImagingSettings.WhiteBalance.CbGain, ref logMessage, ref passed, test); } } } //ForcePersistence CommonCompare.Exist2("RequestParameters/ForcePersistence", "ForcePersistence", ForcePersistenceSpecified, ref logMessage, ref passed, test); if (passed) { CommonCompare.StringCompare("RequestParameters/ForcePersistence", "ForcePersistence", ForcePersistence.ToString(), ref logMessage, ref passed, test); } #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, SetImagingSettings); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
void ValidateParameters(Common.ParametersValidation validationRequest, ref string logMessage, ref bool passed, XmlNode test) { foreach (Common.ValidationRule rule in validationRequest.ValidationRules) { string parameterPath = string.Format("RequestParameters/{0}", rule.ParameterPath); switch (rule.Type) { case ParameterType.String: CommonCompare.StringCompare(parameterPath, rule.ParameterName, (string)rule.Value, ref logMessage, ref passed, test); break; case ParameterType.Int: CommonCompare.IntCompare(parameterPath, rule.ParameterName, (int)rule.Value, ref logMessage, ref passed, test); break; case ParameterType.OptionalInt: int?value = (int?)rule.Value; if (CommonCompare.Exist2(parameterPath, rule.ParameterName, value.HasValue, ref logMessage, ref passed, test)) { CommonCompare.IntCompare(parameterPath, rule.ParameterName, value.Value, ref logMessage, ref passed, test); } break; case ParameterType.OptionalBool: if (rule.ValueSpecified) { CommonCompare.StringCompare(parameterPath, rule.ParameterName, ((bool)rule.Value).ToString(), ref logMessage, ref passed, test); } else { CommonCompare.Exist2(parameterPath, rule.ParameterName, rule.ValueSpecified, ref logMessage, ref passed, test); } break; case ParameterType.OptionalString: { string stringValue = (string)rule.Value; if (CommonCompare.Exist2(parameterPath, rule.ParameterName, stringValue != null, ref logMessage, ref passed, test)) { CommonCompare.StringCompare(parameterPath, rule.ParameterName, (string)rule.Value, ref logMessage, ref passed, test); } } break; case ParameterType.OptionalElement: { CommonCompare.Exist2(parameterPath, rule.ParameterName, rule.Value != null, ref logMessage, ref passed, test); } break; case ParameterType.OptionalElementBoolFlag: { CommonCompare.Exist2(parameterPath, rule.ParameterName, (bool)rule.Value, ref logMessage, ref passed, test); } break; case ParameterType.StringArray: { CommonCompare.StringArrayCompare(parameterPath, rule.ParameterName, (string[])rule.Value, ref logMessage, ref passed, test); } break; case ParameterType.Log: { if (rule.Value.GetType().ToString() == "System.Byte[]") { logMessage = logMessage + rule.ParameterName + " = [Check it manually!]"; } else { logMessage = logMessage + rule.ParameterName + " = " + rule.Value.ToString(); } } break; case ParameterType.OptionalQName: { XmlQualifiedName QNameValue = (XmlQualifiedName)rule.Value; if (CommonCompare.Exist2(parameterPath, rule.ParameterName, QNameValue != null, ref logMessage, ref passed, test)) { CommonCompare.StringCompare(parameterPath + "/Namespace", rule.ParameterName + "/Namespace", QNameValue.Namespace, ref logMessage, ref passed, test); CommonCompare.StringCompare(parameterPath + "/Name", rule.ParameterName + "/Name", QNameValue.Name, ref logMessage, ref passed, test); } } break; case ParameterType.X509Cert: { Org.BouncyCastle.X509.X509Certificate cert = (new Org.BouncyCastle.X509.X509CertificateParser()).ReadCertificate((byte[])rule.Value); logMessage = logMessage + "\r\n"; logMessage = logMessage + rule.ParameterName + ": " + "\r\n" + cert.ToString(); logMessage = logMessage + "\r\n"; //TextWriter textWriter = new StringWriter(); //Org.BouncyCastle.Utilities.IO.Pem.PemWriter pemWriter = new Org.BouncyCastle.Utilities.IO.Pem.PemWriter(textWriter); //pemWriter.WriteObject(cert.CertificateStructure.SubjectPublicKeyInfo.PublicKeyData); //pemWriter.Writer.Flush(); //string privateKey = textWriter.ToString(); logMessage = logMessage + rule.ParameterName + "(PubK): " + "\r\n" + cert.CertificateStructure.SubjectPublicKeyInfo.PublicKeyData.ToString(); logMessage = logMessage + "\r\n"; logMessage = logMessage + rule.ParameterName + "(SignatureAlgorithm): " + "\r\n" + cert.CertificateStructure.SignatureAlgorithm.ObjectID.ToString(); logMessage = logMessage + "\r\n"; } break; case ParameterType.PKCS10: { Org.BouncyCastle.Pkcs.Pkcs10CertificationRequest pkcs10 = new Org.BouncyCastle.Pkcs.Pkcs10CertificationRequest((byte[])rule.Value); logMessage = logMessage + "\r\n"; logMessage = logMessage + rule.ParameterName + ": " + "\r\n" + pkcs10.ToString(); logMessage = logMessage + "\r\n"; } break; case ParameterType.PKCS12WithoutPassphrase: { Org.BouncyCastle.Pkcs.Pkcs12Store pkcs12Store = new Org.BouncyCastle.Pkcs.Pkcs12Store(); pkcs12Store.Load(new MemoryStream((byte[])rule.Value), ("").ToArray()); logMessage = logMessage + rule.ParameterName + ": " + "\r\n"; foreach (string alias in pkcs12Store.Aliases) { logMessage = logMessage + "\r\n"; logMessage = logMessage + "Alias = " + alias + "\r\n"; logMessage = logMessage + "Certificate = " + pkcs12Store.GetCertificate(alias).Certificate.ToString(); } logMessage = logMessage + "\r\n"; } break; case ParameterType.CRL: { Org.BouncyCastle.X509.X509Crl crl = (new Org.BouncyCastle.X509.X509CrlParser()).ReadCrl((byte[])rule.Value); logMessage = logMessage + "\r\n"; logMessage = logMessage + rule.ParameterName + ": " + "\r\n" + crl.ToString(); logMessage = logMessage + "\r\n"; } break; case ParameterType.Float: { CommonCompare.FloatCompare(parameterPath, rule.ParameterName, (float)rule.Value, ref logMessage, ref passed, test); } break; case ParameterType.OptionalFloat: float?fvalue = (float?)rule.Value; if (CommonCompare.Exist2(parameterPath, rule.ParameterName, fvalue.HasValue, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare(parameterPath, rule.ParameterName, (float)rule.Value, ref logMessage, ref passed, test); } break; } } }