public DictionaryItemSchema() { this.Setup(SchemaAlias, "Dictionary Item Schema"); Id = FixedHiveIds.DictionaryItemSchema; SchemaType = FixedSchemaTypes.Content; RelationProxies.EnlistParent(FixedSchemas.DictionaryRootSchema, FixedRelationTypes.DefaultRelationType); var nodeNameType = new NodeNameAttributeType(); var translationsType = new DictionaryItemTranslationsAttributeType(); AttributeDefinitions.Add(new AttributeDefinition(NodeNameAttributeDefinition.AliasValue, "Node Name") { Id = new HiveId("di-name".EncodeAsGuid()), AttributeType = nodeNameType, AttributeGroup = FixedGroupDefinitions.GeneralGroup, Ordinal = 0 }); AttributeDefinitions.Add(new AttributeDefinition(TranslationsAlias, "Translations") { Id = new HiveId("di-translations".EncodeAsGuid()), AttributeType = translationsType, AttributeGroup = FixedGroupDefinitions.Translations, Ordinal = 0 }); SetXmlConfigProperty("thumb", "developer.png"); SetXmlConfigProperty("icon", "dictionary.gif"); SetXmlConfigProperty("description", "A dictionary item"); //save the allowed children as a list of HiveId's as string SetXmlConfigProperty("allowed-children", new string[] { FixedHiveIds.DictionaryItemSchema.ToString() }); }
public FileSchema() { SchemaType = FixedSchemaTypes.File; AttributeDefinitions.Add(new AttributeDefinition { Alias = "name", Name = "Name", AttributeType = new StringAttributeType(), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); AttributeDefinitions.Add(new AttributeDefinition { Alias = "location", Name = "Location", AttributeType = new StringAttributeType(), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); AttributeDefinitions.Add(new AttributeDefinition { Alias = "isContainer", Name = "Is Container", AttributeType = new IntegerAttributeType(), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); AttributeDefinitions.Add(new AttributeDefinition { Alias = "absolutePath", Name = "Absolute Path", AttributeType = new StringAttributeType(), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); }
public MediaFolderSchema() { this.Setup(SchemaAlias, "Folder"); Id = FixedHiveIds.MediaFolderSchema; SchemaType = FixedSchemaTypes.Content; RelationProxies.EnlistParent(FixedSchemas.MediaRootSchema, FixedRelationTypes.DefaultRelationType); var nameNameType = new NodeNameAttributeType(); AttributeDefinitions.Add(new AttributeDefinition(NodeNameAttributeDefinition.AliasValue, "Node Name") { Id = new HiveId("mf-name".EncodeAsGuid()), AttributeType = nameNameType, AttributeGroup = FixedGroupDefinitions.GeneralGroup, Ordinal = 0 }); SetXmlConfigProperty("thumb", "folder_media.png"); SetXmlConfigProperty("icon", "tree-folder"); //TODO: Need to change this to be a 'key' lookup for localization SetXmlConfigProperty("description", "A folder for media"); //save the allowed children as a list of HiveId's as string SetXmlConfigProperty("allowed-children", new[] { FixedHiveIds.MediaFolderSchema.ToString(), FixedHiveIds.MediaImageSchema.ToString() }); }
internal override void MakeReadOnly() { base.MakeReadOnly(); ElementDefinitions.MakeReadOnly(); AttributeDefinitions.MakeReadOnly(); ProcessingInstructionDefinitions.MakeReadOnly(); }
public MediaImageSchema() { this.Setup(SchemaAlias, "Image"); Id = FixedHiveIds.MediaImageSchema; SchemaType = FixedSchemaTypes.Content; RelationProxies.EnlistParent(FixedSchemas.MediaRootSchema, FixedRelationTypes.DefaultRelationType); var nameNameType = AttributeTypeRegistry.Current.GetAttributeType(NodeNameAttributeType.AliasValue); var fileUploadType = AttributeTypeRegistry.Current.GetAttributeType("uploader"); AttributeDefinitions.Add(new AttributeDefinition(NodeNameAttributeDefinition.AliasValue, "Node Name") { Id = new HiveId("mi-name".EncodeAsGuid()), AttributeType = nameNameType, AttributeGroup = FixedGroupDefinitions.GeneralGroup, Ordinal = 0 }); AttributeDefinitions.Add(new AttributeDefinition(UploadFileAlias, "Uploaded File") { Id = new HiveId("mi-upload".EncodeAsGuid()), AttributeType = fileUploadType, AttributeGroup = FixedGroupDefinitions.FileProperties, Ordinal = 0 }); SetXmlConfigProperty("thumb", "image1.png"); SetXmlConfigProperty("icon", "tree-media-photo"); //TODO: Need to change this to be a 'key' lookup for localization SetXmlConfigProperty("description", "An image"); //save the allowed children as a list of HiveId's as string SetXmlConfigProperty("allowed-children", new string[] { }); }
public CompositeEntitySchema(EntitySchema schema, IEnumerable <EntitySchema> ancestorSchemas, bool copyRelationProxiesFromSchema = false) : base(schema.Alias, schema.Name) { //TODO: Need to move this into a mapper, but not currently one available at the right level Id = schema.Id; SchemaType = SchemaType; AttributeGroups.AddRange(schema.AttributeGroups); AttributeDefinitions.AddRange(schema.AttributeDefinitions); UtcCreated = schema.UtcCreated; UtcModified = schema.UtcModified; UtcStatusChanged = schema.UtcStatusChanged; var inheritedDefsDict = new Dictionary <string, InheritedAttributeDefinition>(); var inheritedDefs = ancestorSchemas .SelectMany(entitySchema => entitySchema.AttributeDefinitions.Select(definition => new InheritedAttributeDefinition(definition, entitySchema))).ToArray(); foreach (var def in inheritedDefs) { if (!inheritedDefsDict.ContainsKey(def.Alias)) { inheritedDefsDict.Add(def.Alias, def); } } InheritedAttributeDefinitions = new EntityCollection <InheritedAttributeDefinition>(inheritedDefsDict.Values); // Need to only show the inherited groups that are exposed by the filtered inherited attribute definitions, but also include empty // groups so that they have a chance to have some definitions added var allLinkedGroups = ancestorSchemas.SelectMany(x => x.AttributeDefinitions.Select(y => new InheritedAttributeGroup(y.AttributeGroup, x))); var allKnownGroups = ancestorSchemas.SelectMany(x => x.AttributeGroups.Select(y => new InheritedAttributeGroup(y, x))); var unlinkedGroups = allKnownGroups.Except(allLinkedGroups); var inheritedGroups = InheritedAttributeDefinitions.Select(x => new InheritedAttributeGroup(x.AttributeGroup, x.Schema)).Union (unlinkedGroups); InheritedAttributeGroups = new EntityCollection <InheritedAttributeGroup>(inheritedGroups); RelationProxies.LazyLoadDelegate = schema.RelationProxies.LazyLoadDelegate; XmlConfiguration = schema.XmlConfiguration; if (copyRelationProxiesFromSchema) { foreach (var proxies in schema.RelationProxies.GetManualParentProxies()) { RelationProxies.EnlistParent(proxies.Item.Source, proxies.Item.Type, proxies.Item.Ordinal, proxies.Item.MetaData.ToArray()); } foreach (var proxies in schema.RelationProxies.GetManualChildProxies()) { RelationProxies.EnlistParent(proxies.Item.Source, proxies.Item.Type, proxies.Item.Ordinal, proxies.Item.MetaData.ToArray()); } } }
public FileSchema() { SchemaType = FixedSchemaTypes.File; AttributeDefinitions.Add(new AttributeDefinition { Alias = "name", Name = "Name", AttributeType = AttributeTypeRegistry.Current.GetAttributeType(StringAttributeType.AliasValue), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); AttributeDefinitions.Add(new AttributeDefinition { Alias = "rootedPath", Name = "RootedPath", AttributeType = AttributeTypeRegistry.Current.GetAttributeType(StringAttributeType.AliasValue), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); AttributeDefinitions.Add(new AttributeDefinition { Alias = "rootRelativePath", Name = "Root Relative Path", AttributeType = AttributeTypeRegistry.Current.GetAttributeType(StringAttributeType.AliasValue), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); AttributeDefinitions.Add(new AttributeDefinition { Alias = "publicUrl", Name = "Public URL", AttributeType = AttributeTypeRegistry.Current.GetAttributeType(StringAttributeType.AliasValue), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); AttributeDefinitions.Add(new AttributeDefinition { Alias = "isContainer", Name = "Is Container", AttributeType = AttributeTypeRegistry.Current.GetAttributeType(IntegerAttributeType.AliasValue), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); AttributeDefinitions.Add(new AttributeDefinition { Alias = "contentBytes", Name = "Content Bytes", AttributeType = new BytesAttributeType(), AttributeGroup = FixedGroupDefinitions.GeneralGroup }); }
public HtmlSchema(string name) : base(name) { NodeTypeProvider = HtmlNodeTypeProvider.Instance; if (name == HTML5_NAME) { AttributeDefinitions.Add( new HtmlAttributeDefinition("class") { ValueType = typeof(DomStringTokenList) } ); Html5TagLibrary.CopyTo(ElementDefinitions); } }
static void Postfix(RulesetCharacterHero __instance, ref RulesetAttackMode __result, ref WeaponDescription weaponDescription) { DamageForm firstDamageForm = __result.EffectDescription.FindFirstDamageForm(); WeaponTypeDefinition element = DatabaseRepository.GetDatabase <WeaponTypeDefinition>().GetElement(weaponDescription.WeaponType); int originalAbilityScoreModifier = AttributeDefinitions.ComputeAbilityScoreModifier(__instance.Attributes[__result.AbilityScore].CurrentValue); __result.AbilityScore = element.WeaponProximity == RuleDefinitions.AttackProximity.Melee ? "Strength" : "Dexterity"; if (weaponDescription.WeaponTags.Contains("Finesse") && __instance.GetAttribute("Dexterity").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue) { __result.AbilityScore = "Dexterity"; } if (weaponDescription.WeaponTags.Contains("Knowledge") && __instance.GetAttribute("Intelligence").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue) { __result.AbilityScore = "Intelligence"; } if (weaponDescription.WeaponTags.Contains("Intuition") && __instance.GetAttribute("Wisdom").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue) { __result.AbilityScore = "Wisdom"; } if (weaponDescription.WeaponTags.Contains("Vigor") && __instance.GetAttribute("Constitution").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue) { __result.AbilityScore = "Constitution"; } if (weaponDescription.WeaponTags.Contains("Influence") && __instance.GetAttribute("Charisma").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue) { __result.AbilityScore = "Charisma"; } int abilityScoreModifier = AttributeDefinitions.ComputeAbilityScoreModifier(__instance.Attributes[__result.AbilityScore].CurrentValue); Predicate <RuleDefinitions.TrendInfo> predicate = FindAbilityScoreTrend; int ability_score_to_hit_trend_index = __result.ToHitBonusTrends.FindIndex(predicate); int ability_score_damage_bonus_trend_index = firstDamageForm.DamageBonusTrends.FindIndex(predicate); if (ability_score_to_hit_trend_index >= 0) { __result.ToHitBonus -= originalAbilityScoreModifier; __result.ToHitBonus += abilityScoreModifier; __result.ToHitBonusTrends.RemoveAt(ability_score_to_hit_trend_index); __result.ToHitBonusTrends.Add(new RuleDefinitions.TrendInfo(abilityScoreModifier, RuleDefinitions.FeatureSourceType.AbilityScore, __result.AbilityScore, (object)null)); } if (ability_score_damage_bonus_trend_index >= 0) { firstDamageForm.DamageBonusTrends.RemoveAt(ability_score_damage_bonus_trend_index); firstDamageForm.BonusDamage -= originalAbilityScoreModifier; firstDamageForm.BonusDamage += abilityScoreModifier; firstDamageForm.DamageBonusTrends.Add(new RuleDefinitions.TrendInfo(abilityScoreModifier, RuleDefinitions.FeatureSourceType.AbilityScore, __result.AbilityScore, (object)null)); } }
public HostnameSchema() { this.Setup(SchemaAlias, "Hostname Schema"); var inBuiltReadOnlyType = AttributeTypeRegistry.Current.GetAttributeType(ReadOnlyAttributeType.AliasValue); Id = FixedHiveIds.HostnameSchema; SchemaType = FixedSchemaTypes.Hostname; AttributeDefinitions.Add(new AttributeDefinition(HostnameAlias, "Hostname") { Id = new HiveId("hn-name".EncodeAsGuid()), AttributeType = inBuiltReadOnlyType, AttributeGroup = FixedGroupDefinitions.GeneralGroup, Ordinal = 0 }); }
public void AddAttributeDefinitionFile(string file) { if (AttributeDefinitions == null) { AttributeDefinitions = new List <string> { file }; return; } if (AttributeDefinitions.Contains(file)) { return; } AttributeDefinitions.Add(file); }
private IEnumerable <AttributeGroup> GetGroupsFromDefsDistinctByAlias() { var groupsFromDefs = AttributeDefinitions.Select(x => x.AttributeGroup).Distinct().WhereNotNull().ToList(); return(groupsFromDefs); }
protected bool HasIncomingVertices(BaseTypes myBaseType, AttributeDefinitions myDefinition) { return Vertex.HasIncomingVertices((long)myBaseType, (long)myDefinition); }
protected IEnumerable<IVertex> GetIncomingVertices(BaseTypes myBaseType, AttributeDefinitions myDefinition) { return Vertex.GetIncomingVertices((long)myBaseType, (long)myDefinition); }
protected IHyperEdge GetOutgoingHyperEdge(AttributeDefinitions myDefinition) { return Vertex.GetOutgoingHyperEdge((long)myDefinition); }
protected bool HasOutgoingEdge(AttributeDefinitions myDefinition) { return Vertex.HasOutgoingEdge((long)myDefinition); }
protected T GetProperty<T>(AttributeDefinitions myDefinition) { return Vertex.GetProperty<T>((long)myDefinition); }