Exemple #1
0
        public DestroyAction(ICustomActionContext access, XmlReader xmlReader)
        {
            if (access is null)
            {
                throw new ArgumentNullException(nameof(access));
            }
            if (xmlReader is null)
            {
                throw new ArgumentNullException(nameof(xmlReader));
            }

            var sessionIdExpression = xmlReader.GetAttribute(SessionIdExpr);

            _sessionId = xmlReader.GetAttribute(SessionId);

            if (_sessionId is { Length : 0 })
Exemple #2
0
        public StartAction(ICustomActionContext access, XmlReader xmlReader)
        {
            if (access is null)
            {
                throw new ArgumentNullException(nameof(access));
            }
            if (xmlReader is null)
            {
                throw new ArgumentNullException(nameof(xmlReader));
            }

            var url                 = xmlReader.GetAttribute(Url);
            var urlExpression       = xmlReader.GetAttribute(UrlExpr);
            var trusted             = xmlReader.GetAttribute(Trusted);
            var sessionIdExpression = xmlReader.GetAttribute(SessionIdExpr);
            var sessionIdLocation   = xmlReader.GetAttribute(SessionIdLocation);

            _sessionId = xmlReader.GetAttribute(SessionId);
            _trusted   = trusted is not null && XmlConvert.ToBoolean(trusted);

            if (url is null && urlExpression is null)
            {
                access.AddValidationError <StartAction>(Resources.ErrorMessage_AtLeastOneUrlMustBeSpecified);
            }

            if (url is not null && urlExpression is not null)
            {
                access.AddValidationError <StartAction>(Resources.ErrorMessage_UrlAndUrlExprAttributesShouldNotBeAssignedInStartElement);
            }

            if (url is not null && !Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out _url))
            {
                access.AddValidationError <StartAction>(Resources.ErrorMessage_UrlHasInvalidURIFormat);
            }

            if (_sessionId is { Length : 0 })