Exemplo n.º 1
0
        public DataSet GetDataSet(MetaEntityNamespaceCollection namespaces)
        {
            DataTable valueTable = GetVerticalDataTable(namespaces);


            DataSet output = new DataSet();

            output.Tables.Add(valueTable);

            foreach (var item in Items)
            {
                var itemProperty = EntityClassDefinition.FindProperty(item.name);
                if (itemProperty.type.HasFlag(MetaEntityClassPropertyType.collection))
                {
                    MetaEntityClass itemClass = namespaces.FindClass(itemProperty.PropertyTypeName);

                    DataTable collectionTable = itemClass.CreateDataTableForEntities(MetaEntityClassPropertyType.valueCollection);
                    collectionTable.SetTitle(itemProperty.name);

                    foreach (var subitem in item.Items)
                    {
                        itemClass.CreateDataTableRow(collectionTable, subitem, MetaEntityClassPropertyType.valueCollection);
                    }
                    output.Tables.Add(collectionTable);
                }
                else
                {
                    var itemVerticalTable = item.GetVerticalDataTable(namespaces, itemProperty.name);

                    output.Tables.Add(itemVerticalTable);
                }
            }

            return(output);
        }
Exemplo n.º 2
0
        List <StandardisedItemPort> BuildPortList(EntityClassDefinition entity)
        {
            var ports = new List <StandardisedItemPort>();

            if (entity.Components.SCItem?.ItemPorts == null)
            {
                return(ports);
            }

            foreach (var itemPort in entity.Components.SCItem.ItemPorts)
            {
                foreach (var port in itemPort.Ports)
                {
                    var stdPort = new StandardisedItemPort
                    {
                        PortName = port.Name,
                        Size     = port.MaxSize,
                        Types    = BuildPortTypes(port),
                        Flags    = BuildPortFlags(port)
                    };

                    stdPort.Uneditable = stdPort.Flags.Contains("$uneditable") || stdPort.Flags.Contains("uneditable");

                    ports.Add(stdPort);
                }
            }

            return(ports);
        }
Exemplo n.º 3
0
        static bool TypeMatch(EntityClassDefinition entity, string typePattern)
        {
            var patternSplit = typePattern.Split('.', 2);

            var type = patternSplit[0];

            if (type == "*")
            {
                type = null;
            }

            var subType = patternSplit.Length > 1 ? patternSplit[1] : null;

            if (subType == "*")
            {
                subType = null;
            }

            var entityType    = entity?.Components?.SAttachableComponentParams?.AttachDef?.Type;
            var entitySubType = entity?.Components?.SAttachableComponentParams?.AttachDef?.SubType;

            if (!String.IsNullOrEmpty(type) && !String.Equals(type, entityType, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }
            if (!String.IsNullOrEmpty(subType) && !String.Equals(subType, entitySubType, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
        AmmoParams GetAmmoParams(EntityClassDefinition item)
        {
            // If this a weapon that contains its own ammo, or if it is a magazine, then it will have an SCAmmoContainerComponentParams component.
            var ammoRef = item.Components.SAmmoContainerComponentParams?.ammoParamsRecord;

            if (ammoRef != null)
            {
                return(ammoSvc.GetByReference(ammoRef));
            }

            // Otherwise if this is a weapon then SCItemWeaponComponentParams.ammoContainerRecord should be the reference of a magazine entity
            var magRef = item.Components.SCItemWeaponComponentParams?.ammoContainerRecord;

            if (magRef == null)
            {
                return(null);
            }
            var mag = entitySvc.GetByReference(magRef);

            if (mag == null)
            {
                return(null);
            }

            // And the magazine's SAmmoContainerComponentParams will tell us about the ammo
            return(ammoSvc.GetByReference(mag.Components.SAmmoContainerComponentParams.ammoParamsRecord));
        }
Exemplo n.º 5
0
        StandardisedWeapon BuildWeaponInfo(EntityClassDefinition item)
        {
            var weapon = item.Components.SCItemWeaponComponentParams;

            if (weapon == null)
            {
                return(null);
            }

            var info = new StandardisedWeapon
            {
                Modes      = new List <StandardisedWeaponMode>(),
                Ammunition = BuildAmmunitionInfo(item)
            };

            foreach (var action in weapon.fireActions)
            {
                var modeInfo = BuildWeaponModeInfo(action);

                modeInfo.DamagePerShot   = (info.Ammunition?.ImpactDamage + info.Ammunition?.DetonationDamage) * modeInfo.PelletsPerShot;
                modeInfo.DamagePerSecond = modeInfo.DamagePerShot * (modeInfo.RoundsPerMinute / 60f);

                info.Modes.Add(modeInfo);
            }

            return(info);
        }
Exemplo n.º 6
0
        static bool TagMatch(EntityClassDefinition entity, string tag)
        {
            var tagList = entity?.Components?.SAttachableComponentParams?.AttachDef?.Tags ?? "";
            var split   = tagList.Split(' ');

            return(split.Contains(tag, StringComparer.OrdinalIgnoreCase));
        }
Exemplo n.º 7
0
        StandardisedQuantumDrive BuildQuantumDriveInfo(EntityClassDefinition item)
        {
            var qdComponent = item.Components.SCItemQuantumDriveParams;

            if (qdComponent == null)
            {
                return(null);
            }

            return(new StandardisedQuantumDrive
            {
                JumpRange = qdComponent.jumpRange,
                FuelRate = qdComponent.quantumFuelRequirement / 1e6,
                StandardJump = new StandardisedJumpPerformance
                {
                    Speed = [email protected],
                    SpoolUpTime = [email protected],
                    Stage1AccelerationRate = [email protected],
                    State2AccelerationRate = [email protected],
                    Cooldown = [email protected]
                },
                SplineJump = new StandardisedJumpPerformance
                {
                    Speed = qdComponent.splineJumpParams.driveSpeed,
                    SpoolUpTime = qdComponent.splineJumpParams.spoolUpTime,
                    Stage1AccelerationRate = qdComponent.splineJumpParams.stageOneAccelRate,
                    State2AccelerationRate = qdComponent.splineJumpParams.stageTwoAccelRate,
                    Cooldown = qdComponent.splineJumpParams.cooldownTime
                }
            });
        }
        public static EntityClassDefinition GetEntityClassDefinition(this DapperProject project, ScalarFunction scalarFunction)
        {
            var definition = new EntityClassDefinition
            {
                Namespaces =
                {
                    "System"
                },
                Namespace      = project.Database.HasDefaultSchema(scalarFunction) ? project.GetEntityLayerNamespace() : project.GetEntityLayerNamespace(scalarFunction.Schema),
                AccessModifier = AccessModifier.Public,
                Name           = project.GetEntityName(scalarFunction),
                Constructors   =
                {
                    new ClassConstructorDefinition(AccessModifier.Public)
                }
            };

            if (!string.IsNullOrEmpty(scalarFunction.Description))
            {
                definition.Documentation.Summary = scalarFunction.Description;
            }

            var selection = project.GetSelection(scalarFunction);

            definition.Implements.Add("IEntity");

            if (selection.Settings.SimplifyDataTypes)
            {
                definition.SimplifyDataTypes();
            }

            return(definition);
        }
Exemplo n.º 9
0
        StandardisedMissileRack BuildMissileRackInfo(EntityClassDefinition item)
        {
            if (item.Components.SAttachableComponentParams?.AttachDef.Type != "MissileLauncher")
            {
                return(null);
            }
            if (item.Components.SAttachableComponentParams?.AttachDef.SubType != "MissileRack")
            {
                return(null);
            }

            var rootPort = item.Components.SCItem?.ItemPorts;

            if (rootPort == null || rootPort.Length == 0)
            {
                return(null);
            }

            var rackPorts = rootPort[0].Ports;

            if (rackPorts == null || rackPorts.Length == 0)
            {
                return(null);
            }

            return(new StandardisedMissileRack
            {
                Count = rackPorts.Length,
                Size = rackPorts[0].MaxSize
            });
        }
        public static EntityClassDefinition GetEntityClassDefinition(this DapperProject project, StoredProcedure storedProcedure)
        {
            var definition = new EntityClassDefinition
            {
                Namespaces =
                {
                    "System"
                },
                Namespace      = project.Database.HasDefaultSchema(storedProcedure) ? project.GetEntityLayerNamespace() : project.GetEntityLayerNamespace(storedProcedure.Schema),
                AccessModifier = AccessModifier.Public,
                Name           = project.GetResultName(storedProcedure),
                Constructors   =
                {
                    new ClassConstructorDefinition(AccessModifier.Public)
                }
            };

            foreach (var resultSet in storedProcedure.FirstResultSetsForObject)
            {
                var type = project.Database.ResolveDatabaseType(resultSet.SystemTypeName);

                definition.Properties.Add(new PropertyDefinition
                {
                    AccessModifier = AccessModifier.Public,
                    Type           = type,
                    Name           = resultSet.Name,
                    IsAutomatic    = true
                });
            }

            return(definition);
        }
Exemplo n.º 11
0
        StandardisedArmour BuildArmourInfo(EntityClassDefinition item)
        {
            var armour = item.Components.SCItemVehicleArmorParams;

            if (armour == null)
            {
                return(null);
            }

            return(new StandardisedArmour
            {
                DamageMultipliers = new StandardisedDamage
                {
                    Physical = armour.damageMultiplier.DamageInfo.DamagePhysical,
                    Energy = armour.damageMultiplier.DamageInfo.DamageEnergy,
                    Distortion = armour.damageMultiplier.DamageInfo.DamageDistortion,
                    Thermal = armour.damageMultiplier.DamageInfo.DamageThermal,
                    Biochemical = armour.damageMultiplier.DamageInfo.DamageBiochemical,
                    Stun = armour.damageMultiplier.DamageInfo.DamageStun
                },

                SignalMultipliers = new StandardisedSignature
                {
                    CrossSection = armour.signalCrossSection,
                    Infrared = armour.signalInfrared,
                    Electromagnetic = armour.signalElectromagnetic
                }
            });
        }
        public static EntityClassDefinition GetEntityClassDefinition(this EntityFrameworkCoreProject project, StoredProcedure storedProcedure)
        {
            var definition = new EntityClassDefinition
            {
                Namespaces =
                {
                    "System"
                },
                Namespace      = project.Database.HasDefaultSchema(storedProcedure) ? project.GetEntityLayerNamespace() : project.GetEntityLayerNamespace(storedProcedure.Schema),
                AccessModifier = AccessModifier.Public,
                Name           = project.GetEntityResultName(storedProcedure),
                IsPartial      = true,
                Constructors   =
                {
                    new ClassConstructorDefinition
                    {
                        AccessModifier = AccessModifier.Public
                    }
                },
                DbObject = storedProcedure
            };

            if (!string.IsNullOrEmpty(storedProcedure.Description))
            {
                definition.Documentation.Summary = storedProcedure.Description;
            }

            var projectSelection = project.GetSelection(storedProcedure);

            if (storedProcedure.FirstResultSetsForObject.Count == 0)
            {
                // todo: Add logic to stored procedures with no result set
            }
            else
            {
                foreach (var property in storedProcedure.FirstResultSetsForObject)
                {
                    var propertyType = project.Database.ResolveDatabaseType(property.SystemTypeName);

                    definition.Properties.Add(new PropertyDefinition
                    {
                        AccessModifier = AccessModifier.Public,
                        Type           = propertyType,
                        Name           = project.GetPropertyName(property.Name),
                        IsAutomatic    = true
                    });
                }
            }

            if (projectSelection.Settings.SimplifyDataTypes)
            {
                definition.SimplifyDataTypes();
            }

            return(definition);
        }
        public static EntityClassDefinition GetEntityClassDefinition(this EntityFrameworkCoreProject project, IView view)
        {
            var definition = new EntityClassDefinition
            {
                Namespaces =
                {
                    "System"
                },
                Namespace      = project.Database.HasDefaultSchema(view) ? project.GetEntityLayerNamespace() : project.GetEntityLayerNamespace(view.Schema),
                AccessModifier = AccessModifier.Public,
                Name           = project.GetEntityName(view),
                IsPartial      = true,
                Constructors   =
                {
                    new ClassConstructorDefinition
                    {
                        AccessModifier = AccessModifier.Public
                    }
                },
                DbObject = view
            };

            if (!string.IsNullOrEmpty(view.Description))
            {
                definition.Documentation.Summary = view.Description;
            }

            var projectSelection = project.GetSelection(view);

            if (projectSelection.Settings.UseDataAnnotations)
            {
                definition.Namespaces.Add("System.ComponentModel.DataAnnotations");
                definition.Namespaces.Add("System.ComponentModel.DataAnnotations.Schema");
            }

            foreach (var column in view.Columns)
            {
                var propertyType = project.Database.ResolveDatabaseType(column);

                definition.Properties.Add(new PropertyDefinition
                {
                    AccessModifier = AccessModifier.Public,
                    Type           = propertyType,
                    Name           = project.GetPropertyName(view, column),
                    IsAutomatic    = true
                });
            }

            if (projectSelection.Settings.SimplifyDataTypes)
            {
                definition.SimplifyDataTypes();
            }

            return(definition);
        }
        public static EntityClassDefinition GetEntityClassDefinition(this DapperProject project, IView view)
        {
            var definition = new EntityClassDefinition
            {
                Namespaces =
                {
                    "System"
                },
                Namespace      = project.Database.HasDefaultSchema(view) ? project.GetEntityLayerNamespace() : project.GetEntityLayerNamespace(view.Schema),
                AccessModifier = AccessModifier.Public,
                Name           = project.GetEntityName(view)
            };

            definition.Constructors.Add(new ClassConstructorDefinition(AccessModifier.Public));

            if (!string.IsNullOrEmpty(view.Description))
            {
                definition.Documentation.Summary = view.Description;
            }

            var selection = project.GetSelection(view);

            foreach (var column in view.Columns)
            {
                var propertyType = project.Database.ResolveDatabaseType(column);
                var propertyName = project.GetPropertyName(view, column);

                if (selection.Settings.UseAutomaticPropertiesForEntities)
                {
                    definition.Properties.Add(new PropertyDefinition
                    {
                        AccessModifier = AccessModifier.Public,
                        Type           = project.Database.ResolveDatabaseType(column),
                        Name           = project.GetPropertyName(view, column),
                        IsAutomatic    = true
                    });
                }
                else
                {
                    definition.AddPropertyWithField(propertyType, propertyName);
                }
            }

            definition.Implements.Add("IEntity");

            if (selection.Settings.SimplifyDataTypes)
            {
                definition.SimplifyDataTypes();
            }

            return(definition);
        }
Exemplo n.º 15
0
        private async IAsyncEnumerable <Item> LoadAndWriteJsonFiles(string itemsFolder)
        {
            var folderPath = Path.Combine(DataRoot, itemsFolder);
            var index      = new List <Item>();

            var searchOptions = itemsFolder.ToLower().EndsWith("scitem")
                                                    ? SearchOption.TopDirectoryOnly
                                                    : SearchOption.AllDirectories;

            foreach (var entityFilename in Directory.EnumerateFiles(folderPath, "*.xml", searchOptions))
            {
                if (AvoidFile(entityFilename))
                {
                    continue;
                }

                EntityClassDefinition entity = null;

                // Entity
                _logger.LogInformation(entityFilename);
                entity = await _entityParser.Parse(entityFilename, OnXmlLoadout);

                if (entity == null)
                {
                    continue;
                }

                var jsonFilename = Path.Combine(OutputFolder, $"{entity.ClassName.ToLower()}.json");
                _ = _jsonFileReaderWriter.WriteFile(jsonFilename, () => new { Raw = new { Entity = entity } });

                var manufacturer =
                    FindManufacturer(entity.Components?.SAttachableComponentParams?.AttachDef.Manufacturer);

                var etd = GetLocalizedDataFromEntity(entity);
                yield return(new Item
                {
                    Id = new Guid(entity.Id),
                    JsonFilename =
                        Path.GetRelativePath(Path.GetDirectoryName(OutputFolder), jsonFilename),
                    ClassName = entity.ClassName,
                    Type = etd.Type,
                    SubType = etd.SubType,
                    ItemName = entity.ClassName.ToLower(),
                    Size = entity.Components?.SAttachableComponentParams?.AttachDef.Size,
                    Grade = entity.Components?.SAttachableComponentParams?.AttachDef.Grade,
                    Name = etd.Name,
                    Description = etd.Description,
                    Manufacturer = manufacturer,
                    ManufacturerId = manufacturer.Id
                });
            }
        }
Exemplo n.º 16
0
        private EntityTextData GetLocalizedDataFromEntity(EntityClassDefinition entity)
        {
            var etd = new EntityTextData();

            var e = entity.Components.CommodityComponentParams;

            etd.Type        = e.type;
            etd.SubType     = e.subtype;
            etd.Name        = _localisationService.GetText(e.name);
            etd.Description = _localisationService.GetText(e.description);

            return(etd);
        }
Exemplo n.º 17
0
        StandardisedFuelIntake BuildHydrogenFuelIntakeInfo(EntityClassDefinition item)
        {
            var intake = item.Components.SCItemFuelIntakeParams;

            if (intake == null)
            {
                return(null);
            }

            return(new StandardisedFuelIntake
            {
                Rate = intake.fuelPushRate
            });
        }
Exemplo n.º 18
0
        StandardisedCooler BuildCoolerInfo(EntityClassDefinition item)
        {
            var cooler = item.Components.SCItemCoolerParams;

            if (cooler == null)
            {
                return(null);
            }

            return(new StandardisedCooler
            {
                Rate = cooler.CoolingRate
            });
        }
        public static EntityClassDefinition GetEntityClassDefinition(this EntityFrameworkCoreProject project, TableFunction tableFunction)
        {
            var definition = new EntityClassDefinition
            {
                Namespaces =
                {
                    "System"
                },
                Namespace      = project.Database.HasDefaultSchema(tableFunction) ? project.GetEntityLayerNamespace() : project.GetEntityLayerNamespace(tableFunction.Schema),
                AccessModifier = AccessModifier.Public,
                Name           = project.GetEntityResultName(tableFunction),
                IsPartial      = true,
                Constructors   =
                {
                    new ClassConstructorDefinition
                    {
                        AccessModifier = AccessModifier.Public
                    }
                },
                DbObject = tableFunction
            };

            if (!string.IsNullOrEmpty(tableFunction.Description))
            {
                definition.Documentation.Summary = tableFunction.Description;
            }

            var projectSelection = project.GetSelection(tableFunction);

            foreach (var column in tableFunction.Columns)
            {
                var type = project.Database.ResolveDatabaseType(column);

                definition.Properties.Add(new PropertyDefinition
                {
                    AccessModifier = AccessModifier.Public,
                    Type           = type,
                    Name           = project.GetPropertyName(column.Name),
                    IsAutomatic    = true
                });
            }

            if (projectSelection.Settings.SimplifyDataTypes)
            {
                definition.SimplifyDataTypes();
            }

            return(definition);
        }
Exemplo n.º 20
0
        StandardisedPowerConnection BuildPowerConnectionInfo(EntityClassDefinition item)
        {
            var power = item.Components.EntityComponentPowerConnection;

            if (power == null)
            {
                return(null);
            }

            return(new StandardisedPowerConnection
            {
                PowerBase = power.PowerBase,
                PowerDraw = power.PowerDraw
            });
        }
Exemplo n.º 21
0
        StandardisedIfcs BuildIfcsInfo(EntityClassDefinition item)
        {
            var ifcs = item.Components.IFCSParams;

            if (ifcs == null)
            {
                return(null);
            }

            return(new StandardisedIfcs
            {
                MaxSpeed = ifcs.maxSpeed,
                MaxAfterburnSpeed = ifcs.maxAfterburnSpeed
            });
        }
Exemplo n.º 22
0
        StandardisedQig BuildQigInfo(EntityClassDefinition item)
        {
            var qig = item.Components.SCItemQuantumInterdictionGeneratorParams;

            if (qig == null)
            {
                return(null);
            }

            return(new StandardisedQig
            {
                JammingRange = qig.jammerSettings[0].jammerRange,
                InterdictionRange = qig.quantumInterdictionPulseSettings[0].radiusMeters
            });
        }
Exemplo n.º 23
0
        StandardisedScanner BuildScannerInfo(EntityClassDefinition item)
        {
            var scanner = item.Components.SSCItemScannerComponentParams;

            if (scanner == null)
            {
                return(null);
            }

            var info = new StandardisedScanner
            {
                Range = scanner.scanRange
            };

            return(info);
        }
Exemplo n.º 24
0
        StandardisedMissile BuildMissileInfo(EntityClassDefinition item)
        {
            var missile = item.Components.SCItemMissileParams;

            if (missile == null)
            {
                return(null);
            }

            var info = new StandardisedMissile
            {
                Damage = ConvertDamage(missile.explosionParams.damage[0])
            };

            return(info);
        }
Exemplo n.º 25
0
        StandardisedCoolerConnection BuildHeatConnectionInfo(EntityClassDefinition item)
        {
            var heat = item.Components.EntityComponentHeatConnection;

            if (heat == null)
            {
                return(null);
            }

            return(new StandardisedCoolerConnection
            {
                ThermalEnergyBase = heat.ThermalEnergyBase,
                ThermalEnergyDraw = heat.ThermalEnergyDraw,
                CoolingRate = heat.MaxCoolingRate
            });
        }
Exemplo n.º 26
0
        StandardisedDurability BuildDurabilityInfo(EntityClassDefinition item)
        {
            var degradation = item.Components.SDegradationParams;
            var health      = item.Components.SHealthComponentParams;

            if (degradation == null && health == null)
            {
                return(null);
            }

            return(new StandardisedDurability
            {
                Lifetime = degradation?.MaxLifetimeHours,
                Health = health?.Health
            });
        }
Exemplo n.º 27
0
        List <StandardisedSignatureDetection> BuildDetectionSignatures(EntityClassDefinition item)
        {
            var detections = new List <StandardisedSignatureDetection>();

            foreach (var detection in item.Components.SCItemRadarComponentParams.signatureDetection)
            {
                detections.Add(new StandardisedSignatureDetection
                {
                    Detectable      = detection.detectable,
                    Sensitivity     = detection.sensitivity,
                    AmbientPiercing = detection.ambientPiercing
                });
            }

            return(detections);
        }
Exemplo n.º 28
0
        private async IAsyncEnumerable <Commodity> LoadAndWriteJsonFiles(string itemsFolder)
        {
            var folderPath = Path.Combine(DataRoot, itemsFolder);
            var index      = new List <Item>();

            foreach (var entityFilename in Directory.EnumerateFiles(folderPath, "*.xml", SearchOption.AllDirectories))
            {
                if (AvoidFile(entityFilename))
                {
                    continue;
                }

                EntityClassDefinition entity = null;

                // Entity
                _logger.LogInformation(entityFilename);
                entity = await _entityParser.Parse(entityFilename, OnXmlLoadout);

                if (entity == null)
                {
                    continue;
                }

                var jsonFilename = Path.Combine(OutputFolder, $"{entity.ClassName.ToLower()}.json");
                _ = _jsonFileReaderWriter.WriteFile(jsonFilename, () => new { Raw = new { Entity = entity } });

                var etd = GetLocalizedDataFromEntity(entity);

                var type        = CommodityTypes[etd.Type];
                var subType     = CommodityTypes.GetValueOrDefault(etd.SubType);
                var description = string.IsNullOrWhiteSpace(etd.Description) ? subType?.Description : etd.Description;

                yield return(new Commodity
                {
                    Id = new Guid(entity.Id),
                    JsonFilename =
                        Path.GetRelativePath(Path.GetDirectoryName(OutputFolder), jsonFilename),
                    ClassName = entity.ClassName,
                    Type = type,
                    TypeId = type.Id,
                    SubType = subType,
                    SubTypeId = subType?.Id,
                    Name = etd.Name,
                    Description = description
                });
            }
        }
Exemplo n.º 29
0
        public List <MetaPropertyInstruction> ConvertToInstructions(MetaEntityNamespaceCollection namespaces, Boolean includeItems = true)
        {
            List <MetaPropertyInstruction> output = new List <MetaPropertyInstruction>();

            CheckClassDefinition(namespaces, EntityClassName);

            output.Add(new MetaPropertyInstruction(nameof(name), name));
            output.Add(new MetaPropertyInstruction(nameof(EntityClassName), EntityClassName));

            foreach (var setter in Setters)
            {
                var setterProperty = EntityClassDefinition.FindProperty(setter.name);

                output.Add(new MetaPropertyInstruction(setter, setterProperty));
            }

            if (includeItems)
            {
                foreach (var item in Items)
                {
                    var itemProperty = EntityClassDefinition.FindProperty(item.name);
                    if (itemProperty.type.HasFlag(MetaEntityClassPropertyType.collection))
                    {
                        List <MetaPropertyInstruction> itemInstructions = new List <MetaPropertyInstruction>();
                        foreach (var subitem in item.Items)
                        {
                            var subinstructions = subitem.ConvertToInstructions(namespaces);
                            if (subinstructions.Any())
                            {
                                itemInstructions.Add(new MetaPropertyInstruction(subitem.name, subinstructions));
                            }
                        }
                        if (itemInstructions.Any())
                        {
                            output.Add(new MetaPropertyInstruction(itemProperty.name, itemInstructions));
                        }
                    }
                    else
                    {
                        var subinstructions = item.ConvertToInstructions(namespaces);
                        output.Add(new MetaPropertyInstruction(itemProperty.name, subinstructions));
                    }
                }
            }

            return(output);
        }
Exemplo n.º 30
0
        private EntityTextData GetLocalizedDataFromEntity(EntityClassDefinition entity)
        {
            var etd = new EntityTextData();

            if (entity.Components?.SAttachableComponentParams != null)
            {
                etd.Type    = entity.Components.SAttachableComponentParams.AttachDef.Type;
                etd.SubType = entity.Components.SAttachableComponentParams.AttachDef.SubType;
                etd.Name    = _localisationService.GetText(entity.Components.SAttachableComponentParams.AttachDef
                                                           .Localization.Name);
                etd.Description =
                    _localisationService.GetText(entity.Components.SAttachableComponentParams.AttachDef.Localization
                                                 .Description);
            }

            return(etd);
        }