internal override void ValidateJson(ModuleJson module)
        {
            base.ValidateJson(module);
            // Offset must always be specified
            Validation.ValidateNotNull(Offset, nameof(Offset));
            if (Repeat is object)
            {
                Validation.ValidateNotNull(Repeat.Gap, $"{nameof(Repeat)}.{nameof(Repeat.Gap)}");
            }
            string containerName = Container ?? Name ?? throw new InvalidOperationException($"Either {nameof(Container)} or {nameof(Name)} must be specified");

            Validation.Validate(module.Containers.TryGetValue(containerName, out resolvedContainer),
                                "Container '{0}' not found.", containerName);
        }
Esempio n. 2
0
        internal void Validate()
        {
            ValidateNotNull(Identifier, nameof(Identifier));
            ValidateNotNull(LogicalTree, nameof(LogicalTree));
            ValidateNotNull(Counts, nameof(Counts));
            ValidateNotNull(Lookups, nameof(Lookups));
            ValidateNotNull(Containers, nameof(Containers));
            Validation.Validate(Containers.TryGetValue("Root", out _), "No root container present");

            foreach (var pair in Containers)
            {
                pair.Value.NameInModuleDictionary = pair.Key;
                pair.Value.ValidateAndResolve(this);
            }
        }
Esempio n. 3
0
        internal void ValidateAndResolve(ModuleJson module)
        {
            Validation.Validate(Fields is object ^ Containers is object,
                                "Each container must either specify fields or containers as children, but not both.");

            if (Fields is object)
            {
                Validation.Validate(Size is object, "Field containers must specify a size.");
                Fields.ForEach(f => f.ValidateJson(module));
                resolvedFields            = ResolveFields(module);
                requiresOverlayResolution = resolvedFields.Any(f => f is OverlayField overlay && overlay.SwitchPath.Contains('{'));
            }
            else
            {
                Containers?.ForEach(f => f.ValidateJson(module));
            }
        }