private bool ListContainsNodeWithEntity(List <ModuleItemNode> nodes, Entity entity)
        {
            bool flag;

            using (List <ModuleItemNode> .Enumerator enumerator = nodes.GetEnumerator())
            {
                while (true)
                {
                    if (enumerator.MoveNext())
                    {
                        ModuleItemNode current = enumerator.Current;
                        if (!current.Entity.Equals(entity))
                        {
                            continue;
                        }
                        flag = true;
                    }
                    else
                    {
                        return(false);
                    }
                    break;
                }
            }
            return(flag);
        }
Exemple #2
0
 private void ConvertItem(int index, ModuleItemNode node)
 => ConvertItem(null, index, node, new[] {
     "Condition",
     "Function",
     "Group",
     "Import",
     "Macro",
     "Mapping",
     "Nested",
     "Package",
     "Parameter",
     "Resource",
     "ResourceType",
     "Variable"
 });
        public void GetItemStat(GetItemStatEvent e, ModuleItemNode module, [JoinAll] SingleNode <SelectedPresetComponent> selectedPreset, [JoinByUser] MountedHullNode mountedHull, [JoinByUser] MountedWeaponNode mountedWeapon, [JoinByUser] ICollection <MountedModuleItemNode> mountedModules, [JoinByModule] Optional <ModuleItemNode> mountedToSelectedSlotModule, [JoinAll] ICollection <SlotNode> slots, [JoinAll] ModuleUpgradeConfigNode moduleUpgradeConfig, [JoinAll] ScreenNode screen)
        {
            List <ModuleItemNode> tankModules               = new List <ModuleItemNode>();
            List <ModuleItemNode> weaponModules             = new List <ModuleItemNode>();
            List <ModuleItemNode> tankModulesWithSelected   = new List <ModuleItemNode>();
            List <ModuleItemNode> weaponModulesWithSelected = new List <ModuleItemNode>();

            this.FilterModules(mountedModules, module, !mountedToSelectedSlotModule.IsPresent() ? null : mountedToSelectedSlotModule.Get(), tankModules, weaponModules, tankModulesWithSelected, weaponModulesWithSelected);
            int          slotsCount = this.GetSlotsCount(slots, TankPartModuleType.TANK);
            int          slotCount  = this.GetSlotsCount(slots, TankPartModuleType.WEAPON);
            UpgradeCoefs coefs2     = new UpgradeCoefs {
                tankCoeffWithSelected   = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionary(tankModulesWithSelected), slotsCount, moduleUpgradeConfig.moduleUpgradablePowerConfig),
                weaponCoeffWithSelected = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionary(weaponModulesWithSelected), slotCount, moduleUpgradeConfig.moduleUpgradablePowerConfig)
            };
            UpgradeCoefs coefs = coefs2;

            coefs2 = new UpgradeCoefs {
                tankCoeffWithSelected   = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionaryForNextLevelModule(tankModulesWithSelected, module), slotsCount, moduleUpgradeConfig.moduleUpgradablePowerConfig),
                weaponCoeffWithSelected = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionaryForNextLevelModule(weaponModulesWithSelected, module), slotCount, moduleUpgradeConfig.moduleUpgradablePowerConfig)
            };
            UpgradeCoefs   coefs3   = coefs2;
            float          coef     = (module.moduleTankPart.TankPart != TankPartModuleType.TANK) ? coefs.weaponCoeffWithSelected : coefs.tankCoeffWithSelected;
            float          num4     = (module.moduleTankPart.TankPart != TankPartModuleType.TANK) ? coefs3.weaponCoeffWithSelected : coefs3.tankCoeffWithSelected;
            long           marketId = (module.moduleTankPart.TankPart != TankPartModuleType.TANK) ? mountedWeapon.marketItemGroup.Key : mountedHull.marketItemGroup.Key;
            VisualProperty property = GarageItemsRegistry.GetItem <TankPartItem>(marketId).Properties[0];
            ModuleUpgradeCharacteristic characteristic = new ModuleUpgradeCharacteristic {
                Min        = property.GetValue(0f) - (property.GetValue(0f) / 10f),
                Max        = property.GetValue(1f),
                Current    = property.GetValue(coef),
                Next       = property.GetValue(num4),
                CurrentStr = property.GetFormatedValue(coef),
                NextStr    = property.GetFormatedValue(num4),
                Unit       = property.Unit,
                Name       = (module.moduleTankPart.TankPart != TankPartModuleType.TANK) ? screen.newModulesScreenUi.TurretDamage : screen.newModulesScreenUi.HullHealth
            };

            e.moduleUpgradeCharacteristic = characteristic;
        }
Exemple #4
0
        private void ConvertItem(AModuleItem parent, int index, ModuleItemNode node, IEnumerable <string> expectedTypes)
        {
            var type = DeterminNodeType("item", index, node, ModuleItemNode.FieldCombinations, expectedTypes);

            switch (type)
            {
            case "Parameter":
                AtLocation(node.Parameter, () => {
                    // validation
                    if (node.Properties != null)
                    {
                        Validate(node.Type != null, "'Type' attribute is required");
                    }
                    Validate((node.Allow == null) || (node.Type == "AWS") || ResourceMapping.IsCloudFormationType(node.Type), "'Allow' attribute can only be used with AWS resource types");
                    Validate(parent == null, "'Parameter' cannot be nested");

                    // create input parameter item
                    _builder.AddParameter(
                        name: node.Parameter,
                        section: node.Section,
                        label: node.Label,
                        description: node.Description,
                        type: node.Type ?? "String",
                        scope: ConvertScope(node.Scope),
                        noEcho: node.NoEcho,
                        defaultValue: node.Default,
                        constraintDescription: node.ConstraintDescription,
                        allowedPattern: node.AllowedPattern,
                        allowedValues: node.AllowedValues,
                        maxLength: node.MaxLength,
                        maxValue: node.MaxValue,
                        minLength: node.MinLength,
                        minValue: node.MinValue,
                        allow: node.Allow,
                        properties: ParseToDictionary("Properties", node.Properties),
                        arnAttribute: node.DefaultAttribute,
                        encryptionContext: node.EncryptionContext,
                        pragmas: node.Pragmas
                        );
                });
                break;

            case "Import":
                AtLocation(node.Import, () => {
                    // validation
                    Validate((node.Allow == null) || (node.Type == "AWS") || ResourceMapping.IsCloudFormationType(node.Type), "'Allow' attribute can only be used with AWS resource types");
                    Validate(node.Module != null, "missing 'Module' attribute");

                    // create input parameter item
                    _builder.AddImport(
                        parent: parent,
                        name: node.Import,
                        description: node.Description,
                        type: node.Type ?? "String",
                        scope: ConvertScope(node.Scope),
                        allow: node.Allow,
                        module: node.Module ?? "Bad.Module",
                        encryptionContext: node.EncryptionContext
                        );
                });
                break;

            case "Variable":
                AtLocation(node.Variable, () => {
                    // validation
                    Validate(node.Value != null, "missing 'Value' attribute");
                    Validate((node.EncryptionContext == null) || (node.Type == "Secret"), "item must have Type 'Secret' to use 'EncryptionContext' section");
                    Validate((node.Type != "Secret") || !(node.Value is IList <object>), "item with type 'Secret' cannot have a list of values");

                    // create variable item
                    _builder.AddVariable(
                        parent: parent,
                        name: node.Variable,
                        description: node.Description,
                        type: node.Type ?? "String",
                        scope: ConvertScope(node.Scope),
                        value: node.Value ?? "",
                        allow: null,
                        encryptionContext: node.EncryptionContext
                        );
                });
                break;

            case "Group":
                AtLocation(node.Group, () => {
                    // create namespace item
                    var result = _builder.AddVariable(
                        parent: parent,
                        name: node.Group,
                        description: node.Description,
                        type: "String",
                        scope: null,
                        value: "",
                        allow: null,
                        encryptionContext: null
                        );

                    // recurse
                    ConvertItems(result, expectedTypes);
                });
                break;

            case "Resource":
                AtLocation(node.Resource, () => {
                    if (node.Value != null)
                    {
                        // validation
                        Validate((node.Allow == null) || (node.Type == null) || ResourceMapping.IsCloudFormationType(node.Type), "'Allow' attribute can only be used with AWS resource types");
                        Validate(node.If == null, "'If' attribute cannot be used with a referenced resource");
                        Validate(node.Properties == null, "'Properties' section cannot be used with a referenced resource");
                        if (node.Value is IList <object> values)
                        {
                            foreach (var arn in values)
                            {
                                ValidateARN(arn);
                            }
                        }
                        else
                        {
                            ValidateARN(node.Value);
                        }

                        // create variable item
                        _builder.AddVariable(
                            parent: parent,
                            name: node.Resource,
                            description: node.Description,
                            type: node.Type ?? "String",
                            scope: ConvertScope(node.Scope),
                            value: node.Value,
                            allow: node.Allow,
                            encryptionContext: node.EncryptionContext
                            );
                    }
                    else
                    {
                        // validation
                        Validate(node.Type != null, "missing 'Type' attribute");
                        Validate((node.Allow == null) || ResourceMapping.IsCloudFormationType(node.Type ?? ""), "'Allow' attribute can only be used with AWS resource types");

                        // create resource item
                        _builder.AddResource(
                            parent: parent,
                            name: node.Resource,
                            description: node.Description,
                            type: node.Type ?? "AWS",
                            scope: ConvertScope(node.Scope),
                            allow: node.Allow,
                            properties: ParseToDictionary("Properties", node.Properties),
                            dependsOn: ConvertToStringList(node.DependsOn),
                            arnAttribute: node.DefaultAttribute,
                            condition: node.If,
                            pragmas: node.Pragmas
                            );
                    }
                });
                break;

            case "Nested":
                AtLocation(node.Nested, () => {
                    // validation
                    if (node.Module == null)
                    {
                        LogError("missing 'Module' attribute");
                    }
                    else if (!ModuleInfo.TryParse(node.Module, out var moduleInfo))
                    {
                        LogError("invalid value for 'Module' attribute");
                    }
                    else
                    {
                        // create nested module item
                        _builder.AddNestedModule(
                            parent: parent,
                            name: node.Nested,
                            description: node.Description,
                            moduleInfo: moduleInfo,
                            scope: ConvertScope(node.Scope),
                            dependsOn: node.DependsOn,
                            parameters: node.Parameters
                            );
                    }
                });
                break;

            case "Package":

                // package resource
                AtLocation(node.Package, () => {
                    // discover files to package
                    var files = new List <KeyValuePair <string, string> >();
                    if (node.Files != null)
                    {
                        string folder;
                        string filePattern;
                        SearchOption searchOption;
                        var packageFiles = Path.Combine(Settings.WorkingDirectory, node.Files);
                        if ((packageFiles.EndsWith("/", StringComparison.Ordinal) || Directory.Exists(packageFiles)))
                        {
                            folder       = Path.GetFullPath(packageFiles);
                            filePattern  = "*";
                            searchOption = SearchOption.AllDirectories;
                        }
                        else
                        {
                            folder       = Path.GetDirectoryName(packageFiles);
                            filePattern  = Path.GetFileName(packageFiles);
                            searchOption = SearchOption.TopDirectoryOnly;
                        }
                        if (Directory.Exists(folder))
                        {
                            foreach (var filePath in Directory.GetFiles(folder, filePattern, searchOption))
                            {
                                var relativeFilePathName = Path.GetRelativePath(folder, filePath);
                                files.Add(new KeyValuePair <string, string>(relativeFilePathName, filePath));
                            }
                            files = files.OrderBy(file => file.Key).ToList();
                        }
                        else
                        {
                            LogError($"cannot find folder '{Path.GetRelativePath(Settings.WorkingDirectory, folder)}'");
                        }
                    }
                    else
                    {
                        LogError("missing 'Files' attribute");
                    }

                    // create package resource item
                    _builder.AddPackage(
                        parent: parent,
                        name: node.Package,
                        description: node.Description,
                        scope: ConvertScope(node.Scope),
                        files: files
                        );
                });
                break;

            case "Function":
                AtLocation(node.Function, () => {
                    // validation
                    Validate(node.Memory != null, "missing 'Memory' attribute");
                    Validate(int.TryParse(node.Memory, out _), "invalid 'Memory' value");
                    Validate(node.Timeout != null, "missing 'Timeout' attribute");
                    Validate(int.TryParse(node.Timeout, out _), "invalid 'Timeout' value");
                    ValidateFunctionSource(node.Sources ?? new FunctionSourceNode[0]);

                    // determine function type
                    var project  = node.Project;
                    var language = node.Language;
                    var runtime  = node.Runtime;
                    var handler  = node.Handler;
                    DetermineFunctionType(node.Function, ref project, ref language, ref runtime, ref handler);

                    // create function item
                    var sources = AtLocation("Sources", () => node.Sources
                                             ?.Select((source, eventIndex) => ConvertFunctionSource(node, eventIndex, source))
                                             .Where(evt => evt != null)
                                             .ToList()
                                             );
                    _builder.AddFunction(
                        parent: parent,
                        name: node.Function,
                        description: node.Description,
                        scope: ConvertScope(node.Scope),
                        project: project,
                        language: language,
                        environment: node.Environment,
                        sources: sources,
                        condition: node.If,
                        pragmas: node.Pragmas,
                        timeout: node.Timeout,
                        runtime: runtime,
                        memory: node.Memory,
                        handler: handler,
                        properties: ParseToDictionary("Properties", node.Properties)
                        );
                });
                break;

            case "Condition":
                AtLocation(node.Condition, () => {
                    AtLocation("Value", () => {
                        Validate(node.Value != null, "missing 'Value' attribute");
                    });
                    _builder.AddCondition(
                        parent: parent,
                        name: node.Condition,
                        description: node.Description,
                        value: node.Value
                        );
                });
                break;

            case "Mapping":
                AtLocation(node.Mapping, () => {
                    IDictionary <string, IDictionary <string, string> > topLevelResults = new Dictionary <string, IDictionary <string, string> >();
                    if (node.Value is IDictionary topLevelDictionary)
                    {
                        AtLocation("Value", () => {
                            Validate(topLevelDictionary.Count > 0, "missing top-level mappings");

                            // iterate over top-level dictionary
                            foreach (DictionaryEntry topLevel in topLevelDictionary)
                            {
                                AtLocation((string)topLevel.Key, () => {
                                    var secondLevelResults = new Dictionary <string, string>();
                                    topLevelResults[(string)topLevel.Key] = secondLevelResults;

                                    // convert top-level entry
                                    if (topLevel.Value is IDictionary secondLevelDictionary)
                                    {
                                        Validate(secondLevelDictionary.Count > 0, "missing second-level mappings");

                                        // iterate over second-level dictionary
                                        foreach (DictionaryEntry secondLevel in secondLevelDictionary)
                                        {
                                            AtLocation((string)secondLevel.Key, () => {
                                                // convert second-level entry
                                                if (secondLevel.Value is string secondLevelValue)
                                                {
                                                    secondLevelResults[(string)secondLevel.Key] = secondLevelValue;
                                                }
                                                else
                                                {
                                                    LogError("invalid value");
                                                }
                                            });
                                        }
                                    }
Exemple #5
0
        private AFunctionSource ConvertFunctionSource(ModuleItemNode function, int index, FunctionSourceNode source)
        {
            var type = DeterminNodeType("source", index, source, FunctionSourceNode.FieldCombinations, new[] {
                "Api",
                "Schedule",
                "S3",
                "SlackCommand",
                "Topic",
                "Sqs",
                "Alexa",
                "DynamoDB",
                "Kinesis",
                "WebSocket"
            });

            switch (type)
            {
            case "Api":
                return(AtLocation("Api", () => {
                    // extract http method from route
                    var api = source.Api.Trim();
                    var pathSeparatorIndex = api.IndexOfAny(new[] { ':', ' ' });
                    if (pathSeparatorIndex < 0)
                    {
                        LogError("invalid api format");
                        return new RestApiSource {
                            HttpMethod = "ANY",
                            Path = new string[0],
                            Integration = ApiGatewaySourceIntegration.RequestResponse
                        };
                    }
                    var method = api.Substring(0, pathSeparatorIndex).ToUpperInvariant();
                    if (method == "*")
                    {
                        method = "ANY";
                    }
                    var path = api.Substring(pathSeparatorIndex + 1).TrimStart().Split('/', StringSplitOptions.RemoveEmptyEntries);

                    // parse integration into a valid enum
                    var integration = AtLocation("Integration", () => Enum.Parse <ApiGatewaySourceIntegration>(source.Integration ?? "RequestResponse", ignoreCase: true));
                    return new RestApiSource {
                        HttpMethod = method,
                        Path = path,
                        Integration = integration,
                        OperationName = source.OperationName,
                        ApiKeyRequired = source.ApiKeyRequired,
                        Invoke = source.Invoke
                    };
                }));

            case "Schedule":
                return(AtLocation("Schedule", () => new ScheduleSource {
                    Expression = source.Schedule,
                    Name = source.Name
                }));

            case "S3":
                return(AtLocation("S3", () => new S3Source {
                    Bucket = source.S3,
                    Events = source.Events ?? new List <string> {
                        // default S3 events to listen to
                        "s3:ObjectCreated:*"
                    },
                    Prefix = source.Prefix,
                    Suffix = source.Suffix
                }));

            case "SlackCommand":
                return(AtLocation("SlackCommand", () => new RestApiSource {
                    HttpMethod = "POST",
                    Path = source.SlackCommand.Split('/', StringSplitOptions.RemoveEmptyEntries),
                    Integration = ApiGatewaySourceIntegration.SlackCommand,
                    OperationName = source.OperationName
                }));

            case "Topic":
                return(AtLocation("Topic", () => new TopicSource {
                    TopicName = source.Topic,
                    Filters = source.Filters
                }));

            case "Sqs":
                return(AtLocation("Sqs", () => new SqsSource {
                    Queue = source.Sqs,
                    BatchSize = source.BatchSize ?? 10
                }));

            case "Alexa":
                return(AtLocation("Alexa", () => new AlexaSource {
                    EventSourceToken = source.Alexa
                }));

            case "DynamoDB":
                return(AtLocation("DynamoDB", () => new DynamoDBSource {
                    DynamoDB = source.DynamoDB,
                    BatchSize = source.BatchSize ?? 100,
                    StartingPosition = source.StartingPosition ?? "LATEST"
                }));

            case "Kinesis":
                return(AtLocation("Kinesis", () => new KinesisSource {
                    Kinesis = source.Kinesis,
                    BatchSize = source.BatchSize ?? 100,
                    StartingPosition = source.StartingPosition ?? "LATEST"
                }));

            case "WebSocket":
                return(AtLocation("WebSocket", () => new WebSocketSource {
                    RouteKey = source.WebSocket.Trim(),
                    OperationName = source.OperationName,
                    ApiKeyRequired = source.ApiKeyRequired,
                    Invoke = source.Invoke
                }));
            }
            return(null);
        }
        public UpgradeCoefs GetCoefs(ICollection <MountedModuleItemNode> mountedModules, SelectedModuleNode selectedModule, SelectedSlotNode selectedSlot, ModuleItemNode mountedToSlotModule, ICollection <SlotNode> slots, ModuleUpgradeConfigNode moduleUpgradeConfig)
        {
            List <ModuleItemNode> tankModules               = new List <ModuleItemNode>();
            List <ModuleItemNode> weaponModules             = new List <ModuleItemNode>();
            List <ModuleItemNode> tankModulesWithSelected   = new List <ModuleItemNode>();
            List <ModuleItemNode> weaponModulesWithSelected = new List <ModuleItemNode>();

            this.FilterModules(mountedModules, selectedModule, mountedToSlotModule, tankModules, weaponModules, tankModulesWithSelected, weaponModulesWithSelected);
            int slotsCount = this.GetSlotsCount(slots, TankPartModuleType.TANK);
            int slotCount  = this.GetSlotsCount(slots, TankPartModuleType.WEAPON);

            return(new UpgradeCoefs {
                tankCoeff = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionary(tankModules), slotsCount, moduleUpgradeConfig.moduleUpgradablePowerConfig),
                weaponCoeff = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionary(weaponModules), slotCount, moduleUpgradeConfig.moduleUpgradablePowerConfig),
                tankCoeffWithSelected = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionary(tankModulesWithSelected), slotsCount, moduleUpgradeConfig.moduleUpgradablePowerConfig),
                weaponCoeffWithSelected = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionary(weaponModulesWithSelected), slotCount, moduleUpgradeConfig.moduleUpgradablePowerConfig)
            });
        }
 private void FilterModules(ICollection <MountedModuleItemNode> mountedModules, ModuleItemNode selectedModule, ModuleItemNode mountedToSlotModule, List <ModuleItemNode> tankModules, List <ModuleItemNode> weaponModules, List <ModuleItemNode> tankModulesWithSelected, List <ModuleItemNode> weaponModulesWithSelected)
 {
     foreach (MountedModuleItemNode node in mountedModules)
     {
         if ((mountedToSlotModule == null) || ((selectedModule == null) || (!mountedToSlotModule.Entity.Equals(node.Entity) || mountedToSlotModule.Entity.Equals(selectedModule.Entity))))
         {
             if (node.moduleTankPart.TankPart == TankPartModuleType.TANK)
             {
                 tankModulesWithSelected.Add(node);
                 if ((selectedModule != null) && node.Entity.Equals(selectedModule.Entity))
                 {
                     continue;
                 }
                 tankModules.Add(node);
                 continue;
             }
             weaponModulesWithSelected.Add(node);
             if ((selectedModule == null) || !node.Entity.Equals(selectedModule.Entity))
             {
                 weaponModules.Add(node);
             }
         }
     }
     if (selectedModule != null)
     {
         if ((selectedModule.moduleTankPart.TankPart == TankPartModuleType.TANK) && !this.ListContainsNodeWithEntity(tankModulesWithSelected, selectedModule.Entity))
         {
             tankModulesWithSelected.Add(selectedModule);
         }
         else if ((selectedModule.moduleTankPart.TankPart == TankPartModuleType.WEAPON) && !this.ListContainsNodeWithEntity(weaponModulesWithSelected, selectedModule.Entity))
         {
             weaponModulesWithSelected.Add(selectedModule);
         }
     }
 }
        private List <int[]> GetTierAndLevelsDictionaryForNextLevelModule(List <ModuleItemNode> modules, ModuleItemNode nextLevelModule)
        {
            List <int[]> list = new List <int[]>();

            foreach (ModuleItemNode node in modules)
            {
                int moduleLevel = this.GetModuleLevel(node);
                if (nextLevelModule.Entity.Equals(node.Entity))
                {
                    moduleLevel++;
                }
                int[] item = new int[] { node.moduleTier.TierNumber, moduleLevel };
                list.Add(item);
            }
            return(list);
        }
 private int GetModuleLevel(ModuleItemNode module) =>
 !module.Entity.HasComponent <ModuleUpgradeLevelComponent>() ? 0 : ((int)module.Entity.GetComponent <ModuleUpgradeLevelComponent>().Level);
        private void ConvertItem(AModuleItem parent, int index, ModuleItemNode node, IEnumerable <string> expectedTypes)
        {
            var type = DeterminNodeType("item", index, node, ModuleItemNode.FieldCombinations, expectedTypes);

            switch (type)
            {
            case "Parameter":
                AtLocation(node.Parameter, () => {
                    // validation
                    if (node.Properties != null)
                    {
                        Validate(node.Type != null, "'Type' attribute is required");
                    }
                    Validate((node.Allow == null) || (node.Type == "AWS") || ResourceMapping.IsCloudFormationType(node.Type), "'Allow' attribute can only be used with AWS resource types");
                    Validate(parent == null, "'Parameter' cannot be nested");

                    // create input parameter item
                    _builder.AddParameter(
                        name: node.Parameter,
                        section: node.Section,
                        label: node.Label,
                        description: node.Description,
                        type: node.Type ?? "String",
                        scope: ConvertScope(node.Scope),
                        noEcho: node.NoEcho,
                        defaultValue: node.Default,
                        constraintDescription: node.ConstraintDescription,
                        allowedPattern: node.AllowedPattern,
                        allowedValues: node.AllowedValues,
                        maxLength: node.MaxLength,
                        maxValue: node.MaxValue,
                        minLength: node.MinLength,
                        minValue: node.MinValue,
                        allow: node.Allow,
                        properties: ParseToDictionary("Properties", node.Properties),
                        arnAttribute: node.DefaultAttribute,
                        encryptionContext: node.EncryptionContext,
                        pragmas: node.Pragmas
                        );
                });
                break;

            case "Import":
                AtLocation(node.Import, () => {
                    // validation
                    Validate((node.Allow == null) || (node.Type == "AWS") || ResourceMapping.IsCloudFormationType(node.Type), "'Allow' attribute can only be used with AWS resource types");
                    Validate(node.Module != null, "missing 'Module' attribute");

                    // create input parameter item
                    _builder.AddImport(
                        parent: parent,
                        name: node.Import,
                        description: node.Description,
                        type: node.Type ?? "String",
                        scope: ConvertScope(node.Scope),
                        allow: node.Allow,
                        module: node.Module ?? "Bad.Module",
                        encryptionContext: node.EncryptionContext,
                        out var _
                        );
                });