Esempio n. 1
0
 public ModuleIdentifier ToModuleIdentifier()
 {
     Validation.ValidateNotNull(Name, nameof(Name));
     Validation.ValidateNotNull(ModelId, nameof(ModelId));
     Validation.ValidateNotNull(FamilyCode, nameof(FamilyCode));
     Validation.ValidateNotNull(FamilyNumberCode, nameof(FamilyNumberCode));
     return(new ModuleIdentifier(Name, ModelId.Value, FamilyCode.Value, FamilyNumberCode.Value));
 }
        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. 3
0
 internal virtual void ValidateJson(ModuleJson module)
 {
     ResolvedName        = Validation.ValidateNotNull(Name ?? ToPascalCase(Description), "Name or Description");
     ResolvedDescription = Description ?? Name;
 }