예제 #1
0
        public RegistrationRequest(Guid previewToolId, string previewToolName, string previewToolDescription, string autoStartupCommand, string previewPartIdRegex, bool requiresWebPreviewBaseUrl, ContentComplexityLevel contentComplexity, string[] requiredProperties)
        {
            if (previewToolId == Guid.Empty)
            {
                throw new ArgumentException("The id of the preview tool cannot be empty guid.", nameof(previewToolId));
            }

            if (string.IsNullOrWhiteSpace(previewToolName))
            {
                throw new ArgumentException("The name of the preview tool cannot be empty.", nameof(previewToolName));
            }

            if (string.IsNullOrWhiteSpace(previewPartIdRegex))
            {
                throw new ArgumentException("The preview part id regex cannot be empty.", nameof(previewPartIdRegex));
            }
            else
            {
                try
                {
                    var regex = new Regex(previewPartIdRegex);
                }
                catch
                {
                    throw new ArgumentException("The preview part id regex is invalid.", nameof(previewPartIdRegex));
                }
            }

            if (requiredProperties == null)
            {
                throw new ArgumentNullException(nameof(requiredProperties));
            }
            else
            {
                foreach (var requiredProperty in requiredProperties)
                {
                    if (!PropertyNames.SupportedProperties.Contains(requiredProperty))
                    {
                        throw new ArgumentException($"The property {requiredProperty} is not supported.");
                    }
                }
            }

            PreviewToolId             = previewToolId;
            PreviewToolName           = previewToolName;
            PreviewToolDescription    = previewToolDescription;
            AutoStartupCommand        = autoStartupCommand;
            PreviewPartIdRegex        = previewPartIdRegex;
            RequiresWebPreviewBaseUrl = requiresWebPreviewBaseUrl;
            ContentComplexity         = contentComplexity;
            RequiredProperties        = requiredProperties;
        }
예제 #2
0
 public ChangeRuntimeSettingsRequest(ContentComplexityLevel contentComplexity, string[] requiredProperties)
 {
     ContentComplexity  = contentComplexity;
     RequiredProperties = requiredProperties;
 }
예제 #3
0
 public PreviewContent(ContentComplexityLevel complexity, string content)
 {
     Complexity = complexity;
     Content    = content;
 }